build(root): improve build config #221
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: CI | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
workflow_dispatch: | |
concurrency: | |
group: ci-${{ github.ref_name }} | |
cancel-in-progress: true | |
env: | |
CI: true | |
NODE_VERSION: 20 | |
TURBO_TOKEN: | |
${{ !(github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main') && | |
secrets.TURBO_REMOTE_CACHE_TOKEN || '' }} | |
TURBO_TEAM: | |
${{ !(github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main') && | |
secrets.TURBO_REMOTE_CACHE_TEAM || '' }} | |
TURBO_LOG_ORDER: stream | |
INSTALL_OPTIONS: | |
${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'main' && '"...[HEAD^1]"' || '' }} | |
BUILD_OPTIONS: | |
${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'main' && '"{./apps/*}[HEAD^1]^..." | |
"{./packages/*}[HEAD^1]..."' || './packages/*' }} | |
jobs: | |
ci-general: | |
name: CI General | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Zimic | |
id: zimic-setup | |
uses: ./.github/actions/zimic-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
turbo-token: ${{ env.TURBO_TOKEN }} | |
turbo-team: ${{ env.TURBO_TEAM }} | |
install: ${{ env.INSTALL_OPTIONS }} | |
build: ${{ env.BUILD_OPTIONS }} | |
install-playwright-browsers: true | |
- name: Check formatting style | |
uses: ./.github/actions/zimic-style-check | |
- name: Lint code and check types | |
run: | | |
pnpm turbo \ | |
types:check lint:turbo \ | |
--continue \ | |
--concurrency 100% \ | |
${{ steps.zimic-setup.outputs.install-filters }} | |
ci-node: | |
name: CI Node.js | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- 18 | |
- 20 | |
- 22 | |
env: | |
NODE_VERSION: ${{ matrix.node-version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Zimic | |
id: zimic-setup | |
uses: ./.github/actions/zimic-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
turbo-token: ${{ env.TURBO_TOKEN }} | |
turbo-team: ${{ env.TURBO_TEAM }} | |
install: ${{ env.INSTALL_OPTIONS }} | |
build: ${{ env.BUILD_OPTIONS }} | |
install-playwright-browsers: true | |
- name: Run tests | |
run: | | |
pnpm turbo \ | |
test:turbo \ | |
--continue \ | |
--concurrency 1 \ | |
${{ steps.zimic-setup.outputs.install-filters }} | |
env: | |
PLAYWRIGHT_WORKERS: 100% | |
- name: Upload test reports | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: test-reports | |
path: | | |
./examples/*/tests/reports | |
./examples/*/tests/outputs | |
retention-days: 7 | |
ci-typescript: | |
name: CI TypeScript | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
typescript-version: | |
- '4.7' | |
- '4.8' | |
- '4.9' | |
- '5.0' | |
- '5.1' | |
- '5.2' | |
- '5.3' | |
- '5.4' | |
env: | |
TYPESCRIPT_VERSION: ${{ matrix.typescript-version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Zimic | |
id: zimic-setup | |
uses: ./.github/actions/zimic-setup | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
turbo-token: ${{ env.TURBO_TOKEN }} | |
turbo-team: ${{ env.TURBO_TEAM }} | |
install: ${{ env.INSTALL_OPTIONS }} | |
build: ${{ env.BUILD_OPTIONS }} | |
install-playwright-browsers: false | |
- name: Set TypeScript version | |
run: | | |
pnpm update \ | |
typescript@${{ matrix.typescript-version }} \ | |
--recursive \ | |
${{ steps.zimic-setup.outputs.install-filters }} \ | |
--filter !zimic \ | |
--filter !@zimic/* | |
- name: Check types | |
run: | | |
pnpm turbo \ | |
types:check \ | |
--continue \ | |
--concurrency 100% \ | |
${{ steps.zimic-setup.outputs.install-filters }} \ | |
--filter !zimic \ | |
--filter !@zimic/* \ | |
$([[ '${{ matrix.typescript-version }}' =~ ^4\. ]] && \ | |
echo '--filter !zimic-example-with-jest-node --filter !zimic-example-with-vitest-node') \ | |
$([[ '${{ matrix.typescript-version }}' =~ ^(4\.|5\.0) ]] && \ | |
echo '--filter !zimic-example-with-playwright --filter !zimic-example-with-next-js-app --filter !zimic-example-with-next-js-pages') |