test: Vendor kcl-samples and add simulation tests for them #10868
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
permissions: read-all | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
name: cargo test of wasm-lib | |
jobs: | |
path-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
only-kcl-samples: ${{ steps.filter.outputs.only-kcl-samples }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: filter | |
name: Check for path changes | |
uses: dorny/paths-filter@v3 | |
with: | |
# Don't combine this with other path checks since this requires | |
# everything to match. | |
predicate-quantifier: every | |
filters: | | |
only-kcl-samples: | |
- 'public/kcl-samples/**' | |
- '!src/wasm-lib/**' | |
- name: Display significant changes | |
run: | | |
echo "Only kcl-samples changes: ${{ steps.filter.outputs.only-kcl-samples }}" | |
cargotest: | |
name: cargo test | |
runs-on: ubuntu-latest-8-cores | |
strategy: | |
matrix: | |
dir: ['src/wasm-lib'] | |
needs: path-changes | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install latest rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install vector | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh | |
chmod +x /tmp/vector.sh | |
/tmp/vector.sh -y -no-modify-path | |
mkdir -p /tmp/vector | |
cp .github/workflows/vector.toml /tmp/vector.toml | |
sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml | |
sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml | |
sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml | |
sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml | |
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml | |
cat /tmp/vector.toml | |
${HOME}/.vector/bin/vector --config /tmp/vector.toml & | |
- uses: taiki-e/install-action@cargo-llvm-cov | |
- uses: taiki-e/install-action@nextest | |
- name: Rust Cache | |
uses: Swatinem/[email protected] | |
- name: cargo test only kcl-samples | |
if: needs.path-changes.outputs.only-kcl-samples == 'true' | |
shell: bash | |
run: |- | |
cd "${{ matrix.dir }}" | |
cargo nextest run --workspace --test-threads=1 --retries=2 --no-fail-fast -P ci 2>&1 simulation_tests::kcl_samples | tee /tmp/github-actions.log | |
env: | |
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | |
RUST_MIN_STACK: 10485760000 | |
- name: cargo test | |
if: needs.path-changes.outputs.only-kcl-samples == 'false' | |
shell: bash | |
run: |- | |
cd "${{ matrix.dir }}" | |
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --test-threads=1 --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log | |
env: | |
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} | |
RUST_MIN_STACK: 10485760000 | |
- name: Upload to codecov.io | |
if: needs.path-changes.outputs.only-kcl-samples == 'false' | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
fail_ci_if_error: true | |
flags: wasm-lib | |
verbose: true | |
files: lcov.info | |