ci: speed up workflows and reduce costs #113
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- master | |
- v[0-9]+\.[0-9]+-dev | |
schedule: | |
- cron: '30 4 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
changes: | |
name: Determine changed packages | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }} | |
runs-on: ubuntu-latest | |
outputs: | |
js-packages: ${{ steps.filter-js.outputs.changes }} | |
rs-packages: ${{ steps.filter-rs.outputs.changes }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: dorny/paths-filter@v2 | |
id: filter-js | |
with: | |
filters: .github/package-filters/js-packages.yml | |
- uses: dorny/paths-filter@v2 | |
id: filter-rs | |
with: | |
filters: .github/package-filters/rs-packages.yml | |
build-js: | |
name: Build JS packages | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }} | |
secrets: inherit | |
uses: ./.github/workflows/tests-build-js.yml | |
build-images: | |
name: Build Platform Docker images | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }} | |
secrets: inherit | |
uses: ./.github/workflows/tests-build-images.yml | |
rs-package: | |
name: Rust package | |
needs: | |
- changes | |
secrets: inherit | |
strategy: | |
fail-fast: false | |
matrix: | |
rs-package: ${{ fromJson(needs.changes.outputs.rs-packages) }} | |
uses: ./.github/workflows/tests-rs-package.yml | |
with: | |
package: ${{ matrix.rs-package }} | |
rs-crates-security: | |
name: Rust crates security audit | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Audit crates | |
uses: rustsec/audit-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
js-package: | |
name: JS package | |
needs: | |
- changes | |
- build-js | |
secrets: inherit | |
strategy: | |
fail-fast: false | |
matrix: | |
js-package: ${{ fromJson(needs.changes.outputs.js-packages) }} | |
uses: ./.github/workflows/tests-js-package.yml | |
with: | |
package: ${{ matrix.js-package }} | |
skip-tests: ${{ contains(matrix.js-package, 'platform-test-suite') }} | |
js-deps-versions: | |
name: JS dependency versions check | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Setup Node.JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Enable corepack | |
run: corepack enable | |
- name: Validate workspaces | |
run: yarn constraints | |
js-npm-security: | |
name: JS NPM security audit | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Audit NPM | |
run: yarn npm audit --environment production --all --recursive | |
js-codeql: | |
name: JS code security audit | |
needs: build-js | |
secrets: inherit | |
uses: ./.github/workflows/tests-codeql.yml | |
dashmate-local-network: | |
name: Dashmate local network E2E tests | |
secrets: inherit | |
needs: | |
- changes | |
- build-images | |
uses: ./.github/workflows/tests-dashmate.yml | |
with: | |
test-pattern: test/e2e/localNetwork.spec.js | |
if: contains(needs.changes.outputs.js-packages, 'dashmate') | |
dashmate-fullnode: | |
name: Dashmate full node E2E tests | |
secrets: inherit | |
needs: | |
- changes | |
- build-images | |
uses: ./.github/workflows/tests-dashmate.yml | |
with: | |
test-pattern: test/e2e/testnetHPFullnode.spec.js | |
if: contains(needs.changes.outputs.js-packages, 'dashmate') | |
dashmate-evonode: | |
name: Dashmate Evonode E2E tests | |
secrets: inherit | |
needs: | |
- changes | |
- build-images | |
uses: ./.github/workflows/tests-dashmate.yml | |
with: | |
test-pattern: test/e2e/testnetHPFullnode.spec.js | |
if: contains(needs.changes.outputs.js-packages, 'dashmate') | |
test-suite: | |
name: Test Suite | |
needs: | |
- build-js | |
- build-images | |
secrets: inherit | |
uses: ./.github/workflows/tests-test-suite.yml | |
with: | |
command: test:suite -b | |
test-suite-browser: | |
name: Test Suite in browser | |
needs: | |
- build-js | |
- build-images | |
secrets: inherit | |
uses: ./.github/workflows/tests-test-suite.yml | |
with: | |
command: test:browsers |