ci: add CI (#21)

* ci: add ci

* ci: add lint and fmt

* build: add dockerfile

* ci: change version

* ci: deno check

* build: add .gitattributes

* ci: use glob

* ci: add pr
main
imspace 2022-11-16 20:47:01 +08:00 committed by GitHub
parent 068daa15bd
commit 239db3b2f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 26 deletions

View File

@ -1,29 +1,29 @@
{ {
"name": "Deno", "name": "Deno",
"build": { "build": {
"dockerfile": "Dockerfile" "dockerfile": "Dockerfile"
}, },
// Configure tool-specific properties. // Configure tool-specific properties.
"customizations": { "customizations": {
// Configure properties specific to VS Code. // Configure properties specific to VS Code.
"vscode": { "vscode": {
// Set *default* container specific settings.json values on container create. // Set *default* container specific settings.json values on container create.
"settings": { "settings": {
// Enables the project as a Deno project // Enables the project as a Deno project
"deno.enable": true, "deno.enable": true,
// Enables Deno linting for the project // Enables Deno linting for the project
"deno.lint": true, "deno.lint": true,
// Sets Deno as the default formatter for the project // Sets Deno as the default formatter for the project
"editor.defaultFormatter": "denoland.vscode-deno" "editor.defaultFormatter": "denoland.vscode-deno"
}, },
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.
"extensions": [ "extensions": [
"denoland.vscode-deno" "denoland.vscode-deno"
] ]
} }
}, },
"remoteUser": "vscode" "remoteUser": "vscode"
} }

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
cache/
export/
*.json

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

30
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
deno: [1.x, "1.21.x", canary]
steps:
- uses: actions/checkout@v2
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno }}
- name: Check fmt
run: deno fmt --check
- name: Run lint
run: deno lint
- name: All entries
uses: tj-actions/glob@v16
id: entries
with:
files: |
s3si.ts
initRank.ts
./scripts/*.ts
- name: Check entries
run: deno check ${{ steps.entries.outputs.paths }}
- name: Run tests
run: deno test

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM denoland/deno:1.26.2
WORKDIR /app
# Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified).
# Ideally cache deps.ts will download and compile _all_ external files used in main.ts.
COPY deps.ts .
RUN deno cache deps.ts
# These steps will be re-run upon each file change in your working directory:
ADD . .
# Compile the main app so that it doesn't need to be compiled each startup/entry.
RUN deno cache s3si.ts
CMD ["run", "-A", "s3si.ts", "-n"]