* 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>
265 lines
9.7 KiB
YAML
265 lines
9.7 KiB
YAML
name: E2E Tests
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
schedule:
|
|
- cron: 0 * * * * # hourly
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
actions: read
|
|
|
|
|
|
jobs:
|
|
|
|
path-changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
significant: ${{ steps.path-changes.outputs.significant }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- 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 "significant=true" >> $GITHUB_OUTPUT
|
|
exit 0
|
|
fi
|
|
|
|
changed_files=$(git diff --name-only origin/${{ github.base_ref }})
|
|
echo "$changed_files"
|
|
if grep -Evq '^README.md|^public/kcl-samples/|^rust/kcl-lib/tests/kcl_samples/' <<< "$changed_files" ; then
|
|
echo "significant=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "significant=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
- name: Display path changes
|
|
run: |
|
|
# For debugging purposes.
|
|
echo "significant: ${{ steps.path-changes.outputs.significant }}"
|
|
|
|
electron:
|
|
timeout-minutes: 60
|
|
name: playwright:electron:${{ matrix.os }} ${{ matrix.shardIndex }} ${{ matrix.shardTotal }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# TODO: enable self-hosted-windows-8-cores once available
|
|
os: [namespace-profile-ubuntu-8-cores, namespace-profile-macos-8-cores, windows-16-cores]
|
|
shardIndex: [1, 2, 3, 4]
|
|
shardTotal: [4]
|
|
# TODO: add ref here for main and latest release tag
|
|
runs-on: ${{ matrix.os }}
|
|
needs: path-changes
|
|
if: ${{ needs.path-changes.outputs.significant == 'true' }}
|
|
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 }}
|
|
- id: filter
|
|
name: Check for Rust changes
|
|
uses: dorny/paths-filter@v3
|
|
with:
|
|
filters: |
|
|
rust:
|
|
- 'rust/**'
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'yarn'
|
|
- name: Install dependencies
|
|
id: deps-install
|
|
shell: bash
|
|
run: yarn
|
|
- name: Cache Playwright Browsers
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cache/ms-playwright/
|
|
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
|
- name: Install Playwright Browsers
|
|
shell: bash
|
|
run: yarn playwright install --with-deps
|
|
- name: Download Wasm Cache
|
|
id: download-wasm
|
|
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
|
|
uses: dawidd6/action-download-artifact@v7
|
|
continue-on-error: true
|
|
with:
|
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
|
name: wasm-bundle
|
|
workflow: build-and-store-wasm.yml
|
|
branch: main
|
|
path: rust/kcl-wasm-lib/pkg
|
|
- name: copy wasm blob
|
|
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
|
|
shell: bash
|
|
run: cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
|
|
continue-on-error: true
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
|
with:
|
|
tool: wasm-pack
|
|
- name: Cache Wasm (because rust diff)
|
|
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: './rust'
|
|
- name: OR Cache Wasm (because wasm cache failed)
|
|
if: steps.download-wasm.outcome == 'failure'
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: './rust'
|
|
- name: install good sed
|
|
if: ${{ startsWith(matrix.os, 'macos') }}
|
|
shell: bash
|
|
run: |
|
|
brew install gnu-sed
|
|
echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
|
|
- name: Install vector
|
|
shell: bash
|
|
# TODO: figure out what to do with this, it's failing
|
|
if: false
|
|
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 &
|
|
- name: Build Wasm (because rust diff)
|
|
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
|
|
shell: bash
|
|
run: yarn build:wasm
|
|
- name: OR Build Wasm (because wasm cache failed)
|
|
if: steps.download-wasm.outcome == 'failure'
|
|
shell: bash
|
|
run: yarn build:wasm
|
|
- name: build web
|
|
shell: bash
|
|
run: yarn tronb:vite:dev
|
|
- name: Run ubuntu/chrome snapshots
|
|
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 }}
|
|
shell: bash
|
|
# TODO: break this in its own job, for now it's not slowing down the overall execution as ubuntu is the quickest,
|
|
# but we could do better. This forces a large 1/1 shard of all 20 snapshot tests that runs in about 3 minutes.
|
|
run: |
|
|
yarn test:snapshots
|
|
env:
|
|
CI: true
|
|
NODE_ENV: development
|
|
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
VITE_KC_SKIP_AUTH: true
|
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
|
- uses: actions/upload-artifact@v4
|
|
if: ${{ !cancelled() && (success() || failure()) }}
|
|
with:
|
|
name: playwright-report-snapshots-${{ matrix.os }}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
|
path: playwright-report/
|
|
include-hidden-files: true
|
|
retention-days: 30
|
|
overwrite: true
|
|
- name: Clean up test-results
|
|
if: ${{ !cancelled() && (success() || failure()) }}
|
|
continue-on-error: true
|
|
run: rm -r test-results
|
|
- name: check for changes
|
|
if: ${{ matrix.os == 'namespace-profile-ubuntu-8-cores' && matrix.shardIndex == 1 && github.ref != 'refs/heads/main' }}
|
|
shell: bash
|
|
id: git-check
|
|
run: |
|
|
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
|
if git status | grep -q "Changes to be committed"
|
|
then echo "modified=true" >> $GITHUB_OUTPUT
|
|
else echo "modified=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
- name: Commit changes, if any
|
|
if: steps.git-check.outputs.modified == 'true'
|
|
shell: bash
|
|
run: |
|
|
git add e2e/playwright/snapshot-tests.spec.ts-snapshots e2e/playwright/snapshots
|
|
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 }}
|
|
git commit -m "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
|
|
git push
|
|
git push origin ${{ github.head_ref }}
|
|
# only upload artifacts if there's actually changes
|
|
- uses: actions/upload-artifact@v4
|
|
if: steps.git-check.outputs.modified == 'true'
|
|
with:
|
|
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
|
path: playwright-report/
|
|
include-hidden-files: true
|
|
retention-days: 30
|
|
- uses: actions/download-artifact@v4
|
|
if: ${{ !cancelled() && (success() || failure()) }}
|
|
continue-on-error: true
|
|
with:
|
|
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
|
path: test-results/
|
|
- name: Run playwright/electron flow (with retries)
|
|
id: retry
|
|
if: ${{ !cancelled() && steps.deps-install.outcome == 'success' }}
|
|
uses: nick-fields/retry@v3.0.2
|
|
with:
|
|
shell: bash
|
|
command: .github/ci-cd-scripts/playwright-electron.sh ${{matrix.shardIndex}} ${{matrix.shardTotal}} ${{matrix.os}}
|
|
timeout_minutes: 30
|
|
max_attempts: 25
|
|
env:
|
|
CI: true
|
|
FAIL_ON_CONSOLE_ERRORS: true
|
|
NODE_ENV: development
|
|
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
VITE_KC_SKIP_AUTH: true
|
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: test-results-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
|
path: test-results/
|
|
include-hidden-files: true
|
|
retention-days: 30
|
|
overwrite: true
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-report-${{ matrix.os }}-${{ matrix.shardIndex }}-${{ github.sha }}
|
|
path: playwright-report/
|
|
include-hidden-files: true
|
|
retention-days: 30
|
|
overwrite: true
|
|
|