Skip to content

feat(cachecontrol): add second target argument to cacheControl (#5226) #14

feat(cachecontrol): add second target argument to cacheControl (#5226)

feat(cachecontrol): add second target argument to cacheControl (#5226) #14

Workflow file for this run

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 != '' }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
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/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
fullbuild:
- 'packages/qwik/src/**/*.ts'
- 'packages/qwik/src/**/*.tsx'
- 'packages/qwik/src/**/*.rs'
- 'packages/qwik-city/**/*.ts'
- 'packages/qwik-city/**/*.tsx'
- 'packages/qwik-labs/package.json'
- 'packages/qwik-labs/src/**/*.ts'
- 'packages/qwik-labs/src/**/*.tsx'
- 'packages/qwik-labs/src-vite/**/*.ts'
- 'packages/eslint-plugin-qwik/**/*.ts'
- 'starters/apps/**/*.ts'
- 'starters/apps/**/*.tsx'
- 'starters/e2e/**/*.ts'
- 'tsconfig.json'
- 'pnpm-lock.yaml'
- 'Cargo.yaml'
- '.github/workflows/*.yaml'
- 'scripts/*.ts'
- name: Print variables output
run: |
echo fullbuild=${{ steps.filter.outputs.fullbuild }}
echo disttag=${{ github.event.inputs.disttag }}
echo event_name=${{ github.event_name }}
############ BUILD PACKAGE ############
build-package:
name: Build Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Install NPM Dependencies
run: pnpm install --frozen-lockfile
- name: Build Packages
run: pnpm tsm scripts/index.ts --tsc --build --cli --api --set-dist-tag="${{ github.event.inputs.disttag }}"
- name: Print Qwik Dist Build
run: tree packages/qwik/dist/
- name: Upload Qwik Build Artifacts
uses: actions/upload-artifact@master
with:
name: dist-dev-builder-io-qwik
path: packages/qwik/dist/
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/upload-artifact@master
with:
name: dist-dev-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/upload-artifact@master
with:
name: dist-dev-eslint-plugin-qwik
path: packages/eslint-plugin-qwik/dist/
if-no-files-found: error
############ BUILD WASM ############
build-wasm:
name: Build WASM
runs-on: ubuntu-latest
needs: changes
steps:
- name: Print fullbuild output
run: echo ${{ needs.changes.outputs.fullbuild }}
- name: Checkout
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
- name: Setup Node
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: corepack enable
- name: Install Rust toolchain
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
- name: Cache cargo dependencies
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-deps-wasm-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Cache cargo build
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/cache@v3
with:
path: packages/qwik/src/wasm/target
key: cargo-build-wasm-${{ runner.os }}-${{ hashFiles('./packages/qwik/src/wasm/Cargo.lock') }}
- name: Install NPM Dependencies
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm install --frozen-lockfile
- uses: jetli/wasm-pack-action@v0.3.0
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
with:
version: 'v0.10.3'
- name: Build WASM
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm tsm scripts/index.ts --wasm --set-dist-tag="${{ github.event.inputs.disttag }}"
- name: Print WASM Dist Build
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: tree packages/qwik/dist/bindings/
- name: Upload WASM Build Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/upload-artifact@master
with:
name: dist-bindings-wasm
path: packages/qwik/dist/bindings/*
if-no-files-found: error
############ BUILD PLATFORM BINDINGS ############
build-bindings:
strategy:
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: pnpm tsm scripts/index.ts --platform-binding
- host: macos-latest
target: aarch64-apple-darwin
build: |
export SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path)
export MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version)
pnpm tsm scripts/index.ts --platform-binding --platform-target=aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
build: pnpm tsm scripts/index.ts --platform-binding
name: Build ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
needs: changes
steps:
- name: Checkout
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
- name: Setup Node
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: corepack enable
shell: bash
- name: Install Rust toolchain
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.settings.target }}
- name: Pull Latest Image
if: ${{ needs.changes.outputs.fullbuild == 'true' && matrix.settings.docker }}
run: ${{ matrix.settings.docker }}
env:
DOCKER_REGISTRY_URL: ghcr.io
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Cache cargo dependencies
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-deps-${{ matrix.settings.target }}-${{ hashFiles('Cargo.lock') }}
- name: Cache cargo build
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/cache@v3
with:
path: target
key: cargo-build-${{ matrix.settings.target }}-${{ hashFiles('Cargo.lock') }}
- name: Setup Toolchain
if: ${{ needs.changes.outputs.fullbuild == 'true' && matrix.settings.setup }}
run: ${{ matrix.settings.setup }}
shell: bash
- name: Install NPM Dependencies
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm install --frozen-lockfile
- name: Build Platform Binding
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: ${{ matrix.settings.build }}
shell: bash
- name: Upload Platform Binding Artifact
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/upload-artifact@v2
with:
name: dist-bindings-${{ matrix.settings.target }}
path: packages/qwik/dist/bindings/*.node
if-no-files-found: error
############ BUILD DISTRIBUTION ############
build-distribution:
name: Build Distribution
runs-on: ubuntu-latest
needs:
- build-package
- build-wasm
- build-bindings
- test-unit
- validate-rust
- changes
steps:
- name: Checkout
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
- name: Setup Node
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
- name: Install NPM Dependencies
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm install --frozen-lockfile
- name: Create packages/qwik/dist/ directory
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: |
mkdir -p packages/qwik/dist/bindings/
- name: Download Build Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/download-artifact@v2
- name: Print Distribution Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: tree dist-dev-builder-io-qwik/
- name: Move Distribution Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: mv dist-dev-builder-io-qwik/* packages/qwik/dist/
- name: Print Bindings Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: tree dist-bindings-*/
- name: Move Binding Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: mv dist-bindings-*/* packages/qwik/dist/bindings/
- name: Print Packages Dist Build
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: tree packages/qwik/dist/
- name: Upload Qwik Distribution Artifact
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/upload-artifact@master
with:
name: builderio-qwik-distribution
path: packages/qwik/dist/*
if-no-files-found: error
- name: Build QwikCity / QwikLabs
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm tsm scripts/index.ts --tsc --qwikcity --qwiklabs --api
- name: Print QwikCity Lib Build
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: tree packages/qwik-city/lib/
- name: Upload QwikCity Build Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/upload-artifact@master
with:
name: builderio-qwikcity-distribution
path: packages/qwik-city/lib/
if-no-files-found: error
- name: Print QwikLabs Lib Build
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: tree packages/qwik-labs/lib/ packages/qwik-labs/lib-types/ packages/qwik-labs/vite/
- name: Upload QwikLabs Build Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/upload-artifact@master
with:
name: builderio-qwiklabs-distribution
path: |
packages/qwik-labs/lib/
packages/qwik-labs/lib-types/
packages/qwik-labs/vite/
packages/qwik-labs/package.json
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/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/download-artifact@v2
- name: Print Distribution Artifacts
run: tree builderio-qwik-distribution/
- name: Print Create Qwik CLI Artifacts
run: tree dist-dev-create-qwik/
- name: Move Distribution Artifacts
run: |
mkdir -p packages/qwik/dist/
mv builderio-qwik-distribution/* packages/qwik/dist/
mkdir -p packages/qwik-city/lib/
mv builderio-qwikcity-distribution/* packages/qwik-city/lib/
mkdir -p packages/create-qwik/dist/
mv dist-dev-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv dist-dev-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
mv builderio-qwiklabs-distribution/lib packages/qwik-labs/lib
mv builderio-qwiklabs-distribution/lib-types packages/qwik-labs/lib-types
mv builderio-qwiklabs-distribution/vite/* packages/qwik-labs/vite/
- name: Install NPM Dependencies
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
- changes
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
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
- name: Setup Node ${{ matrix.settings.node }}
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.settings.node }}
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: corepack enable
shell: bash
- name: Download Build Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/download-artifact@v2
- name: Move Distribution Artifacts
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: |
mkdir -p packages/qwik/dist/
mv builderio-qwik-distribution/* packages/qwik/dist/
mkdir -p packages/qwik-city/lib/
mv builderio-qwikcity-distribution/* packages/qwik-city/lib/
mkdir -p packages/create-qwik/dist/
mv dist-dev-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv dist-dev-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
- name: Install NPM Dependencies
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm install --frozen-lockfile
- name: Install Playwright
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: npx playwright install ${{ matrix.settings.browser }} --with-deps
- name: Playwright E2E Tests
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm run test.e2e.${{ matrix.settings.browser }}
- name: Validate Create Qwik Cli
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
run: pnpm cli.validate
############ UNIT TEST ############
test-unit:
name: Unit Tests
runs-on: ubuntu-latest
needs:
- changes
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Install NPM Dependencies
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
steps:
- name: Checkout
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/checkout@v3
- name: Install Rust toolchain
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustfmt, clippy
- name: Cache cargo dependencies
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-deps-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Cache cargo build
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions/cache@v3
with:
path: target
key: cargo-build-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Format check
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Build check
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features
- name: Clippy check
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features
- name: Unit tests
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
########### LINT PACKAGE ############
lint-package:
name: Lint Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Install NPM Dependencies
run: pnpm install --frozen-lockfile
- name: Prettier Check
if: ${{ always() }}
run: pnpm run lint.prettier
- 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:
- 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