Skip to content

ODK Web Forms CI

ODK Web Forms CI #403

Workflow file for this run

name: 'ci'
run-name: 'ODK Web Forms CI'
on:
workflow_dispatch:
push:
merge_group:
pull_request:
paths-ignore:
- ".vscode/**"
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"
# Automatically cancel older in-progress jobs on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
TZ: 'America/Phoenix'
jobs:
changes:
name: 'Determine package changes'
runs-on: 'ubuntu-latest'
outputs:
root: ${{ steps.changes.outputs.root }}
odk-common: ${{ steps.changes.outputs.odk-common }}
tree-sitter-xpath: ${{ steps.changes.outputs.tree-sitter-xpath }}
xforms-engine: ${{ steps.changes.outputs.xforms-engine }}
xpath: ${{ steps.changes.outputs.xpath }}
scenario: ${{ steps.changes.outputs.scenario }}
ui-solid: ${{ steps.changes.outputs.ui-solid }}
ui-vue: ${{ steps.changes.outputs.ui-vue }}
steps:
- uses: 'actions/checkout@v3'
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
root:
- '*'
- '.github/workflows/*'
odk-common:
- 'packages/common/**'
tree-sitter-xpath:
- 'packages/tree-sitter-xpath/grammar.ts'
- 'packages/tree-sitter-xpath/scripts/**'
- 'packages/tree-sitter-xpath/test/**'
xforms-engine:
- 'packages/xforms-engine/**'
scenario:
- 'packages/scenario/**'
xpath:
- 'packages/xpath/**'
ui-solid:
- 'packages/ui-solid/**'
ui-vue:
- 'packages/ui-vue/**'
# So the `paths-filter` action doesn't attempt to use the GitHub API
# when run on pull requests
token: ''
install-and-build:
name: 'Install dependencies and build packages'
runs-on: 'ubuntu-latest'
strategy:
matrix:
node-version: ['18.19.1', '20.11.1']
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
- uses: 'actions/cache@v3'
id: cache-build
with:
# Note: the tree-sitter-xpath .js and .wasm paths are standard for
# tree-sitter's build output. They also litter a bunch of other files
# in various build phases, several under `src` (which is why the
# grammar's TypeScript source is not there).
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
# `@odk-web-forms/xpath` tests (currently) expect this time zone
- uses: szenius/[email protected]
with:
timezoneLinux: ${{ env.TZ }}
timezoneMacos: ${{ env.TZ }}
timezoneWindows: ${{ env.TZ }}
- run: 'yarn install --frozen-lockfile'
- run: 'yarn build --force'
lint:
name: 'Lint (global)'
needs: ['install-and-build', 'changes']
runs-on: 'ubuntu-latest'
strategy:
matrix:
node-version: ['20.11.1']
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
fail-on-cache-miss: true
- uses: 'actions/cache@v3'
id: cache-build
with:
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
fail-on-cache-miss: true
- run: 'yarn lint'
odk-common:
name: '@odk-web-forms/common'
needs: ['install-and-build', 'changes']
if: needs.changes.outputs.root == 'true' || needs.changes.outputs.odk-common == 'true'
runs-on: 'ubuntu-latest'
strategy:
matrix:
target: ['Node']
node-version: ['18.19.1', '20.11.1']
include:
- target: 'Web'
node-version: '20.11.1'
browser: chromium
- target: 'Web'
node-version: '20.11.1'
browser: firefox
- target: 'Web'
node-version: '20.11.1'
browser: webkit
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
fail-on-cache-miss: true
- uses: 'actions/cache@v3'
id: cache-build
with:
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
fail-on-cache-miss: true
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/common test:types'
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/common test-node:jsdom'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn playwright install ${{ matrix.browser }} --with-deps'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn workspace @odk-web-forms/common test-browser:${{ matrix.browser }}'
xforms-engine:
name: '@odk-web-forms/xforms-engine'
needs: ['install-and-build', 'changes']
if: needs.changes.outputs.root == 'true' || needs.changes.outputs.xforms-engine == 'true'
runs-on: 'ubuntu-latest'
strategy:
matrix:
target: ['Node']
node-version: ['18.19.1', '20.11.1']
include:
- target: 'Web'
node-version: '20.11.1'
browser: chromium
- target: 'Web'
node-version: '20.11.1'
browser: firefox
- target: 'Web'
node-version: '20.11.1'
browser: webkit
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
fail-on-cache-miss: true
- uses: 'actions/cache@v3'
id: cache-build
with:
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
fail-on-cache-miss: true
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/xforms-engine test:types'
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/xforms-engine test-node:jsdom'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn playwright install ${{ matrix.browser }} --with-deps'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn workspace @odk-web-forms/xforms-engine test-browser:${{ matrix.browser }}'
scenario:
name: 'scenario'
needs: ['install-and-build', 'changes']
if: needs.changes.outputs.root == 'true' || needs.changes.outputs.scenario == 'true'
runs-on: 'ubuntu-latest'
strategy:
matrix:
target: ['Node']
node-version: ['18.19.1', '20.11.1']
include:
- target: 'Web'
node-version: '20.11.1'
browser: chromium
- target: 'Web'
node-version: '20.11.1'
browser: firefox
- target: 'Web'
node-version: '20.11.1'
browser: webkit
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
fail-on-cache-miss: true
- uses: 'actions/cache@v3'
id: cache-build
with:
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
fail-on-cache-miss: true
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/scenario test:types'
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/scenario test-node:jsdom'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn playwright install ${{ matrix.browser }} --with-deps'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn workspace @odk-web-forms/scenario test-browser:${{ matrix.browser }}'
xpath:
name: '@odk-web-forms/xpath'
needs: ['install-and-build', 'changes']
if: needs.changes.outputs.root == 'true' || needs.changes.outputs.tree-sitter-xpath == 'true' || needs.changes.outputs.xpath == 'true'
runs-on: 'ubuntu-latest'
strategy:
matrix:
target: ['Node']
node-version: ['18.19.1', '20.11.1']
include:
- target: 'Web'
node-version: '20.11.1'
browser: chromium
- target: 'Web'
node-version: '20.11.1'
browser: firefox
- target: 'Web'
node-version: '20.11.1'
browser: webkit
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
fail-on-cache-miss: true
- uses: 'actions/cache@v3'
id: cache-build
with:
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
fail-on-cache-miss: true
- uses: szenius/[email protected]
with:
timezoneLinux: ${{ env.TZ }}
timezoneMacos: ${{ env.TZ }}
timezoneWindows: ${{ env.TZ }}
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/xpath test:types'
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/xpath test-node:jsdom'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn playwright install ${{ matrix.browser }} --with-deps'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn workspace @odk-web-forms/xpath test-browser:${{ matrix.browser }}'
tree-sitter-xpath:
name: '@odk-web-forms/tree-sitter-xpath'
needs: ['install-and-build', 'changes']
if: needs.changes.outputs.root == 'true' || needs.changes.outputs.tree-sitter-xpath == 'true'
runs-on: 'ubuntu-latest'
strategy:
matrix:
node-version: ['18.19.1', '20.11.1']
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
fail-on-cache-miss: true
- uses: 'actions/cache@v3'
id: cache-build
with:
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
fail-on-cache-miss: true
- run: 'yarn workspace @odk-web-forms/tree-sitter-xpath test'
ui-solid:
name: 'ui-solid'
needs: ['install-and-build', 'changes']
if: needs.changes.outputs.root == 'true' || needs.changes.outputs.ui-solid == 'true'
runs-on: 'ubuntu-latest'
strategy:
matrix:
target: ['Node']
node-version: ['18.19.1', '20.11.1']
include:
- target: 'Web'
node-version: '20.11.1'
browser: chromium
- target: 'Web'
node-version: '20.11.1'
browser: firefox
- target: 'Web'
node-version: '20.11.1'
browser: webkit
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
fail-on-cache-miss: true
- uses: 'actions/cache@v3'
id: cache-build
with:
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
fail-on-cache-miss: true
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/ui-solid test:types'
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/ui-solid test-node:jsdom'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn playwright install ${{ matrix.browser }} --with-deps'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn workspace @odk-web-forms/ui-solid test-browser:${{ matrix.browser }}'
ui-vue:
name: 'ui-vue'
needs: ['install-and-build', 'changes']
if: needs.changes.outputs.root == 'true' || needs.changes.outputs.ui-vue == 'true'
runs-on: 'ubuntu-latest'
strategy:
matrix:
target: ['Node']
node-version: ['18.19.1', '20.11.1']
include:
- target: 'Web'
node-version: '20.11.1'
browser: chromium
- target: 'Web'
node-version: '20.11.1'
browser: firefox
- target: 'Web'
node-version: '20.11.1'
browser: webkit
steps:
- uses: 'actions/checkout@v3'
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
- uses: 'actions/cache@v3'
id: cache-install
with:
path: |
node_modules
**/node_modules
key: install-${{ matrix.node-version }}-${{ hashFiles('yarn.lock', 'examples/*/yarn.lock', 'packages/*/yarn.lock') }}
fail-on-cache-miss: true
- uses: 'actions/cache@v3'
id: cache-build
with:
path: |
examples/*/dist
packages/*/dist
packages/tree-sitter-xpath/grammar.js
packages/tree-sitter-xpath/src/grammar.json
packages/tree-sitter-xpath/src/parser.c
packages/tree-sitter-xpath/src/tree_sitter/parser.h
packages/tree-sitter-xpath/tree-sitter-xpath.wasm
packages/tree-sitter-xpath/types
key: build-${{ matrix.node-version }}-${{ github.sha }}
fail-on-cache-miss: true
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/ui-vue test:types'
- if: ${{ matrix.target == 'Node' }}
run: 'yarn workspace @odk-web-forms/ui-vue test-node:jsdom'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn playwright install ${{ matrix.browser }} --with-deps'
- if: ${{ matrix.target == 'Web' }}
run: 'yarn workspace @odk-web-forms/ui-vue test-browser:${{ matrix.browser }}'