CI: fix path (#2557)

* ci: also upload coverage for pr

* ci: bump codecov action

* ci: add path filter

* ci: fix add checkout

* ci: fix 'true'

* ci: remove /

* ci: add flag to codecov

* ci: add carryforward on integration
This commit is contained in:
Jonathan Ho
2022-10-27 09:29:49 -05:00
committed by GitHub
parent 999fdb2c45
commit 9d9ba4c251
2 changed files with 51 additions and 6 deletions
+42 -6
View File
@@ -15,9 +15,41 @@ jobs:
deno-version: v1.x deno-version: v1.x
- name: Check Formatting - name: Check Formatting
run: deno fmt --check run: deno fmt --check
# change if any prod code changed, skip test without chnage
path-filter:
name: Check Path Changes
runs-on: ubuntu-latest
outputs:
code-change: ${{ steps.changes.outputs.code-change }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
code-change:
- ".github/workflows/test.yml"
- "gateway/**"
- "handlers/**"
- "helpers/**"
- "packages/**"
- "plugins/**"
- "rest/**"
- "template/**"
- "tests/**"
- "transformers/**"
- "types/**"
- "util/**"
- "bot.ts"
- "mod.ts"
- "dnt.ts"
type-test: type-test:
name: Type Test name: Type Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: path-filter
if: ${{ needs.path-filter.outputs.code-change == 'true' }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: denoland/setup-deno@main - uses: denoland/setup-deno@main
@@ -29,9 +61,12 @@ jobs:
run: deno check plugins/mod.ts run: deno check plugins/mod.ts
- name: Check Templates - name: Check Templates
run: deno check template/beginner/mod.ts template/minimal/mod.ts run: deno check template/beginner/mod.ts template/minimal/mod.ts
integration-test: integration-test:
name: Integration Test name: Integration Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: path-filter
if: ${{ needs.path-filter.outputs.code-change == 'true' }}
concurrency: integration-test concurrency: integration-test
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -48,16 +83,18 @@ jobs:
PROXY_REST_SECRET: ${{ secrets.PROXY_REST_SECRET }} PROXY_REST_SECRET: ${{ secrets.PROXY_REST_SECRET }}
PROXY_REST_URL: ${{ secrets.PROXY_REST_URL }} PROXY_REST_URL: ${{ secrets.PROXY_REST_URL }}
- name: Create coverage report - name: Create coverage report
if: github.ref == 'refs/heads/main'
run: deno coverage --exclude=tests ./coverage --lcov > coverage.lcov run: deno coverage --exclude=tests ./coverage --lcov > coverage.lcov
- name: Collect and upload the coverage report - name: Collect and upload the coverage report
if: github.ref == 'refs/heads/main' uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v1.0.10
with: with:
file: ./coverage.lcov file: ./coverage.lcov
flags: integration
unit-test: unit-test:
name: Unit Test name: Unit Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: path-filter
if: ${{ needs.path-filter.outputs.code-change == 'true' }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: denoland/setup-deno@main - uses: denoland/setup-deno@main
@@ -68,10 +105,9 @@ jobs:
env: env:
TEST_ENV: UNIT TEST_ENV: UNIT
- name: Create coverage report - name: Create coverage report
if: github.ref == 'refs/heads/main'
run: deno coverage --exclude=tests ./coverage --lcov > coverage.lcov run: deno coverage --exclude=tests ./coverage --lcov > coverage.lcov
- name: Collect and upload the coverage report - name: Collect and upload the coverage report
if: github.ref == 'refs/heads/main' uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v1.0.10
with: with:
file: ./coverage.lcov file: ./coverage.lcov
flags: unit
+9
View File
@@ -0,0 +1,9 @@
flags:
unit:
paths:
- ".*"
carryforward: false
integration:
paths:
- ".*"
carryforward: true