Skip to content

Include cache headers in 304 responses #1498

Include cache headers in 304 responses

Include cache headers in 304 responses #1498

Workflow file for this run

name: TS tests
on:
push:
branches: ["main"]
paths-ignore:
- "website/**"
- "**/README.md"
pull_request:
paths-ignore:
- "website/**"
- "**/README.md"
permissions:
contents: read
jobs:
list_ts_packages:
name: List packages
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.list_ts_packages.outputs.directories }}
steps:
- uses: actions/checkout@v4
- run: echo "directories=`find packages/ -mindepth 1 -maxdepth 1 -type d -exec test -e '{}'/tsconfig.json \; -print | jq -R -s -c 'split("\n")[:-1]'`" >> $GITHUB_OUTPUT
id: list_ts_packages
list_examples:
name: List examples
runs-on: ubuntu-latest
outputs:
example_names: ${{ steps.list_examples.outputs.example_names }}
steps:
- uses: actions/checkout@v4
- run: echo "example_names=$(find examples/ -mindepth 1 -maxdepth 2 -type f -name package.json | xargs dirname | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
id: list_examples
check_packages:
name: Check ${{ matrix.package_dir }}
needs: [list_ts_packages]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package_dir: ${{ fromJson(needs.list_ts_packages.outputs.directories) }}
defaults:
run:
working-directory: ${{ matrix.package_dir }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: pnpm -r --filter "$(jq '.name' -r package.json)^..." build
- run: pnpm run stylecheck
- run: pnpm run typecheck
build_and_test_packages:
name: Build and test
needs: [list_ts_packages]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package_dir: ${{ fromJson(needs.list_ts_packages.outputs.directories) }}
defaults:
run:
working-directory: ${{ matrix.package_dir }}
env:
ELECTRIC_DATABASE_ID: ci_test_tenant
MIX_ENV: dev
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
version-type: strict
version-file: ".tool-versions"
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Cache dependencies
uses: actions/cache@v4
with:
path: packages/sync-service/deps
key: "${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}"
restore-keys: |
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-deps-
- name: Cache compiled code
uses: actions/cache@v4
with:
path: |
packages/sync-service/_build/*/lib
!packages/sync-service/_build/*/lib/electric
key: "${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-${{ github.sha }}"
restore-keys: |
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-${{ github.sha }}
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-build-
- name: Install dependencies
run: mix deps.get && mix deps.compile
working-directory: packages/sync-service
- name: Compile sync-service
run: mix compile
working-directory: packages/sync-service
- uses: JarvusInnovations/background-action@v1
name: Bootstrap System Under Test (SUT)
with:
run: |
mix start_dev
mix run --no-halt &
wait-on: |
http-get://localhost:3000/v1/health?database_id=${{ env.ELECTRIC_DATABASE_ID }}
tail: true
log-output-resume: stderr
wait-for: 1m
log-output: true
log-output-if: failure
working-directory: packages/sync-service
- name: build dependencies, if any
run: pnpm -r --filter "$(jq '.name' -r package.json)^..." build
- run: pnpm test
check_and_build_examples:
name: Check and build ${{ matrix.example_folder }}
needs: [list_examples, build_and_test_packages]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example_folder: ${{ fromJson(needs.list_examples.outputs.example_names) }}
defaults:
run:
working-directory: ${{ matrix.example_folder }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm -r --filter "$(jq '.name' -r package.json)^..." build
- run: pnpm --if-present run typecheck
- run: pnpm --if-present run build
- run: pnpm --if-present run test
- run: pnpm --if-present run stylecheck