* Change to unzip * Download kcl-samples as zip to public dir * Fix fetch:samples, e2e electron still not working * Change error message to be clearer * Refactor so that input and output directories of sim tests can be different * Add kcl samples test implementation * Update output since adding kcl_samples tests * Update kcl-samples branch * Fix git-ignore pattern to only apply to the root * Fix yarn install and yarn fetch:samples to work the first time * Remove unneeded exists check * Change to use kcl-samples in public directory * Add kcl-samples * Update output since updating kcl-samples * Update output files * Change to not fetch samples during yarn install * Update output after merge * Ignore kcl-samples in codespell * WIP: Don't run e2e if only kcl-samples changed * Conditionally run cargo tests * Fix to round floating point values in program memory arrays * Update output since merge and rounding numbers in memory * Fix memory redaction for floating point to find more values * Fix float redaction pattern * Update output since rounding floating point numbers * Add center to floating point pattern * Fix trigger to use picomatch syntax * Update output since rounding center * Remove kcl-samples github workflows * Enable Rust backtrace * Update output after re-running * Update output after changing order of post-extrude commands * Fix to have deterministic order of commands * Update output after reverting ordering changes * Update kcl-samples * Update output after updating samples * Fix error messages to show the names of all samples that failed * Change cargo test command to match current one * Update kcl-samples * Update output since updating kcl-samples * Add generate manifest workflow and yarn script * Fix error check to actually work * Change util function to be what we actually need * Move new files after merge * Fix paths since directory move * Add dependabot updates for kcl-samples * Add GitHub workflow to make PR to kcl-samples repo * Add GitHub workflow to check kcl-samples header comments * Fix worfklow to change to the right directory * Add auto-commit simulation test output changes * Add permissions to workflows * Fix to run git commit step * Install just if needed * Fix directory of justfile * Add installation of cargo-insta * Fix to use underscore * Fix to allow just command failure * Change to always install CLI tools and cache them * Trying to fix overwrite failing * Combine commands * Change reviewer * Change to PR targeting the next branch * Change git commands to not do unnecessary fetch * Comment out trigger for creating a PR * Update kcl-samples from next branch * Update outputs after kcl-samples change * Fix to use bash pipefail * Add rust backtrace * Print full env from sim tests * Change command to use long option name * Fix to use ci profile even when calling through just * Add INSTA_UPDATE=always * Fix git push by using an app token on checkout * Add comments * Fix to use bash options * Change to echo when no changes are found * Fix so that kcl-samples updates don't trigger full run * Fix paths to reflect new crate location * Fix path detection * Fix e2e job to ignore kcl_samples simulation test output * Fix the fetch logic for the KCL samples after vendoring (#5661) Fixes the last 2 E2E tests for #5460. --------- Co-authored-by: Pierre Jacquier <pierre@zoo.dev> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Frank Noirot <frank@zoo.dev>
145 lines
5.5 KiB
YAML
145 lines
5.5 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
pull_request:
|
|
workflow_dispatch:
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
name: cargo test
|
|
jobs:
|
|
cargotest:
|
|
name: cargo test
|
|
runs-on: ubuntu-latest-8-cores
|
|
steps:
|
|
- uses: actions/create-github-app-token@v1
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ secrets.MODELING_APP_GH_APP_ID }}
|
|
private-key: ${{ secrets.MODELING_APP_GH_APP_PRIVATE_KEY }}
|
|
owner: ${{ github.repository_owner }}
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
- name: Use correct Rust toolchain
|
|
shell: bash
|
|
run: |
|
|
cp --update=none rust/rust-toolchain.toml ./ || true
|
|
- name: Install rust
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache: false # Configured below.
|
|
- 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: Install just
|
|
uses: taiki-e/install-action@just
|
|
- name: Install cargo-insta
|
|
shell: bash
|
|
run: |
|
|
cargo install cargo-insta
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: rust
|
|
- name: Fetch the base branch
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
run: git fetch origin ${{ github.base_ref }} --depth=1
|
|
- name: Check for path changes
|
|
id: path-changes
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
# Manual runs or push should run all tests.
|
|
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
|
|
echo "outside-kcl-samples=true" >> $GITHUB_OUTPUT
|
|
exit 0
|
|
fi
|
|
|
|
changed_files=$(git diff --name-only origin/${{ github.base_ref }})
|
|
echo "$changed_files"
|
|
if grep -Evq '^public/kcl-samples/|^rust/kcl-lib/tests/kcl_samples/' <<< "$changed_files" ; then
|
|
echo "outside-kcl-samples=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "outside-kcl-samples=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
- name: cargo test only kcl-samples
|
|
id: cargo-test-kcl-samples
|
|
if: steps.path-changes.outputs.outside-kcl-samples == 'false'
|
|
continue-on-error: true
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
cd rust
|
|
cargo nextest run --workspace --retries=2 --no-fail-fast --profile ci simulation_tests::kcl_samples 2>&1 | tee /tmp/github-actions.log
|
|
env:
|
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
|
RUST_BACKTRACE: full
|
|
RUST_MIN_STACK: 10485760000
|
|
- name: Commit differences
|
|
if: steps.path-changes.outputs.outside-kcl-samples == 'false' && steps.cargo-test-kcl-samples.outcome == 'failure'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
cd rust
|
|
just overwrite-sim-test kcl_samples
|
|
git add kcl-lib/tests
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
|
git fetch origin
|
|
echo ${{ github.head_ref }}
|
|
git checkout ${{ github.head_ref }}
|
|
if ! git commit -m "Update kcl-samples simulation test output" ; then
|
|
echo "No changes to commit"
|
|
# This only runs if tests failed, so we should fail the step.
|
|
exit 1
|
|
fi
|
|
git push origin ${{ github.head_ref }}
|
|
env:
|
|
# The default is auto, and insta behaves differently in CI vs. not.
|
|
INSTA_UPDATE: always
|
|
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
|
# Configure nextest when it's run by insta (via just).
|
|
NEXTEST_PROFILE: ci
|
|
RUST_BACKTRACE: full
|
|
RUST_MIN_STACK: 10485760000
|
|
- name: cargo test
|
|
if: steps.path-changes.outputs.outside-kcl-samples == 'true'
|
|
shell: bash
|
|
run: |-
|
|
cd rust
|
|
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --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: steps.path-changes.outputs.outside-kcl-samples == 'true'
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{secrets.CODECOV_TOKEN}}
|
|
fail_ci_if_error: true
|
|
flags: rust
|
|
verbose: true
|
|
files: lcov.info
|
|
|