Files
hub-monorepo/.github/workflows/ci.yml
2023-02-11 10:36:41 -08:00

88 lines
2.0 KiB
YAML

name: CI
on:
# CI is run on main because new branches can only access caches from master, not previous branches.
# So building on master allows new PR's to get the cache from before.
push:
branches: [main]
pull_request:
branches: [main]
# prevent multiple simultaneous test runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Docker buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker image
uses: docker/build-push-action@v4
with:
cache-from: type=gha
cache-to: type=gha
analyze:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Restore cached dependencies for Node modules.
id: module-cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}--node--${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
# - name: Run audit
# run: yarn audit
- name: Run linter
run: yarn lint
test:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Restore cached dependencies for Node modules.
id: module-cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}--node--${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Run build
run: yarn build
- name: Run tests
run: yarn test:ci
- name: Upload coverage results
uses: codecov/codecov-action@v3