Skip to content

Commit

Permalink
feat: add CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mxdvl committed Jan 25, 2023
1 parent 7952a8e commit c79fa64
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: CI
on:
pull_request:
workflow_dispatch:


env:
DENO_DIR: my_cache_directory

jobs:
health:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Cache Deno dependencies
uses: actions/cache@v2
with:
path: ${{ env.DENO_DIR }}
key: ${{ hashFiles('lock.json') }}

- name: Format
run: deno fmt --check

- name: Lint
run: deno lint

- name: Test
run: deno test --allow-net=registry.npmjs.org

working_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Cache Deno dependencies
uses: actions/cache@v2
with:
path: ${{ env.DENO_DIR }}
key: ${{ hashFiles('lock.json') }}

- run: |
deno run \
--allow-net=registry.npmjs.org \
--allow-read=. \
./main.ts \
fixtures/package_valid.json \
--verbose --cache
failing_peer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Cache Deno dependencies
uses: actions/cache@v2
with:
path: ${{ env.DENO_DIR }}
key: ${{ hashFiles('lock.json') }}

- run: |
deno run \
--allow-net=registry.npmjs.org \
--allow-read=. \
./main.ts \
fixtures/package.json \
--verbose --cache
- name: The job has failed, which is expected
if: ${{ failure() }}
run: exit 0

- name: The job has succeeded, which is wrong
if: ${{ success() }}
run: exit 1

final:
needs: [health, working_package, failing_peer]
runs-on: ubuntu-latest
steps:
- name: "All good"
run: exit 0
2 changes: 2 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c79fa64

Please sign in to comment.