Merge master into develop #441
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: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- develop | |
- 'run-ci/**' | |
pull_request: | |
branches: [ master, develop, test-pr ] | |
types: [opened, synchronize, reopened, labeled] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
NODE_ENV: test | |
jobs: | |
file-guard: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
addresses: | |
- 'src/constants/addresses.json' | |
- name: Fail if addresses changed unless PR has 'update address' label | |
if: > | |
( github.event_name == 'pull_request' | |
&& !contains(github.event.pull_request.labels.*.name,'update address') | |
&& steps.changes.outputs.addresses == 'true') | |
uses: actions/github-script@v6 | |
with: | |
script: core.setFailed('You have changed an address in mangrove.js (addresses.json). PR must be marked \'update address\' for CI to run') | |
mangrove-js: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Yarn setup (caching yarn dependencies) | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: 'yarn' | |
- run: yarn install --immutable | |
- name: Foundry Setup | |
uses: ./.github/actions/foundry-setup | |
- name: Build | |
id: build | |
run: yarn run build | |
env: | |
NODE_OPTIONS: "--max_old_space_size=8192" | |
# == run and upload test result (reporter run in separate workflow) == | |
- name: Test | |
env: | |
FOUNDRY_CACHE_PATH: "~/.foundry/build-cache" | |
FOUNDRY_OUT: "~/.foundry/build-out" | |
run: yarn run test:coverage | |
- uses: actions/upload-artifact@v2 | |
if: ${{ steps.build.conclusion == 'success' && (success() || failure())}} | |
with: | |
name: test-results | |
path: ./coverage-tests-report.json | |
# == verify cli can start == | |
- name: Mgv cli Tests | |
run: yarn mgv help | |
# == Send coverage report to Coveralls == | |
# Coverallsapp by default uses GITHUB_SHA but that does not necessarily correspond | |
# to HEAD because a branch is checked out. We here find the actual SHA for HEAD. | |
- name: Set Coveralls vars | |
id: coveralls_vars | |
if: github.event_name != 'pull_request' | |
run: echo "::set-output name=sha_for_head::$(git rev-parse HEAD)" | |
- name: Upload to Coveralls for mangrove.js | |
uses: coverallsapp/github-action@master | |
if: github.event_name != 'pull_request' | |
with: | |
git-commit: ${{ steps.coveralls_vars.outputs.sha_for_head }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: ./coverage/lcov.info | |
base-path : . | |
flag-name: js | |
# ==== final "check" job, using alls-green to have one single job to check for green workflow ==== | |
# see https://github.com/re-actors/alls-green | |
check: | |
if: always() | |
needs: | |
- file-guard | |
- mangrove-js | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |