Skip to content

Merge branch 'main' into chris/179-multi-dim #1096

Merge branch 'main' into chris/179-multi-dim

Merge branch 'main' into chris/179-multi-dim #1096

Workflow file for this run

#
# Builds and tests the packages. This builds on Linux by default, but
# can be configured to build on Windows and/or macOS by uncommenting
# the matrix config lines below.
#
# This runs after changes are pushed to a feature branch. It does not
# run for pushes to the main branch because that is covered by the
# `release` workflow.
#
name: Build
on:
push:
branches-ignore:
- main
pull_request:
env:
EM_DIR: 'emsdk'
EM_VERSION: 2.0.34
# This is an additional key that can be used to invalidate the emsdk cache when needed
EM_KEY: 'v1'
jobs:
# The `build` job builds and tests all packages in the monorepo
build:
# We want to avoid redundant builds in the more common case where this workflow is running
# on a branch in the main SDEverywhere repository. For that case, we only care about "push"
# events. The "pull_request" events are only useful for contributions from external forks.
# Currently there is no way to detect or filter out forks in the `on: pull_request:` section
# above, so we use the following logic to filter at the job level. Only run the job if:
# - this is a "push" event for a branch in the main repository, OR
# - this is a "pull_request" event for an external fork
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork)
runs-on: ${{ matrix.config.os }}
timeout-minutes: 20
strategy:
matrix:
config:
- { plat: 'linux', os: 'ubuntu-20.04' }
# - { plat: 'mac', os: 'macos-10.15' }
# - { plat: 'win', os: 'windows-2019' }
steps:
# Force Unix-style line endings (otherwise Prettier checks will fail on Windows)
- name: Configure git to use Unix-style line endings
if: matrix.config.plat == 'win'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repo
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
# The pnpm caching strategy in the following steps is based on:
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Configure pnpm
if: matrix.config.plat == 'win'
run: |
# Force pnpm to use bash shell for running scripts on Windows
pnpm config set script-shell bash
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Enable pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Install dependencies
shell: bash
run: |
pnpm install
- name: Build and test
shell: bash
run: |
./scripts/ci-build
# The `test_c` job runs the C-level integration tests. This job runs in parallel with
# the other jobs (which cuts down on overall time to execute the workflow) because it
# only needs to build a subset of the packages in order to run the integration tests.
test_c:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork)
runs-on: ${{ matrix.config.os }}
timeout-minutes: 20
strategy:
matrix:
config:
- { plat: 'linux', os: 'ubuntu-20.04' }
# - { plat: 'mac', os: 'macos-10.15' }
# - { plat: 'win', os: 'windows-2019' }
steps:
# Force Unix-style line endings (otherwise Prettier checks will fail on Windows)
- name: Configure git to use Unix-style line endings
if: matrix.config.plat == 'win'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repo
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
# The pnpm caching strategy in the following steps is based on:
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Configure pnpm
if: matrix.config.plat == 'win'
run: |
# Force pnpm to use bash shell for running scripts on Windows
pnpm config set script-shell bash
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Enable pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Install dependencies
shell: bash
run: |
pnpm install
- name: Run integration tests
shell: bash
run: |
./scripts/ci-run-c-int-tests
# The `test_js` job runs the JS-level integration tests. This job runs in parallel with
# the other jobs (which cuts down on overall time to execute the workflow) because it
# only needs to build a subset of the packages in order to run the integration tests.
test_js:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork)
runs-on: ${{ matrix.config.os }}
timeout-minutes: 20
strategy:
matrix:
config:
- { plat: 'linux', os: 'ubuntu-20.04' }
# - { plat: 'mac', os: 'macos-10.15' }
# - { plat: 'win', os: 'windows-2019' }
steps:
# Force Unix-style line endings (otherwise Prettier checks will fail on Windows)
- name: Configure git to use Unix-style line endings
if: matrix.config.plat == 'win'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repo
uses: actions/checkout@v4
- name: Enable Emscripten cache
uses: actions/cache@v4
with:
path: ${{env.EM_DIR}}
key: emsdk-app-${{env.EM_VERSION}}-${{env.EM_KEY}}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
# The pnpm caching strategy in the following steps is based on:
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Configure pnpm
if: matrix.config.plat == 'win'
run: |
# Force pnpm to use bash shell for running scripts on Windows
pnpm config set script-shell bash
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Enable pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Install dependencies
shell: bash
run: |
pnpm install
- name: Install Emscripten
shell: bash
run: |
./scripts/install-emsdk
- name: Run integration tests
shell: bash
run: |
./scripts/ci-run-js-int-tests