From 2610bd63ffdb66b552552a92a6844005d7acca6a Mon Sep 17 00:00:00 2001 From: Max Duval Date: Wed, 25 Jan 2023 12:08:11 +0000 Subject: [PATCH] feat: add CI workflow --- .github/workflows/ci.yml | 94 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..443d64d --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 \ + ./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 \ + ./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] + + steps: + - name: "All good" + run: exit 0 \ No newline at end of file