Manage Token #1675
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: Build, lint and test | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch and release branches | |
push: | |
branches: [main, release**, feature/**, browser-ui-update] | |
pull_request: | |
branches: [main, release**, feature/**, browser-ui-update] | |
# Allows us to run the workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
dummy: 1 # change to force cache invalidation | |
node_version: 18.14.2 | |
jobs: | |
dependencies: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache dependencies | |
id: fetch-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ env.dummy }}-${{ hashFiles('**/package.json', '**/yarn.lock') }} | |
- uses: actions/setup-node@v2 | |
if: steps.fetch-dependencies.outputs.cache-hit != 'true' | |
with: | |
node-version: '${{ env.node_version }}' | |
- name: Download dependencies | |
if: steps.fetch-dependencies.outputs.cache-hit != 'true' | |
run: YARN_CHECKSUM_BEHAVIOR=ignore yarn | |
build: | |
runs-on: ubuntu-20.04 | |
needs: [dependencies] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ env.node_version }}' | |
- name: Get cached dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ env.dummy }}-${{ hashFiles('**/package.json', '**/yarn.lock') }} | |
- name: Build | |
run: yarn build:all | |
- name: TypeCheck | |
run: yarn type:check | |
build-example-docker: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
image: | |
- { dir: eSealing, dockerfile: Dockerfile } | |
- { dir: voting, dockerfile: Dockerfile } | |
- { dir: wCCD, dockerfile: Dockerfile, extraArguments: '--build-arg NETWORK="mainnet"' } | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build image | |
working-directory: examples/${{ matrix.image.dir }} | |
run: docker build ${{matrix.image.extraArguments}} -f ${{ matrix.image.dockerfile }} . | |
lint: | |
runs-on: ubuntu-20.04 | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ env.node_version }}' | |
- name: Get cached dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ env.dummy }}-${{ hashFiles('**/package.json', '**/yarn.lock') }} | |
- name: Lint | |
run: yarn lint | |
test: | |
runs-on: ubuntu-20.04 | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ env.node_version }}' | |
- name: Get cached dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ env.dummy }}-${{ hashFiles('**/package.json', '**/yarn.lock') }} | |
- name: build api-helpers | |
run: yarn build:api-helpers | |
- name: Test | |
run: yarn test |