Skip to content

chore(v2): show result of build.api #14013

chore(v2): show result of build.api

chore(v2): show result of build.api #14013

Workflow file for this run

# Build and test everything
#
# First it builds the packages and stores them in artifacts.
# Meanwhile it lints the code.
# Then it runs the unit tests with the artifacts, as well as builds the docs and insights
# Once it all works, it does a release
# TODO cache each package build by source hash, especially rust
# TODO when cache hit on core, don't rebuild docs unless it changed
name: Qwik CI
on:
pull_request:
push:
branches:
- main
- next
- qwik-labs
- vercelserverless
- 'build/**'
workflow_dispatch:
inputs:
disttag:
description: 'Publish "@builder.io/qwik" to NPM using this dist-tag, push the git-tag to the repo and create a GitHub release. The "latest" and "next" dist-tags will use the version number already committed in package.json.'
required: true
type: choice
default: 'dev'
options:
- dev
- next
- latest
env:
# Disable incremental build, speeds up CI
CARGO_INCREMENTAL: 0
jobs:
changes:
name: Setup
runs-on: ubuntu-latest
outputs:
fullbuild: ${{ steps.filter.outputs.fullbuild == 'true' || github.event.inputs.disttag != '' }}
insightsbuild: ${{ steps.filter.outputs.insightsbuild == 'true' || github.event.inputs.disttag != '' }}
# We also build docs when we rebuild core so we have an extra sanity check
docsbuild: ${{ steps.filter.outputs.fullbuild == 'true' || steps.filter.outputs.docsbuild == 'true' || github.event.inputs.disttag != '' }}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
if: github.event_name == 'pull_request'
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Branch
run: echo "${{ github.ref }}"
- name: NPM Dist Tag
run: echo "${{ github.event.inputs.disttag }}"
- uses: actions/[email protected]
- uses: dorny/paths-filter@v3
id: filter
with:
# Any source changes except for md files
# Note the e2e, that can go when we reuse previous builds
# And then we can also reuse Rust builds separately
filters: |
fullbuild:
- 'packages/qwik*/**/*!(.md)'
- 'packages/eslint-plugin-qwik/**/*!(.md)'
- 'starters/apps/**/*!(.md)'
- 'starters/e2e/**/*!(.md)'
- 'tsconfig.json'
- 'pnpm-lock.yaml'
- 'Cargo.yaml'
- '.github/workflows/'
- 'scripts/'
insightsbuild:
- 'packages/insights/'
docsbuild:
- 'packages/docs/'
- name: Print variables output
run: |
echo fullbuild=${{ steps.filter.outputs.fullbuild }}
echo insightsbuild=${{ steps.filter.outputs.insightsbuild }}
echo docsbuild=${{ steps.filter.outputs.docsbuild }}
echo disttag=${{ github.event.inputs.disttag }}
echo event_name=${{ github.event_name }}
############ BUILD PACKAGE ############
build-package:
name: Build Packages + x86 Linux
needs: changes
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Install NPM Dependencies
run: |
# Ensure that the qwik binary gets made
mkdir -p packages/qwik/dist/bindings/
pnpm install --frozen-lockfile
- name: Build Packages
run: pnpm tsm scripts/index.ts --tsc --api --qwik --qwikcity --platform-binding --cli --qwiklabs --qwikreact --eslint --set-dist-tag="${{ github.event.inputs.disttag }}"
- name: Print Qwik Dist Build
run: tree packages/qwik/dist/
- name: Upload Qwik Build Artifacts
uses: actions/[email protected]
with:
name: dist-qwik
path: packages/qwik/dist/
if-no-files-found: error
- name: Print QwikCity Lib Build
run: tree packages/qwik-city/lib/
- name: Upload QwikCity Build Artifacts
uses: actions/[email protected]
with:
name: dist-qwikcity
path: packages/qwik-city/lib/
if-no-files-found: error
- name: Print QwikLabs Lib Build
run: tree packages/qwik-labs/lib/ packages/qwik-labs/vite/
- name: Upload QwikLabs+React Build Artifacts
uses: actions/[email protected]
with:
name: dist-qwiklabs
path: |
packages/qwik-labs/lib/
packages/qwik-labs/vite/
packages/qwik-labs/package.json
if-no-files-found: error
- name: Print qwik-react Lib Build
run: tree packages/qwik-react/lib/ packages/qwik-react/vite/
- name: Upload qwik-react Build Artifacts
uses: actions/[email protected]
with:
name: dist-qwikreact
path: |
packages/qwik-react/lib/
packages/qwik-react/vite/
packages/qwik-react/package.json
if-no-files-found: error
- name: Print Create Qwik CLI Dist Build
run: tree packages/create-qwik/dist/
- name: Upload Create Qwik CLI Build Artifacts
uses: actions/[email protected]
with:
name: dist-create-qwik
path: packages/create-qwik/dist/
if-no-files-found: error
- name: Build Eslint rules
run: pnpm tsm scripts/index.ts --eslint
- name: Print Eslint rules Dist Build
run: tree packages/eslint-plugin-qwik/dist/
- name: Upload Eslint rules Build Artifacts
uses: actions/[email protected]
with:
name: dist-eslint-plugin-qwik
path: packages/eslint-plugin-qwik/dist/
if-no-files-found: error
############ BUILD PACKAGE ############
build-api:
name: Build API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- run: pnpm install --frozen-lockfile
- name: Build API
run: pnpm run api.update
- name: Show Diff
run: git diff --exit-code
############ BUILD WASM ############
build-wasm:
name: Build wasm
needs: changes
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# additionally install wasm32-unknown-unknown target
target: wasm32-unknown-unknown
- uses: jetli/[email protected]
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- run: pnpm install --frozen-lockfile
- name: Build wasm Platform Binding
run: pnpm build --wasm
- name: Print Packages Dist Build
continue-on-error: true
run: ls -lR packages/qwik/dist/bindings/
- name: Upload Platform Binding Artifact
uses: actions/[email protected]
with:
name: dist-bindings-wasm
path: packages/qwik/dist/bindings/*
if-no-files-found: error
############ BUILD PLATFORM BINDINGS ############
build-bindings:
strategy:
matrix:
settings:
# the last x86 macos available as a standard runner
- host: macos-13
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
name: Build ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
needs: changes
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- run: pnpm install --frozen-lockfile
- name: Pull Latest Image
if: ${{ matrix.settings.docker }}
run: ${{ matrix.settings.docker }}
env:
DOCKER_REGISTRY_URL: ghcr.io
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Toolchain
if: ${{ matrix.settings.setup }}
run: ${{ matrix.settings.setup }}
shell: bash
- name: Build Platform Binding
run: pnpm build --platform-binding
- name: Print Packages Dist Build
continue-on-error: true
run: ls -lR packages/qwik/dist/bindings/
- name: Upload Platform Binding Artifact
uses: actions/[email protected]
with:
name: dist-bindings-${{ matrix.settings.target }}
path: packages/qwik/dist/bindings/*.node
if-no-files-found: error
############ BUILD INSIGHTS ############
build-insights:
name: Build Insights
needs:
- changes
- build-package
if: ${{ needs.changes.outputs.insightsbuild == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/[email protected]
- name: Move Distribution Artifacts
run: |
mkdir -p packages/qwik/dist/
mv dist-qwik/* packages/qwik/dist/
mkdir -p packages/qwik-city/lib/
mv dist-qwikcity/* packages/qwik-city/lib/
mkdir -p packages/create-qwik/dist/
mv dist-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv dist-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
mv dist-qwiklabs/lib packages/qwik-labs/lib
mv dist-qwiklabs/vite packages/qwik-labs/vite
- run: pnpm install --frozen-lockfile
- name: Build Qwik Insights
run: pnpm run build.packages.insights
############ BUILD DOCS ############
build-docs:
name: Build Docs
needs:
- changes
- build-package
if: ${{ needs.changes.outputs.docsbuild == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/[email protected]
- name: Move Distribution Artifacts
run: |
mkdir -p packages/qwik/dist/
mv dist-qwik/* packages/qwik/dist/
mkdir -p packages/qwik-city/lib/
mv dist-qwikcity/* packages/qwik-city/lib/
mkdir -p packages/create-qwik/dist/
mv dist-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv dist-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
mv dist-qwiklabs/lib packages/qwik-labs/lib
mv dist-qwiklabs/vite packages/qwik-labs/vite
mv dist-qwikreact/lib packages/qwik-react/lib
mv dist-qwikreact/vite packages/qwik-react/vite
- run: pnpm install --frozen-lockfile
- name: Build Qwik Docs
run: pnpm run build.packages.docs
############ BUILD DISTRIBUTION ############
build-distribution:
name: Build Distribution
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
runs-on: ubuntu-latest
needs:
- build-package
- build-bindings
- build-wasm
- test-unit
- validate-rust
- changes
steps:
- name: Download Build Artifacts
uses: actions/[email protected]
- name: Print Distribution Artifacts
run: tree dist-qwik/
- name: Print Bindings Artifacts
run: tree dist-bindings-*/
- name: Move Artifacts
run: /
mkdir -p packages/qwik/dist/bindings
mv dist-qwik/* dist-bindings-*/* packages/qwik/dist/bindings/
- name: Print Packages Dist Build
run: tree packages/qwik/dist/bindings/
- name: Upload Qwik Distribution Artifact with bindings
uses: actions/[email protected]
with:
name: dist-qwik
path: packages/qwik/dist/bindings/*
if-no-files-found: error
############ RELEASE ############
release:
name: Release
runs-on: ubuntu-latest
needs:
- build-distribution
- test-e2e
- changes
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
steps:
- name: Checkout
uses: actions/[email protected]
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/[email protected]
- name: Print Distribution Artifacts
run: tree dist-qwik/
- name: Print Create Qwik CLI Artifacts
run: tree dist-create-qwik/
- name: Move Distribution Artifacts
run: |
mkdir -p packages/qwik/dist/
mv dist-qwik/* packages/qwik/dist/
mkdir -p packages/qwik-city/lib/
mv dist-qwikcity/* packages/qwik-city/lib/
mkdir -p packages/create-qwik/dist/
mv dist-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv dist-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
mv dist-qwiklabs/lib packages/qwik-labs/lib
mv dist-qwiklabs/vite packages/qwik-labs/vite
- run: pnpm install --frozen-lockfile
- name: Commit Build Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' && github.event_name == 'push' }}
env:
QWIK_API_TOKEN_GITHUB: ${{ secrets.QWIK_API_TOKEN_GITHUB }}
run: pnpm run qwik-save-artifacts
- name: Dry-Run Publish
if: ${{ github.event_name != 'workflow_dispatch' }}
run: pnpm tsm scripts/index.ts --set-dist-tag="${{ github.event.inputs.disttag }}" --validate --release --dry-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
if: ${{ github.event_name == 'workflow_dispatch' }}
run: pnpm tsm scripts/index.ts --set-dist-tag="${{ github.event.inputs.disttag }}" --validate --release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
############ E2E TEST ############
test-e2e:
name: E2E Tests
needs:
- build-distribution
strategy:
matrix:
settings:
- host: ubuntu-latest
browser: chromium
node: 18.x
- host: macos-latest
browser: webkit
node: 18.x
runs-on: ${{ matrix.settings.host }}
steps:
- name: Checkout
uses: actions/[email protected]
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/[email protected]
- name: Move Distribution Artifacts
run: |
mkdir -p packages/qwik/dist/
mv dist-qwik/* packages/qwik/dist/
mkdir -p packages/qwik-city/lib/
mv dist-qwikcity/* packages/qwik-city/lib/
mkdir -p packages/create-qwik/dist/
mv dist-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv dist-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
- run: pnpm install --frozen-lockfile
- name: Install Playwright
run: npx playwright install ${{ matrix.settings.browser }} --with-deps
- name: Playwright E2E Tests
run: pnpm run test.e2e.${{ matrix.settings.browser }} --timeout 60000 --retries 3 --workers 1
- name: Validate Create Qwik Cli
run: pnpm cli.validate
############ UNIT TEST ############
test-unit:
name: Unit Tests
runs-on: ubuntu-latest
needs:
- changes
- build-package
steps:
- name: Checkout
uses: actions/[email protected]
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/[email protected]
- name: Move Distribution Artifacts
run: |
mkdir -p packages/qwik/dist/
mv dist-qwik/* packages/qwik/dist/
mkdir -p packages/qwik-city/lib/
mv dist-qwikcity/* packages/qwik-city/lib/
mkdir -p packages/create-qwik/dist/
mv dist-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv dist-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
- run: pnpm install --frozen-lockfile
- name: Unit Tests
run: pnpm run test.unit
########### VALIDATE RUST ############
validate-rust:
name: Validate Rust
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Format check
run: cargo fmt --check
- name: Build check
run: cargo check --all-features
- name: Clippy check
run: cargo clippy --all-features
- name: Unit tests
run: make test
########### LINT PACKAGE ############
lint-package:
name: Lint Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: pnpm/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- run: pnpm install --frozen-lockfile
- name: Prettier Check
if: ${{ always() }}
run: pnpm run lint.prettier
- name: Build ESLint
if: ${{ always() }}
run: pnpm tsm scripts/index.ts --eslint
- name: ESLint Check
if: ${{ always() }}
run: pnpm run lint.eslint
############ TRIGGER QWIKCITY E2E TEST ############
trigger-qwikcity-e2e:
name: Trigger Qwik City E2E
runs-on: ubuntu-latest
needs:
- changes
- release
if: ${{ needs.changes.outputs.fullbuild == 'true' && github.ref_name == 'main' }}
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.QWIK_API_TOKEN_GITHUB }}
repository: builderIO/qwik-city-e2e
event-type: main-updated