Compare commits
161 Commits
jtran/disa
...
kurt-text-
Author | SHA1 | Date | |
---|---|---|---|
1d1e4e43ed | |||
16a82ec13e | |||
862ce1d955 | |||
0e2737c6d9 | |||
2e24137863 | |||
5e694961e8 | |||
a1ef4ff86f | |||
ccd31b7d6d | |||
b5ddbb7fa7 | |||
4613a7c92e | |||
a89d8bb8e8 | |||
1822021bb3 | |||
9d71900caf | |||
0c15299b0e | |||
4def38a698 | |||
9e4671c6d7 | |||
b2707ecc41 | |||
53e0277acc | |||
e8d90f171b | |||
a6c5493a7f | |||
2a10688b39 | |||
8400e06dd6 | |||
d916c79874 | |||
4fd5e26abe | |||
8f9bef922f | |||
545e610bbc | |||
55a3e2a4ed | |||
591f17b182 | |||
a7a88bd762 | |||
0916f990cb | |||
75ae4b4a4a | |||
4a490d5900 | |||
4d9cdc6b40 | |||
0d3880233c | |||
8a029605bd | |||
f26adee360 | |||
0f2a01b6c8 | |||
e099c95c5f | |||
f23bc673aa | |||
b60c1e874d | |||
5857684ebc | |||
e8fc6bc037 | |||
5bdd090119 | |||
669cab8737 | |||
f1ea60d6ab | |||
3faec650b1 | |||
b2b62ec163 | |||
5b798c2aa3 | |||
a23bd1f034 | |||
4d00dddfd8 | |||
f055acb6a6 | |||
bf9d88e9a5 | |||
712a3790e8 | |||
f1ab8602a2 | |||
a1f72b1d5a | |||
f9048b8882 | |||
4b0f83d3ac | |||
62c27e0809 | |||
6a09bbc0ef | |||
997f60e1e5 | |||
6f1d7138c0 | |||
3dabab2c74 | |||
13986fcfd7 | |||
d1e21d673e | |||
ca3a88b4df | |||
fb57df2cad | |||
57a91cdb26 | |||
33079b4151 | |||
a75157573b | |||
e29345fbf6 | |||
35c7183809 | |||
b9fe3ed9e0 | |||
5a25b60485 | |||
4b9f71c994 | |||
e86a5622c8 | |||
a503d1ce50 | |||
11a94cc99e | |||
e295f82495 | |||
0b9cf2dc21 | |||
eb58507e93 | |||
ca28a5f549 | |||
6f4bbdb79e | |||
6773dbe7ff | |||
acfc2b47fa | |||
9dc7ff9797 | |||
308a0fb06e | |||
214ae6f512 | |||
8d54fec589 | |||
4bfbecd3e7 | |||
dff3848a00 | |||
f875efab1b | |||
3f082c8222 | |||
e1c45bdb33 | |||
5cb5dbd689 | |||
0a8881bc69 | |||
be9438160e | |||
77b565f781 | |||
c843dfad95 | |||
a3ff0a45eb | |||
4617ad0fed | |||
5fa51a2f92 | |||
4218777afb | |||
8b1b462e29 | |||
2bc99ba39b | |||
ffe0da6dcd | |||
d27afb8c74 | |||
1c778bf373 | |||
5df8a943a9 | |||
ab729dbcdb | |||
84865eaed0 | |||
543e809739 | |||
61b669cf4e | |||
75f1aaa824 | |||
f4848d7dea | |||
a0167f6ba6 | |||
e5a26c42e6 | |||
9c87b124d9 | |||
21389c089d | |||
29f57be8c1 | |||
cd55f07619 | |||
baf7d3dd9d | |||
54a9a50969 | |||
2830c750fa | |||
d3160cd85a | |||
fd1b4c3a32 | |||
b0a41c31ac | |||
5825ba575c | |||
e5bec2140e | |||
7bf6bc3048 | |||
22f9df73ed | |||
834472e0a6 | |||
bcdf6e314f | |||
55e9845ade | |||
d61cf882c1 | |||
874d19cbfd | |||
9dcc955760 | |||
9b594efe53 | |||
7b9f40c4cb | |||
81b79da90f | |||
2ad5a880fa | |||
b57a9ba54c | |||
b32f5c1d4e | |||
b6d4cc7a4e | |||
43a34b191e | |||
19a93e8deb | |||
b8c623e1ec | |||
4006c28479 | |||
8c932fdb8d | |||
a74c715c01 | |||
1ac39d95f2 | |||
41b1ec94fa | |||
525c803888 | |||
2ee1c78aad | |||
dc21034b86 | |||
1684786659 | |||
12505b4398 | |||
115f2fdea2 | |||
0df28abc4b | |||
1e07ea4986 | |||
f34c23d203 | |||
5295f0ae7d |
@ -1,3 +1,3 @@
|
|||||||
[codespell]
|
[codespell]
|
||||||
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,absolutey,atleast,ue
|
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,absolutey,atleast,ue,afterall
|
||||||
skip: **/target,node_modules,build,**/Cargo.lock,./docs/kcl/*.md,./src-tauri/gen/schemas
|
skip: **/target,node_modules,build,**/Cargo.lock,./docs/kcl/*.md,./src-tauri/gen/schemas,.yarn.lock,**/yarn.lock
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
NODE_ENV=development
|
||||||
|
DEV=true
|
||||||
VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
|
VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
|
||||||
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
|
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
|
||||||
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
|
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
|
||||||
|
7
.github/dependabot.yml
vendored
7
.github/dependabot.yml
vendored
@ -26,10 +26,3 @@ updates:
|
|||||||
reviewers:
|
reviewers:
|
||||||
- adamchalmers
|
- adamchalmers
|
||||||
- jessfraz
|
- jessfraz
|
||||||
- package-ecosystem: 'cargo' # See documentation for possible values
|
|
||||||
directory: '/src-tauri/' # Location of package manifests
|
|
||||||
schedule:
|
|
||||||
interval: 'daily'
|
|
||||||
reviewers:
|
|
||||||
- adamchalmers
|
|
||||||
- jessfraz
|
|
||||||
|
406
.github/workflows/build-test-publish-apps.yml
vendored
Normal file
406
.github/workflows/build-test-publish-apps.yml
vendored
Normal file
@ -0,0 +1,406 @@
|
|||||||
|
name: build-test-publish-apps
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
schedule:
|
||||||
|
- cron: '0 4 * * *'
|
||||||
|
# Daily at 04:00 AM UTC
|
||||||
|
# Will checkout the last commit from the default branch (main as of 2023-10-04)
|
||||||
|
|
||||||
|
env:
|
||||||
|
CUT_RELEASE_PR: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }}
|
||||||
|
BUILD_RELEASE: ${{ github.event_name == 'release' || github.event_name == 'schedule' || github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }}
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare-json-files:
|
||||||
|
runs-on: ubuntu-22.04 # seperate job on Ubuntu for easy string manipulations (compared to Windows)
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.export_version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
|
||||||
|
- name: Set nightly version
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
run: |
|
||||||
|
VERSION=$(date +'%-y.%-m.%-d') yarn bump-jsons
|
||||||
|
|
||||||
|
# TODO: see if we need to inject updater nightly URL here https://dl.zoo.dev/releases/modeling-app/nightly/last_update.json
|
||||||
|
# TODO: see if we ned to add updater test URL here https://dl.zoo.dev/releases/modeling-app/updater-test/last_update.json
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
if: ${{ github.event_name == 'schedule' || env.CUT_RELEASE_PR == 'true' }}
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
package.json
|
||||||
|
|
||||||
|
- id: export_version
|
||||||
|
run: echo "version=`cat package.json | jq -r '.version'`" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
|
||||||
|
build-test-app-macos:
|
||||||
|
needs: [prepare-json-files]
|
||||||
|
runs-on: macos-14
|
||||||
|
env:
|
||||||
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
|
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||||
|
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||||
|
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
|
||||||
|
- name: Copy updated .json files
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
run: |
|
||||||
|
ls -l artifact
|
||||||
|
cp artifact/package.json package.json
|
||||||
|
|
||||||
|
- name: Sync node version and setup cache
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
||||||
|
|
||||||
|
- run: yarn install
|
||||||
|
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: './src/wasm-lib'
|
||||||
|
|
||||||
|
- name: Run build:wasm
|
||||||
|
run: "yarn build:wasm${{ env.BUILD_RELEASE == 'true' && '-dev' || ''}}"
|
||||||
|
|
||||||
|
# TODO: sign the app (and updater bundle potentially)
|
||||||
|
- name: Add signing certificate
|
||||||
|
if: ${{ env.BUILD_RELEASE == 'true' }}
|
||||||
|
run: chmod +x add-osx-cert.sh && ./add-osx-cert.sh
|
||||||
|
|
||||||
|
- name: Build the app for arm64
|
||||||
|
run: "yarn electron-forge make"
|
||||||
|
|
||||||
|
- name: Build the app for x64
|
||||||
|
run: "yarn electron-forge make --arch x64"
|
||||||
|
|
||||||
|
- name: List artifacts
|
||||||
|
run: "ls -R out/make"
|
||||||
|
|
||||||
|
# TODO: add the 'Build for Mac TestFlight (nightly)' stage back
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: "out/make/*/*/*/*"
|
||||||
|
|
||||||
|
|
||||||
|
build-test-app-windows:
|
||||||
|
needs: [prepare-json-files]
|
||||||
|
runs-on: windows-2022
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- name: Copy updated .json files
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
run: |
|
||||||
|
ls -l artifact
|
||||||
|
cp artifact/package.json package.json
|
||||||
|
|
||||||
|
- name: Sync node version and setup cache
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
||||||
|
|
||||||
|
- run: yarn install
|
||||||
|
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: './src/wasm-lib'
|
||||||
|
|
||||||
|
- name: Run build:wasm manually
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
MODE: ${{ env.BUILD_RELEASE == 'true' && '--release' || '--debug' }}
|
||||||
|
run: |
|
||||||
|
mkdir src/wasm-lib/pkg; cd src/wasm-lib
|
||||||
|
echo "building with ${{ env.MODE }}"
|
||||||
|
npx wasm-pack build --target web --out-dir pkg ${{ env.MODE }}
|
||||||
|
cd ../../
|
||||||
|
cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
||||||
|
|
||||||
|
- name: Prepare certificate and variables (Windows only)
|
||||||
|
if: ${{ env.BUILD_RELEASE == 'true' }}
|
||||||
|
run: |
|
||||||
|
echo "${{secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
|
||||||
|
cat /d/Certificate_pkcs12.p12
|
||||||
|
echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
|
||||||
|
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
|
||||||
|
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
|
||||||
|
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
|
||||||
|
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
|
||||||
|
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
|
||||||
|
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
|
||||||
|
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Setup certicate with SSM KSP (Windows only)
|
||||||
|
if: ${{ env.BUILD_RELEASE == 'true' }}
|
||||||
|
run: |
|
||||||
|
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi
|
||||||
|
msiexec /i smtools-windows-x64.msi /quiet /qn
|
||||||
|
smksp_registrar.exe list
|
||||||
|
smctl.exe keypair ls
|
||||||
|
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
|
||||||
|
smksp_cert_sync.exe
|
||||||
|
shell: cmd
|
||||||
|
|
||||||
|
- name: Build the app for x64
|
||||||
|
run: "yarn electron-forge make --arch x64"
|
||||||
|
|
||||||
|
- name: Build the app for arm64
|
||||||
|
run: "yarn electron-forge make --arch arm64"
|
||||||
|
|
||||||
|
- name: List artifacts
|
||||||
|
run: "ls -R out/make"
|
||||||
|
|
||||||
|
- name: Sign using Signtool
|
||||||
|
if: ${{ env.BUILD_RELEASE == 'true' }}
|
||||||
|
env:
|
||||||
|
THUMBPRINT: "F4C9A52FF7BC26EE5E054946F6B11DEEA94C748D"
|
||||||
|
X64_FILE: "D:\\a\\modeling-app\\modeling-app\\out\\make\\squirrel.windows\\x64\\Zoo Modeling App-*Setup.exe"
|
||||||
|
ARM64_FILE: "D:\\a\\modeling-app\\modeling-app\\out\\make\\squirrel.windows\\arm64\\Zoo Modeling App-*Setup.exe"
|
||||||
|
run: |
|
||||||
|
signtool.exe sign /sha1 ${{ env.THUMBPRINT }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 "${{ env.X64_FILE }}"
|
||||||
|
signtool.exe verify /v /pa "${{ env.X64_FILE }}"
|
||||||
|
signtool.exe sign /sha1 ${{ env.THUMBPRINT }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 "${{ env.ARM64_FILE }}"
|
||||||
|
signtool.exe verify /v /pa "${{ env.ARM64_FILE }}"
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: "out/make/*/*/*"
|
||||||
|
|
||||||
|
# TODO: Run e2e tests
|
||||||
|
|
||||||
|
|
||||||
|
build-test-app-ubuntu:
|
||||||
|
needs: [prepare-json-files]
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
|
||||||
|
- name: Copy updated .json files
|
||||||
|
if: github.event_name == 'schedule'
|
||||||
|
run: |
|
||||||
|
ls -l artifact
|
||||||
|
cp artifact/package.json package.json
|
||||||
|
|
||||||
|
- name: Sync node version and setup cache
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
||||||
|
|
||||||
|
- run: yarn install
|
||||||
|
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: './src/wasm-lib'
|
||||||
|
|
||||||
|
- name: Run build:wasm
|
||||||
|
run: "yarn build:wasm${{ env.BUILD_RELEASE == 'true' && '-dev' || ''}}"
|
||||||
|
|
||||||
|
- name: Build the app for arm64
|
||||||
|
run: "yarn electron-forge make --arch arm64"
|
||||||
|
|
||||||
|
- name: Build the app for x64
|
||||||
|
run: "yarn electron-forge make --arch x64"
|
||||||
|
|
||||||
|
- name: List artifacts
|
||||||
|
run: "ls -R out/make"
|
||||||
|
|
||||||
|
# TODO: add the 'Build for Mac TestFlight (nightly)' stage back
|
||||||
|
|
||||||
|
# TODO: sign the app (and updater bundle potentially)
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: "out/make/*/*/*"
|
||||||
|
|
||||||
|
|
||||||
|
publish-apps-release:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
|
||||||
|
needs: [prepare-json-files, build-test-app-macos, build-test-app-windows, build-test-app-ubuntu]
|
||||||
|
env:
|
||||||
|
VERSION_NO_V: ${{ needs.prepare-json-files.outputs.version }}
|
||||||
|
VERSION: ${{ github.event_name == 'release' && format('v{0}', needs.prepare-json-files.outputs.version) || needs.prepare-json-files.outputs.version }}
|
||||||
|
PUB_DATE: ${{ github.event_name == 'release' && github.event.release.created_at || github.event.repository.updated_at }}
|
||||||
|
NOTES: ${{ github.event_name == 'release' && github.event.release.body || format('Nightly build, commit {0}', github.sha) }}
|
||||||
|
BUCKET_DIR: ${{ github.event_name == 'release' && 'dl.kittycad.io/releases/modeling-app' || 'dl.kittycad.io/releases/modeling-app/nightly' }}
|
||||||
|
WEBSITE_DIR: ${{ github.event_name == 'release' && 'dl.zoo.dev/releases/modeling-app' || 'dl.zoo.dev/releases/modeling-app/nightly' }}
|
||||||
|
URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- name: Generate the update static endpoint
|
||||||
|
run: |
|
||||||
|
ls -l artifact/*/*oo*
|
||||||
|
DARWIN_SIG=`cat artifact/macos/*.app.tar.gz.sig`
|
||||||
|
WINDOWS_X86_64_SIG=`cat artifact/msi/*x64*.msi.zip.sig`
|
||||||
|
WINDOWS_AARCH64_SIG=`cat artifact/msi/*arm64*.msi.zip.sig`
|
||||||
|
RELEASE_DIR=https://${WEBSITE_DIR}/${VERSION}
|
||||||
|
jq --null-input \
|
||||||
|
--arg version "${VERSION}" \
|
||||||
|
--arg pub_date "${PUB_DATE}" \
|
||||||
|
--arg notes "${NOTES}" \
|
||||||
|
--arg darwin_sig "$DARWIN_SIG" \
|
||||||
|
--arg darwin_url "$RELEASE_DIR/macos/${{ env.URL_CODED_NAME }}.app.tar.gz" \
|
||||||
|
--arg windows_x86_64_sig "$WINDOWS_X86_64_SIG" \
|
||||||
|
--arg windows_x86_64_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_x64_en-US.msi.zip" \
|
||||||
|
--arg windows_aarch64_sig "$WINDOWS_AARCH64_SIG" \
|
||||||
|
--arg windows_aarch64_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_arm64_en-US.msi.zip" \
|
||||||
|
'{
|
||||||
|
"version": $version,
|
||||||
|
"pub_date": $pub_date,
|
||||||
|
"notes": $notes,
|
||||||
|
"platforms": {
|
||||||
|
"darwin-x86_64": {
|
||||||
|
"signature": $darwin_sig,
|
||||||
|
"url": $darwin_url
|
||||||
|
},
|
||||||
|
"darwin-aarch64": {
|
||||||
|
"signature": $darwin_sig,
|
||||||
|
"url": $darwin_url
|
||||||
|
},
|
||||||
|
"windows-x86_64": {
|
||||||
|
"signature": $windows_x86_64_sig,
|
||||||
|
"url": $windows_x86_64_url
|
||||||
|
},
|
||||||
|
"windows-aarch64": {
|
||||||
|
"signature": $windows_aarch64_sig,
|
||||||
|
"url": $windows_aarch64_url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' > last_update.json
|
||||||
|
cat last_update.json
|
||||||
|
|
||||||
|
- name: Generate the download static endpoint
|
||||||
|
run: |
|
||||||
|
RELEASE_DIR=https://${WEBSITE_DIR}/${VERSION}
|
||||||
|
jq --null-input \
|
||||||
|
--arg version "${VERSION}" \
|
||||||
|
--arg pub_date "${PUB_DATE}" \
|
||||||
|
--arg notes "${NOTES}" \
|
||||||
|
--arg darwin_url "$RELEASE_DIR/dmg/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_universal.dmg" \
|
||||||
|
--arg windows_x86_64_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_x64_en-US.msi" \
|
||||||
|
--arg windows_aarch64_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_arm64_en-US.msi" \
|
||||||
|
'{
|
||||||
|
"version": $version,
|
||||||
|
"pub_date": $pub_date,
|
||||||
|
"notes": $notes,
|
||||||
|
"platforms": {
|
||||||
|
"dmg-universal": {
|
||||||
|
"url": $darwin_url
|
||||||
|
},
|
||||||
|
"msi-x86_64": {
|
||||||
|
"url": $windows_x86_64_url
|
||||||
|
},
|
||||||
|
"msi-aarch64": {
|
||||||
|
"url": $windows_aarch64_url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' > last_download.json
|
||||||
|
cat last_download.json
|
||||||
|
|
||||||
|
- name: Authenticate to Google Cloud
|
||||||
|
uses: 'google-github-actions/auth@v2.1.3'
|
||||||
|
with:
|
||||||
|
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
||||||
|
|
||||||
|
- name: Set up Google Cloud SDK
|
||||||
|
uses: google-github-actions/setup-gcloud@v2.1.0
|
||||||
|
with:
|
||||||
|
project_id: kittycadapi
|
||||||
|
|
||||||
|
- name: Upload release files to public bucket
|
||||||
|
uses: google-github-actions/upload-cloud-storage@v2.1.0
|
||||||
|
with:
|
||||||
|
path: artifact
|
||||||
|
glob: '*/Zoo*'
|
||||||
|
parent: false
|
||||||
|
destination: ${{ env.BUCKET_DIR }}/${{ env.VERSION }}
|
||||||
|
|
||||||
|
- name: Upload update endpoint to public bucket
|
||||||
|
uses: google-github-actions/upload-cloud-storage@v2.1.0
|
||||||
|
with:
|
||||||
|
path: last_update.json
|
||||||
|
destination: ${{ env.BUCKET_DIR }}
|
||||||
|
|
||||||
|
- name: Upload download endpoint to public bucket
|
||||||
|
uses: google-github-actions/upload-cloud-storage@v2.1.0
|
||||||
|
with:
|
||||||
|
path: last_download.json
|
||||||
|
destination: ${{ env.BUCKET_DIR }}
|
||||||
|
|
||||||
|
- name: Upload release files to Github
|
||||||
|
if: ${{ github.event_name == 'release' }}
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: 'artifact/*/Zoo*'
|
||||||
|
|
||||||
|
announce_release:
|
||||||
|
needs: [publish-apps-release]
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install requests
|
||||||
|
|
||||||
|
- name: Announce Release
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
RELEASE_VERSION: ${{ github.event.release.tag_name }}
|
||||||
|
RELEASE_BODY: ${{ github.event.release.body}}
|
||||||
|
run: python public/announce_release.py
|
115
.github/workflows/build-test-web.yml
vendored
Normal file
115
.github/workflows/build-test-web.yml
vendored
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
name: build-test-web
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
actions: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-format:
|
||||||
|
runs-on: 'ubuntu-22.04'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn fmt-check
|
||||||
|
|
||||||
|
check-types:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn install
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: './src/wasm-lib'
|
||||||
|
|
||||||
|
- run: yarn build:wasm
|
||||||
|
- run: yarn xstate:typegen
|
||||||
|
- run: yarn tsc
|
||||||
|
|
||||||
|
|
||||||
|
check-typos:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
- name: Install codespell
|
||||||
|
run: |
|
||||||
|
python -m pip install codespell
|
||||||
|
- name: Run codespell
|
||||||
|
run: codespell --config .codespellrc # Edit this file to tweak the typo list and other configuration.
|
||||||
|
|
||||||
|
|
||||||
|
build-test-web:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
|
||||||
|
- run: yarn install
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: './src/wasm-lib'
|
||||||
|
|
||||||
|
- run: yarn build:wasm
|
||||||
|
|
||||||
|
- run: yarn simpleserver:ci
|
||||||
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
|
|
||||||
|
- name: Install Chromium Browser
|
||||||
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
|
run: yarn playwright install chromium --with-deps
|
||||||
|
|
||||||
|
- name: run unit tests
|
||||||
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
|
run: yarn test:nowatch
|
||||||
|
env:
|
||||||
|
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
|
|
||||||
|
- name: check for changes
|
||||||
|
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||||
|
id: git-check
|
||||||
|
run: |
|
||||||
|
git add src/lang/std/artifactMapGraphs
|
||||||
|
if git status src/lang/std/artifactMapGraphs | 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: ${{ github.event_name != 'release' && github.event_name != 'schedule' && steps.git-check.outputs.modified == 'true' }}
|
||||||
|
run: |
|
||||||
|
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 }}
|
||||||
|
# TODO when webkit works on ubuntu remove the os part of the commit message
|
||||||
|
git commit -am "Look at this (photo)Graph *in the voice of Nickelback*" || true
|
||||||
|
git push
|
||||||
|
git push origin ${{ github.head_ref }}
|
20
.github/workflows/cargo-clippy.yml
vendored
20
.github/workflows/cargo-clippy.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
dir: ['src/wasm-lib', 'src-tauri']
|
dir: ['src/wasm-lib']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install latest rust
|
- name: Install latest rust
|
||||||
@ -35,24 +35,6 @@ jobs:
|
|||||||
override: true
|
override: true
|
||||||
components: clippy
|
components: clippy
|
||||||
|
|
||||||
- name: install dependencies
|
|
||||||
if: matrix.dir == 'src-tauri'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y \
|
|
||||||
libgtk-3-dev \
|
|
||||||
libayatana-appindicator3-dev \
|
|
||||||
webkit2gtk-driver \
|
|
||||||
libsoup-3.0-dev \
|
|
||||||
libjavascriptcoregtk-4.1-dev \
|
|
||||||
libwebkit2gtk-4.1-dev \
|
|
||||||
at-spi2-core \
|
|
||||||
xvfb
|
|
||||||
yarn install
|
|
||||||
yarn build:wasm
|
|
||||||
yarn build:local
|
|
||||||
|
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
uses: Swatinem/rust-cache@v2.6.1
|
uses: Swatinem/rust-cache@v2.6.1
|
||||||
|
|
||||||
|
2
.github/workflows/cargo-fmt.yml
vendored
2
.github/workflows/cargo-fmt.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
dir: ['src/wasm-lib', 'src-tauri']
|
dir: ['src/wasm-lib']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install latest rust
|
- name: Install latest rust
|
||||||
|
57
.github/workflows/cargo-test-tauri.yml
vendored
57
.github/workflows/cargo-test-tauri.yml
vendored
@ -1,57 +0,0 @@
|
|||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'src-tauri/**.rs'
|
|
||||||
- '**/Cargo.toml'
|
|
||||||
- '**/Cargo.lock'
|
|
||||||
- '**/rust-toolchain.toml'
|
|
||||||
- .github/workflows/cargo-test-tauri.yml
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'src-tauri/**.rs'
|
|
||||||
- '**/Cargo.toml'
|
|
||||||
- '**/Cargo.lock'
|
|
||||||
- '**/rust-toolchain.toml'
|
|
||||||
- .github/workflows/cargo-test-tauri.yml
|
|
||||||
workflow_dispatch:
|
|
||||||
permissions: read-all
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
name: cargo test of tauri
|
|
||||||
jobs:
|
|
||||||
cargotest:
|
|
||||||
name: cargo test
|
|
||||||
runs-on: ubuntu-latest-8-cores
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
dir: ['src-tauri']
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Install latest rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
- name: install dependencies
|
|
||||||
if: matrix.dir == 'src-tauri'
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y \
|
|
||||||
libgtk-3-dev \
|
|
||||||
libayatana-appindicator3-dev \
|
|
||||||
webkit2gtk-driver \
|
|
||||||
libsoup-3.0-dev \
|
|
||||||
libjavascriptcoregtk-4.1-dev \
|
|
||||||
libwebkit2gtk-4.1-dev \
|
|
||||||
at-spi2-core \
|
|
||||||
xvfb
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2.6.1
|
|
||||||
- name: cargo test
|
|
||||||
shell: bash
|
|
||||||
run: |-
|
|
||||||
cd "${{ matrix.dir }}"
|
|
||||||
cargo test --all
|
|
546
.github/workflows/ci.yml
vendored
546
.github/workflows/ci.yml
vendored
@ -1,546 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
schedule:
|
|
||||||
- cron: '0 4 * * *'
|
|
||||||
# Daily at 04:00 AM UTC
|
|
||||||
# Will checkout the last commit from the default branch (main as of 2023-10-04)
|
|
||||||
|
|
||||||
env:
|
|
||||||
CUT_RELEASE_PR: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }}
|
|
||||||
BUILD_RELEASE: ${{ github.event_name == 'release' || github.event_name == 'schedule' || github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }}
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-format:
|
|
||||||
runs-on: 'ubuntu-latest'
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'yarn'
|
|
||||||
- run: yarn install
|
|
||||||
- run: yarn fmt-check
|
|
||||||
|
|
||||||
check-types:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'yarn'
|
|
||||||
- run: yarn install
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: './src/wasm-lib'
|
|
||||||
|
|
||||||
- run: yarn build:wasm
|
|
||||||
- run: yarn xstate:typegen
|
|
||||||
- run: yarn tsc
|
|
||||||
|
|
||||||
|
|
||||||
check-typos:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
- name: Install codespell
|
|
||||||
run: |
|
|
||||||
python -m pip install codespell
|
|
||||||
- name: Run codespell
|
|
||||||
run: codespell --config .codespellrc # Edit this file to tweak the typo list and other configuration.
|
|
||||||
|
|
||||||
|
|
||||||
build-test-web:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'yarn'
|
|
||||||
|
|
||||||
- run: yarn install
|
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: './src/wasm-lib'
|
|
||||||
|
|
||||||
- run: yarn build:wasm
|
|
||||||
|
|
||||||
- run: yarn simpleserver:ci
|
|
||||||
|
|
||||||
- run: yarn test:nowatch
|
|
||||||
|
|
||||||
|
|
||||||
prepare-json-files:
|
|
||||||
runs-on: ubuntu-latest # seperate job on Ubuntu for easy string manipulations (compared to Windows)
|
|
||||||
outputs:
|
|
||||||
version: ${{ steps.export_version.outputs.version }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'yarn'
|
|
||||||
|
|
||||||
- name: Set nightly version
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
run: |
|
|
||||||
VERSION=$(date +'%-y.%-m.%-d') yarn bump-jsons
|
|
||||||
echo "$(jq --arg url 'https://dl.zoo.dev/releases/modeling-app/nightly/last_update.json' \
|
|
||||||
'.plugins.updater.endpoints[]=$url' src-tauri/tauri.release.conf.json --indent 2)" > src-tauri/tauri.release.conf.json
|
|
||||||
echo "$(jq --arg id 'dev.zoo.modeling-app-nightly' \
|
|
||||||
'.identifier=$id' src-tauri/tauri.release.conf.json --indent 2)" > src-tauri/tauri.release.conf.json
|
|
||||||
echo "$(jq --arg name 'Zoo Modeling App (Nightly)' \
|
|
||||||
'.productName=$name' src-tauri/tauri.release.conf.json --indent 2)" > src-tauri/tauri.release.conf.json
|
|
||||||
|
|
||||||
- name: Set updater test version
|
|
||||||
if: ${{ env.CUT_RELEASE_PR == 'true' }}
|
|
||||||
run: |
|
|
||||||
echo "$(jq --arg url 'https://dl.zoo.dev/releases/modeling-app/test/last_update.json' \
|
|
||||||
'.plugins.updater.endpoints[]=$url' src-tauri/tauri.release.conf.json --indent 2)" > src-tauri/tauri.release.conf.json
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
if: ${{ github.event_name == 'schedule' || env.CUT_RELEASE_PR == 'true' }}
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
package.json
|
|
||||||
src-tauri/tauri.conf.json
|
|
||||||
src-tauri/tauri.release.conf.json
|
|
||||||
|
|
||||||
- id: export_version
|
|
||||||
run: echo "version=`cat package.json | jq -r '.version'`" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
|
|
||||||
build-test-apps:
|
|
||||||
needs: [prepare-json-files]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-14, ubuntu-latest, windows-latest]
|
|
||||||
env:
|
|
||||||
# Specific Apple Universal target for macos
|
|
||||||
TAURI_ARGS_MACOS: ${{ matrix.os == 'macos-14' && '--target universal-apple-darwin' || '' }}
|
|
||||||
# Only build executable on linux (no appimage or deb)
|
|
||||||
TAURI_ARGS_UBUNTU: ${{ matrix.os == 'ubuntu-latest' && '--bundles' || '' }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
|
|
||||||
- name: Copy updated .json files
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
run: |
|
|
||||||
ls -l artifact
|
|
||||||
cp artifact/package.json package.json
|
|
||||||
cp artifact/src-tauri/tauri.conf.json src-tauri/tauri.conf.json
|
|
||||||
cp artifact/src-tauri/tauri.release.conf.json src-tauri/tauri.release.conf.json
|
|
||||||
|
|
||||||
- name: Update WebView2 on Windows
|
|
||||||
if: matrix.os == 'windows-latest'
|
|
||||||
# Workaround needed to build the tauri windows app with matching edge version.
|
|
||||||
# From https://github.com/actions/runner-images/issues/9538
|
|
||||||
run: |
|
|
||||||
Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe'
|
|
||||||
Start-Process -FilePath setup.exe -Verb RunAs -Wait
|
|
||||||
|
|
||||||
- name: Install ubuntu system dependencies
|
|
||||||
if: matrix.os == 'ubuntu-latest'
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y \
|
|
||||||
libgtk-3-dev \
|
|
||||||
libayatana-appindicator3-dev \
|
|
||||||
webkit2gtk-driver \
|
|
||||||
libsoup-3.0-dev \
|
|
||||||
libjavascriptcoregtk-4.1-dev \
|
|
||||||
libwebkit2gtk-4.1-dev \
|
|
||||||
at-spi2-core \
|
|
||||||
xvfb
|
|
||||||
|
|
||||||
- name: Sync node version and setup cache
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
|
||||||
|
|
||||||
- run: yarn install
|
|
||||||
|
|
||||||
- name: Setup Rust
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: Setup Rust cache
|
|
||||||
uses: swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: './src-tauri -> target'
|
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: './src/wasm-lib'
|
|
||||||
|
|
||||||
- name: Run build:wasm manually
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
MODE: ${{ env.BUILD_RELEASE == 'true' && '--release' || '--debug' }}
|
|
||||||
run: |
|
|
||||||
mkdir src/wasm-lib/pkg; cd src/wasm-lib
|
|
||||||
echo "building with ${{ env.MODE }}"
|
|
||||||
npx wasm-pack build --target web --out-dir pkg ${{ env.MODE }}
|
|
||||||
cd ../../
|
|
||||||
cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
|
||||||
|
|
||||||
- name: Run vite build (build:both)
|
|
||||||
run: yarn vite build --mode ${{ env.BUILD_RELEASE == 'true' && 'production' || 'development' }}
|
|
||||||
|
|
||||||
- name: Fix format
|
|
||||||
run: yarn fmt
|
|
||||||
|
|
||||||
- name: Install x86 target for Universal builds (MacOS only)
|
|
||||||
if: matrix.os == 'macos-14'
|
|
||||||
run: |
|
|
||||||
rustup target add x86_64-apple-darwin
|
|
||||||
|
|
||||||
- name: Prepare certificate and variables (Windows only)
|
|
||||||
if: ${{ matrix.os == 'windows-latest' && env.BUILD_RELEASE == 'true' }}
|
|
||||||
run: |
|
|
||||||
echo "${{secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
|
|
||||||
cat /d/Certificate_pkcs12.p12
|
|
||||||
echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
|
|
||||||
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
|
|
||||||
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
|
|
||||||
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
|
|
||||||
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
|
|
||||||
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
|
|
||||||
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
|
|
||||||
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Setup certicate with SSM KSP (Windows only)
|
|
||||||
if: ${{ matrix.os == 'windows-latest' && env.BUILD_RELEASE == 'true' }}
|
|
||||||
run: |
|
|
||||||
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi
|
|
||||||
msiexec /i smtools-windows-x64.msi /quiet /qn
|
|
||||||
smksp_registrar.exe list
|
|
||||||
smctl.exe keypair ls
|
|
||||||
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
|
|
||||||
smksp_cert_sync.exe
|
|
||||||
shell: cmd
|
|
||||||
|
|
||||||
- name: Build the app (debug)
|
|
||||||
if: ${{ env.BUILD_RELEASE == 'false' }}
|
|
||||||
run: "yarn tauri build --debug ${{ env.TAURI_ARGS_MACOS }} ${{ env.TAURI_ARGS_UBUNTU }}"
|
|
||||||
|
|
||||||
- name: Build for Mac TestFlight (nightly)
|
|
||||||
if: ${{ github.event_name == 'schedule' && matrix.os == 'macos-14' }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
unset APPLE_SIGNING_IDENTITY
|
|
||||||
unset APPLE_CERTIFICATE
|
|
||||||
sign_app="3rd Party Mac Developer Application: KittyCAD Inc (${APPLE_TEAM_ID})"
|
|
||||||
sign_install="3rd Party Mac Developer Installer: KittyCAD Inc (${APPLE_TEAM_ID})"
|
|
||||||
profile="src-tauri/entitlements/Mac_App_Distribution.provisionprofile"
|
|
||||||
|
|
||||||
mkdir -p src-tauri/entitlements
|
|
||||||
echo -n "${APPLE_STORE_PROVISIONING_PROFILE}" | base64 --decode -o "${profile}"
|
|
||||||
|
|
||||||
echo -n "${APPLE_STORE_DISTRIBUTION_CERT}" | base64 --decode -o "dist.cer"
|
|
||||||
echo -n "${APPLE_STORE_INSTALLER_CERT}" | base64 --decode -o "installer.cer"
|
|
||||||
|
|
||||||
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
|
|
||||||
KEYCHAIN_PASSWORD="password"
|
|
||||||
|
|
||||||
# create temporary keychain
|
|
||||||
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
|
||||||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
|
|
||||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
|
||||||
|
|
||||||
# import certificate to keychain
|
|
||||||
security import "dist.cer" -P "$APPLE_STORE_P12_PASSWORD" -k $KEYCHAIN_PATH -f pkcs12 -t cert -A
|
|
||||||
security import "installer.cer" -P "$APPLE_STORE_P12_PASSWORD" -k $KEYCHAIN_PATH -f pkcs12 -t cert -A
|
|
||||||
|
|
||||||
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
|
||||||
security list-keychain -d user -s $KEYCHAIN_PATH
|
|
||||||
|
|
||||||
target="universal-apple-darwin"
|
|
||||||
|
|
||||||
# Turn off the default target
|
|
||||||
# We don't want to install the updater for the apple store build
|
|
||||||
sed -i.bu "s/default =/# default =/" src-tauri/Cargo.toml
|
|
||||||
rm src-tauri/Cargo.toml.bu
|
|
||||||
git diff src-tauri/Cargo.toml
|
|
||||||
|
|
||||||
yarn tauri build --target "${target}" --verbose --config src-tauri/tauri.app-store.conf.json
|
|
||||||
|
|
||||||
app_path="src-tauri/target/${target}/release/bundle/macos/Zoo Modeling App.app"
|
|
||||||
build_name="src-tauri/target/${target}/release/bundle/macos/Zoo Modeling App.pkg"
|
|
||||||
cp_dir="src-tauri/target/${target}/release/bundle/macos/Zoo Modeling App.app/Contents/embedded.provisionprofile"
|
|
||||||
entitlements="src-tauri/entitlements/app-store.entitlements"
|
|
||||||
|
|
||||||
cp "${profile}" "${cp_dir}"
|
|
||||||
|
|
||||||
codesign --deep --force -s "${sign_app}" --entitlements "${entitlements}" "${app_path}"
|
|
||||||
|
|
||||||
productbuild --component "${app_path}" /Applications/ --sign "${sign_install}" "${build_name}"
|
|
||||||
|
|
||||||
# Undo the changes to the Cargo.toml
|
|
||||||
git checkout src-tauri/Cargo.toml
|
|
||||||
|
|
||||||
env:
|
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
||||||
APPLE_STORE_PROVISIONING_PROFILE: ${{ secrets.APPLE_STORE_PROVISIONING_PROFILE }}
|
|
||||||
APPLE_STORE_DISTRIBUTION_CERT: ${{ secrets.APPLE_STORE_DISTRIBUTION_CERT }}
|
|
||||||
APPLE_STORE_INSTALLER_CERT: ${{ secrets.APPLE_STORE_INSTALLER_CERT }}
|
|
||||||
APPLE_STORE_P12_PASSWORD: ${{ secrets.APPLE_STORE_P12_PASSWORD }}
|
|
||||||
|
|
||||||
|
|
||||||
- name: 'Upload to Mac TestFlight (nightly)'
|
|
||||||
uses: apple-actions/upload-testflight-build@v1
|
|
||||||
if: ${{ github.event_name == 'schedule' && matrix.os == 'macos-14' }}
|
|
||||||
with:
|
|
||||||
app-path: 'src-tauri/target/universal-apple-darwin/release/bundle/macos/Zoo Modeling App.pkg'
|
|
||||||
issuer-id: ${{ secrets.APPLE_STORE_ISSUER_ID }}
|
|
||||||
api-key-id: ${{ secrets.APPLE_STORE_API_KEY_ID }}
|
|
||||||
api-private-key: ${{ secrets.APPLE_STORE_API_PRIVATE_KEY }}
|
|
||||||
app-type: osx
|
|
||||||
|
|
||||||
|
|
||||||
- name: Clean up after Mac TestFlight (nightly)
|
|
||||||
if: ${{ github.event_name == 'schedule' && matrix.os == 'macos-14' }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
git status
|
|
||||||
# remove our target builds because we want to make sure the later build
|
|
||||||
# includes the updater, and that anything we changed with the target
|
|
||||||
# does not persist
|
|
||||||
rm -rf src-tauri/target
|
|
||||||
# Lets get rid of the info.plist for the normal mac builds since its
|
|
||||||
# being sketchy.
|
|
||||||
rm src-tauri/Info.plist
|
|
||||||
|
|
||||||
# We do this after the apple store because the apple store build is
|
|
||||||
# specific and we want to overwrite it with the this new build after and
|
|
||||||
# not upload the apple store build to the public bucket
|
|
||||||
- name: Build the app (release) and sign
|
|
||||||
if: ${{ env.BUILD_RELEASE == 'true' }}
|
|
||||||
env:
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
|
||||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
|
||||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
||||||
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
|
||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
||||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
||||||
TAURI_CONF_ARGS: "--config ${{ matrix.os == 'windows-latest' && 'src-tauri\\tauri.release.conf.json' || 'src-tauri/tauri.release.conf.json' }}"
|
|
||||||
run: "yarn tauri build ${{ env.TAURI_CONF_ARGS }} ${{ env.TAURI_ARGS_MACOS }} ${{ env.TAURI_ARGS_UBUNTU }}"
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
if: matrix.os != 'ubuntu-latest'
|
|
||||||
env:
|
|
||||||
PREFIX: ${{ matrix.os == 'macos-14' && 'src-tauri/target/universal-apple-darwin' || 'src-tauri/target' }}
|
|
||||||
MODE: ${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}
|
|
||||||
with:
|
|
||||||
path: "${{ env.PREFIX }}/${{ env.MODE }}/bundle/*/*"
|
|
||||||
|
|
||||||
- name: Run e2e tests (linux only)
|
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' && github.event_name != 'release' && github.event_name != 'schedule' }}
|
|
||||||
run: |
|
|
||||||
cargo install tauri-driver --force
|
|
||||||
source .env.${{ env.BUILD_RELEASE == 'true' && 'production' || 'development' }}
|
|
||||||
export VITE_KC_API_BASE_URL
|
|
||||||
xvfb-run yarn test:e2e:tauri
|
|
||||||
env:
|
|
||||||
E2E_APPLICATION: "./src-tauri/target/${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}/zoo-modeling-app"
|
|
||||||
KITTYCAD_API_TOKEN: ${{ env.BUILD_RELEASE == 'true' && secrets.KITTYCAD_API_TOKEN || secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
||||||
|
|
||||||
- name: Run e2e tests (windows only)
|
|
||||||
if: ${{ matrix.os == 'windows-latest' && github.event_name != 'release' && github.event_name != 'schedule' }}
|
|
||||||
run: |
|
|
||||||
cargo install tauri-driver --force
|
|
||||||
yarn wdio run wdio.conf.ts
|
|
||||||
env:
|
|
||||||
E2E_APPLICATION: ".\\src-tauri\\target\\${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}\\Zoo Modeling App.exe"
|
|
||||||
KITTYCAD_API_TOKEN: ${{ env.BUILD_RELEASE == 'true' && secrets.KITTYCAD_API_TOKEN || secrets.KITTYCAD_API_TOKEN_DEV }}
|
|
||||||
VITE_KC_API_BASE_URL: ${{ env.BUILD_RELEASE == 'true' && 'https://api.zoo.dev' || 'https://api.dev.zoo.dev' }}
|
|
||||||
E2E_TAURI_ENABLED: true
|
|
||||||
TS_NODE_COMPILER_OPTIONS: '{"module": "commonjs"}'
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
if: ${{ env.CUT_RELEASE_PR == 'true' }}
|
|
||||||
|
|
||||||
- name: Copy updated .json file for updater test
|
|
||||||
if: ${{ env.CUT_RELEASE_PR == 'true' }}
|
|
||||||
run: |
|
|
||||||
ls -l artifact
|
|
||||||
cp artifact/src-tauri/tauri.release.conf.json src-tauri/tauri.release.conf.json
|
|
||||||
cat src-tauri/tauri.release.conf.json
|
|
||||||
|
|
||||||
- name: Build the app (release, updater test)
|
|
||||||
if: ${{ env.CUT_RELEASE_PR == 'true' && matrix.os != 'ubuntu-latest' }}
|
|
||||||
env:
|
|
||||||
TAURI_CONF_ARGS: "-c ${{ matrix.os == 'windows-latest' && 'src-tauri\\tauri.release.conf.json' || 'src-tauri/tauri.release.conf.json' }}"
|
|
||||||
TAURI_BUNDLE_ARGS: "-b ${{ matrix.os == 'windows-latest' && 'msi' || 'dmg' }}"
|
|
||||||
run: "yarn tauri build ${{ env.TAURI_CONF_ARGS }} ${{ env.TAURI_BUNDLE_ARGS }} ${{ env.TAURI_ARGS_MACOS }}"
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
if: ${{ env.CUT_RELEASE_PR == 'true' && matrix.os != 'ubuntu-latest' }}
|
|
||||||
with:
|
|
||||||
path: "${{ matrix.os == 'macos-14' && 'src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg' || 'src-tauri/target/release/bundle/msi/*.msi' }}"
|
|
||||||
name: updater-test
|
|
||||||
|
|
||||||
|
|
||||||
publish-apps-release:
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
|
|
||||||
needs: [check-format, check-types, check-typos, build-test-web, prepare-json-files, build-test-apps]
|
|
||||||
env:
|
|
||||||
VERSION_NO_V: ${{ needs.prepare-json-files.outputs.version }}
|
|
||||||
VERSION: ${{ github.event_name == 'release' && format('v{0}', needs.prepare-json-files.outputs.version) || needs.prepare-json-files.outputs.version }}
|
|
||||||
PUB_DATE: ${{ github.event_name == 'release' && github.event.release.created_at || github.event.repository.updated_at }}
|
|
||||||
NOTES: ${{ github.event_name == 'release' && github.event.release.body || format('Nightly build, commit {0}', github.sha) }}
|
|
||||||
BUCKET_DIR: ${{ github.event_name == 'release' && 'dl.kittycad.io/releases/modeling-app' || 'dl.kittycad.io/releases/modeling-app/nightly' }}
|
|
||||||
WEBSITE_DIR: ${{ github.event_name == 'release' && 'dl.zoo.dev/releases/modeling-app' || 'dl.zoo.dev/releases/modeling-app/nightly' }}
|
|
||||||
URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
|
|
||||||
- name: Generate the update static endpoint
|
|
||||||
run: |
|
|
||||||
ls -l artifact/*/*oo*
|
|
||||||
DARWIN_SIG=`cat artifact/macos/*.app.tar.gz.sig`
|
|
||||||
WINDOWS_SIG=`cat artifact/msi/*.msi.zip.sig`
|
|
||||||
RELEASE_DIR=https://${WEBSITE_DIR}/${VERSION}
|
|
||||||
jq --null-input \
|
|
||||||
--arg version "${VERSION}" \
|
|
||||||
--arg pub_date "${PUB_DATE}" \
|
|
||||||
--arg notes "${NOTES}" \
|
|
||||||
--arg darwin_sig "$DARWIN_SIG" \
|
|
||||||
--arg darwin_url "$RELEASE_DIR/macos/${{ env.URL_CODED_NAME }}.app.tar.gz" \
|
|
||||||
--arg windows_sig "$WINDOWS_SIG" \
|
|
||||||
--arg windows_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_x64_en-US.msi.zip" \
|
|
||||||
'{
|
|
||||||
"version": $version,
|
|
||||||
"pub_date": $pub_date,
|
|
||||||
"notes": $notes,
|
|
||||||
"platforms": {
|
|
||||||
"darwin-x86_64": {
|
|
||||||
"signature": $darwin_sig,
|
|
||||||
"url": $darwin_url
|
|
||||||
},
|
|
||||||
"darwin-aarch64": {
|
|
||||||
"signature": $darwin_sig,
|
|
||||||
"url": $darwin_url
|
|
||||||
},
|
|
||||||
"windows-x86_64": {
|
|
||||||
"signature": $windows_sig,
|
|
||||||
"url": $windows_url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}' > last_update.json
|
|
||||||
cat last_update.json
|
|
||||||
|
|
||||||
- name: Generate the download static endpoint
|
|
||||||
run: |
|
|
||||||
RELEASE_DIR=https://${WEBSITE_DIR}/${VERSION}
|
|
||||||
jq --null-input \
|
|
||||||
--arg version "${VERSION}" \
|
|
||||||
--arg pub_date "${PUB_DATE}" \
|
|
||||||
--arg notes "${NOTES}" \
|
|
||||||
--arg darwin_url "$RELEASE_DIR/dmg/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_universal.dmg" \
|
|
||||||
--arg windows_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_x64_en-US.msi" \
|
|
||||||
'{
|
|
||||||
"version": $version,
|
|
||||||
"pub_date": $pub_date,
|
|
||||||
"notes": $notes,
|
|
||||||
"platforms": {
|
|
||||||
"dmg-universal": {
|
|
||||||
"url": $darwin_url
|
|
||||||
},
|
|
||||||
"msi-x86_64": {
|
|
||||||
"url": $windows_url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}' > last_download.json
|
|
||||||
cat last_download.json
|
|
||||||
|
|
||||||
- name: Authenticate to Google Cloud
|
|
||||||
uses: 'google-github-actions/auth@v2.1.3'
|
|
||||||
with:
|
|
||||||
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
|
||||||
|
|
||||||
- name: Set up Google Cloud SDK
|
|
||||||
uses: google-github-actions/setup-gcloud@v2.1.0
|
|
||||||
with:
|
|
||||||
project_id: kittycadapi
|
|
||||||
|
|
||||||
- name: Upload release files to public bucket
|
|
||||||
uses: google-github-actions/upload-cloud-storage@v2.1.0
|
|
||||||
with:
|
|
||||||
path: artifact
|
|
||||||
glob: '*/Zoo*'
|
|
||||||
parent: false
|
|
||||||
destination: ${{ env.BUCKET_DIR }}/${{ env.VERSION }}
|
|
||||||
|
|
||||||
- name: Upload update endpoint to public bucket
|
|
||||||
uses: google-github-actions/upload-cloud-storage@v2.1.0
|
|
||||||
with:
|
|
||||||
path: last_update.json
|
|
||||||
destination: ${{ env.BUCKET_DIR }}
|
|
||||||
|
|
||||||
- name: Upload download endpoint to public bucket
|
|
||||||
uses: google-github-actions/upload-cloud-storage@v2.1.0
|
|
||||||
with:
|
|
||||||
path: last_download.json
|
|
||||||
destination: ${{ env.BUCKET_DIR }}
|
|
||||||
|
|
||||||
- name: Upload release files to Github
|
|
||||||
if: ${{ github.event_name == 'release' }}
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
files: 'artifact/*/Zoo*'
|
|
||||||
|
|
||||||
announce_release:
|
|
||||||
needs: [publish-apps-release]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
steps:
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install requests
|
|
||||||
|
|
||||||
- name: Announce Release
|
|
||||||
env:
|
|
||||||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
||||||
RELEASE_VERSION: ${{ github.event.release.tag_name }}
|
|
||||||
RELEASE_BODY: ${{ github.event.release.body}}
|
|
||||||
run: python public/announce_release.py
|
|
49
.github/workflows/generate-machine-api-types.yml
vendored
Normal file
49
.github/workflows/generate-machine-api-types.yml
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
name: generate machine-api types
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'openapi/machine-api.json'
|
||||||
|
- '.github/workflows/generate-machine-api-types.yml'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
jobs:
|
||||||
|
generate:
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn generate:machine-api
|
||||||
|
- run: yarn fmt
|
||||||
|
- name: check for changes
|
||||||
|
id: git-check
|
||||||
|
run: |
|
||||||
|
git add .
|
||||||
|
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'
|
||||||
|
run: |
|
||||||
|
git add .
|
||||||
|
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 -am "New machine-api types" || true
|
||||||
|
git push
|
||||||
|
git push origin ${{ github.head_ref }}
|
||||||
|
|
164
.github/workflows/playwright.yml
vendored
164
.github/workflows/playwright.yml
vendored
@ -6,7 +6,7 @@ on:
|
|||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@ -33,9 +33,15 @@ jobs:
|
|||||||
rust:
|
rust:
|
||||||
- 'src/wasm-lib/**'
|
- 'src/wasm-lib/**'
|
||||||
|
|
||||||
playwright-ubuntu:
|
playwright-chrome:
|
||||||
timeout-minutes: 60
|
timeout-minutes: ${{ matrix.os == 'macos-14' && 60 || 40 }}
|
||||||
runs-on: ubuntu-latest-8-cores
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest]
|
||||||
|
shardIndex: [1, 2, 3, 4]
|
||||||
|
shardTotal: [4]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
needs: check-rust-changes
|
needs: check-rust-changes
|
||||||
steps:
|
steps:
|
||||||
- name: Tune GitHub-hosted runner network
|
- name: Tune GitHub-hosted runner network
|
||||||
@ -47,6 +53,7 @@ jobs:
|
|||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- uses: KittyCAD/action-install-cli@main
|
- uses: KittyCAD/action-install-cli@main
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
shell: bash
|
||||||
run: yarn
|
run: yarn
|
||||||
- name: Cache Playwright Browsers
|
- name: Cache Playwright Browsers
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
@ -55,6 +62,7 @@ jobs:
|
|||||||
~/.cache/ms-playwright/
|
~/.cache/ms-playwright/
|
||||||
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
||||||
- name: Install Playwright Browsers
|
- name: Install Playwright Browsers
|
||||||
|
shell: bash
|
||||||
run: yarn playwright install --with-deps
|
run: yarn playwright install --with-deps
|
||||||
- name: Download Wasm Cache
|
- name: Download Wasm Cache
|
||||||
id: download-wasm
|
id: download-wasm
|
||||||
@ -69,6 +77,7 @@ jobs:
|
|||||||
path: src/wasm-lib/pkg
|
path: src/wasm-lib/pkg
|
||||||
- name: copy wasm blob
|
- name: copy wasm blob
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
||||||
|
shell: bash
|
||||||
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: Setup Rust
|
- name: Setup Rust
|
||||||
@ -83,7 +92,15 @@ jobs:
|
|||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: './src/wasm-lib'
|
workspaces: './src/wasm-lib'
|
||||||
|
- 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
|
- name: Install vector
|
||||||
|
shell: bash
|
||||||
|
if: ${{ !startsWith(matrix.os, 'windows') }}
|
||||||
run: |
|
run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
|
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
|
||||||
chmod +x /tmp/vector.sh
|
chmod +x /tmp/vector.sh
|
||||||
@ -99,25 +116,39 @@ jobs:
|
|||||||
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
||||||
- name: Build Wasm (because rust diff)
|
- name: Build Wasm (because rust diff)
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
||||||
|
shell: bash
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
- name: OR Build Wasm (because wasm cache failed)
|
- name: OR Build Wasm (because wasm cache failed)
|
||||||
if: steps.download-wasm.outcome == 'failure'
|
if: steps.download-wasm.outcome == 'failure'
|
||||||
|
shell: bash
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
- name: build web
|
- name: build web
|
||||||
run: yarn build:local
|
run: yarn build:local
|
||||||
|
shell: bash
|
||||||
- name: Run ubuntu/chrome snapshots
|
- name: Run ubuntu/chrome snapshots
|
||||||
continue-on-error: true
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
yarn playwright test --project="Google Chrome" --update-snapshots e2e/playwright/snapshot-tests.spec.ts
|
yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
||||||
env:
|
env:
|
||||||
CI: true
|
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 }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
|
with:
|
||||||
|
name: playwright-report-ubuntu-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
|
path: playwright-report/
|
||||||
|
retention-days: 30
|
||||||
|
overwrite: true
|
||||||
- name: Clean up test-results
|
- name: Clean up test-results
|
||||||
if: always()
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: rm -r test-results
|
run: rm -r test-results
|
||||||
- name: check for changes
|
- name: check for changes
|
||||||
|
shell: bash
|
||||||
id: git-check
|
id: git-check
|
||||||
run: |
|
run: |
|
||||||
git add .
|
git add .
|
||||||
@ -127,6 +158,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
- name: Commit changes, if any
|
- name: Commit changes, if any
|
||||||
if: steps.git-check.outputs.modified == 'true'
|
if: steps.git-check.outputs.modified == 'true'
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
git add .
|
git add .
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
@ -135,32 +167,31 @@ jobs:
|
|||||||
git fetch origin
|
git fetch origin
|
||||||
echo ${{ github.head_ref }}
|
echo ${{ github.head_ref }}
|
||||||
git checkout ${{ github.head_ref }}
|
git checkout ${{ github.head_ref }}
|
||||||
# TODO when webkit works on ubuntu remove the os part of the commit message
|
git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
|
||||||
git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)" || true
|
|
||||||
git push
|
git push
|
||||||
git push origin ${{ github.head_ref }}
|
git push origin ${{ github.head_ref }}
|
||||||
# only upload artifacts if there's actually changes
|
# only upload artifacts if there's actually changes
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: steps.git-check.outputs.modified == 'true'
|
if: steps.git-check.outputs.modified == 'true'
|
||||||
with:
|
with:
|
||||||
name: playwright-report-ubuntu-${{ github.sha }}
|
name: playwright-report-ubuntu-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
# if have previous run results, use them
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
if: always()
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
name: test-results-ubuntu-${{ github.sha }}
|
name: test-results-ubuntu-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: test-results/
|
path: test-results/
|
||||||
- name: Run ubuntu/chrome flow (with retries)
|
- name: Run playwright/chrome flow (with retries)
|
||||||
id: retry
|
id: retry
|
||||||
if: always()
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ ! -f "test-results/.last-run.json" ]]; then
|
if [[ ! -f "test-results/.last-run.json" ]]; then
|
||||||
# if no last run artifact, than run plawright normally
|
# if no last run artifact, than run plawright normally
|
||||||
echo "run playwright normally"
|
echo "run playwright normally"
|
||||||
yarn playwright test --project="Google Chrome" e2e/playwright/flow-tests.spec.ts || true
|
yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --grep-invert="@snapshot|@electron" || true
|
||||||
# # send to axiom
|
# # send to axiom
|
||||||
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
@ -175,7 +206,7 @@ jobs:
|
|||||||
if [[ $failed_tests -gt 0 ]]; then
|
if [[ $failed_tests -gt 0 ]]; then
|
||||||
echo "retried=true" >>$GITHUB_OUTPUT
|
echo "retried=true" >>$GITHUB_OUTPUT
|
||||||
echo "run playwright with last failed tests and retry $retry"
|
echo "run playwright with last failed tests and retry $retry"
|
||||||
yarn playwright test --project="Google Chrome" --last-failed e2e/playwright/flow-tests.spec.ts || true
|
yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --last-failed --grep-invert="@snapshot|@electron" || true
|
||||||
# send to axiom
|
# send to axiom
|
||||||
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
||||||
retry=$((retry + 1))
|
retry=$((retry + 1))
|
||||||
@ -201,6 +232,9 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
env:
|
env:
|
||||||
CI: true
|
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 }}
|
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
- name: send to axiom
|
- name: send to axiom
|
||||||
if: always()
|
if: always()
|
||||||
@ -210,21 +244,26 @@ jobs:
|
|||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: test-results-ubuntu-${{ github.sha }}
|
name: test-results-ubuntu-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: test-results/
|
path: test-results/
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
overwrite: true
|
overwrite: true
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: playwright-report-ubuntu-${{ github.sha }}
|
name: playwright-report-ubuntu-${{ matrix.shardIndex }}-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
playwright-macos:
|
|
||||||
timeout-minutes: 60
|
playwright-electron:
|
||||||
runs-on: macos-14-large
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-14]
|
||||||
|
timeout-minutes: 30
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
needs: check-rust-changes
|
needs: check-rust-changes
|
||||||
steps:
|
steps:
|
||||||
- name: Tune GitHub-hosted runner network
|
- name: Tune GitHub-hosted runner network
|
||||||
@ -234,18 +273,19 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
- uses: KittyCAD/action-install-cli@main
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
shell: bash
|
||||||
run: yarn
|
run: yarn
|
||||||
- name: Cache Playwright Browsers
|
- name: Cache Playwright Browsers
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/ms-playwright
|
~/.cache/ms-playwright/
|
||||||
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-playwright-
|
|
||||||
- name: Install Playwright Browsers
|
- name: Install Playwright Browsers
|
||||||
run: yarn playwright install --with-deps
|
shell: bash
|
||||||
|
run: yarn playwright install chromium --with-deps
|
||||||
- name: Download Wasm Cache
|
- name: Download Wasm Cache
|
||||||
id: download-wasm
|
id: download-wasm
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
||||||
@ -259,6 +299,7 @@ jobs:
|
|||||||
path: src/wasm-lib/pkg
|
path: src/wasm-lib/pkg
|
||||||
- name: copy wasm blob
|
- name: copy wasm blob
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
if: needs.check-rust-changes.outputs.rust-changed == 'false'
|
||||||
|
shell: bash
|
||||||
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: Setup Rust
|
- name: Setup Rust
|
||||||
@ -273,49 +314,64 @@ jobs:
|
|||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: './src/wasm-lib'
|
workspaces: './src/wasm-lib'
|
||||||
|
- 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
|
- name: Install vector
|
||||||
|
if: ${{ !startsWith(matrix.os, 'windows') }}
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
|
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
|
||||||
chmod +x /tmp/vector.sh
|
chmod +x /tmp/vector.sh
|
||||||
/tmp/vector.sh -y -no-modify-path
|
/tmp/vector.sh -y -no-modify-path
|
||||||
mkdir -p /tmp/vector
|
mkdir -p /tmp/vector
|
||||||
cp .github/workflows/vector.toml /tmp/vector.toml
|
cp .github/workflows/vector.toml /tmp/vector.toml
|
||||||
sed -i "" "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /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_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml
|
||||||
sed -i "" "s#GITHUB_SHA#${GITHUB_SHA}#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#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
|
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
|
||||||
cat /tmp/vector.toml
|
cat /tmp/vector.toml
|
||||||
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
${HOME}/.vector/bin/vector --config /tmp/vector.toml &
|
||||||
- name: Build Wasm (because rust diff)
|
- name: Build Wasm (because rust diff)
|
||||||
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
if: needs.check-rust-changes.outputs.rust-changed == 'true'
|
||||||
|
shell: bash
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
- name: OR Build Wasm (because wasm cache failed)
|
- name: OR Build Wasm (because wasm cache failed)
|
||||||
if: steps.download-wasm.outcome == 'failure'
|
if: steps.download-wasm.outcome == 'failure'
|
||||||
|
shell: bash
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
- name: build web
|
- name: build electron
|
||||||
run: yarn build:local
|
shell: bash
|
||||||
# if have previous run results, use them
|
run: yarn electron:package
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
if: ${{ always() }}
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
name: test-results-macos-${{ github.sha }}
|
name: test-results-ubuntu-${{ github.sha }}
|
||||||
path: test-results/
|
path: test-results/
|
||||||
- name: Run macos/safari flow (with retries)
|
- name: Run electron tests (with retries)
|
||||||
id: retry
|
id: retry
|
||||||
if: always()
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ ! -f "test-results/.last-run.json" ]]; then
|
if [[ ! -f "test-results/.last-run.json" ]]; then
|
||||||
# if no last run artifact, than run plawright normally
|
# if no last run artifact, than run plawright normally
|
||||||
echo "run playwright normally"
|
echo "run playwright normally"
|
||||||
yarn playwright test --project="webkit" e2e/playwright/flow-tests.spec.ts || true
|
if [[ "$IS_UBUNTU" == "true" ]]; then
|
||||||
|
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true
|
||||||
|
else
|
||||||
|
yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true
|
||||||
|
fi
|
||||||
# # send to axiom
|
# # send to axiom
|
||||||
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
retry=1
|
retry=1
|
||||||
max_retrys=4
|
max_retrys=2
|
||||||
|
|
||||||
# retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues
|
# retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues
|
||||||
while [[ $retry -le $max_retrys ]]; do
|
while [[ $retry -le $max_retrys ]]; do
|
||||||
@ -324,7 +380,11 @@ jobs:
|
|||||||
if [[ $failed_tests -gt 0 ]]; then
|
if [[ $failed_tests -gt 0 ]]; then
|
||||||
echo "retried=true" >>$GITHUB_OUTPUT
|
echo "retried=true" >>$GITHUB_OUTPUT
|
||||||
echo "run playwright with last failed tests and retry $retry"
|
echo "run playwright with last failed tests and retry $retry"
|
||||||
yarn playwright test --project="webkit" --last-failed e2e/playwright/flow-tests.spec.ts || true
|
if [[ "$IS_UBUNTU" == "true" ]]; then
|
||||||
|
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true
|
||||||
|
else
|
||||||
|
yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true
|
||||||
|
fi
|
||||||
# send to axiom
|
# send to axiom
|
||||||
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
|
||||||
retry=$((retry + 1))
|
retry=$((retry + 1))
|
||||||
@ -350,19 +410,27 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
NODE_ENV: development
|
||||||
|
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
|
||||||
|
VITE_KC_SKIP_AUTH: true
|
||||||
|
IS_UBUNTU: ${{ startsWith(matrix.os, 'ubuntu') && 'true' || 'false' }}
|
||||||
|
#DEBUG: 'pw:browser*'
|
||||||
|
- name: send to axiom
|
||||||
|
if: ${{ !cancelled() && (success() || failure()) && !startsWith(matrix.os, 'windows') }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
node playwrightProcess.mjs | tee /tmp/github-actions.log
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ always() }}
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
with:
|
with:
|
||||||
name: test-results-macos-${{ github.sha }}
|
name: test-results-electron-${{ github.sha }}
|
||||||
path: test-results/
|
path: test-results/
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
overwrite: true
|
overwrite: true
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ always() }}
|
if: ${{ !cancelled() && (success() || failure()) }}
|
||||||
with:
|
with:
|
||||||
name: playwright-report-macos-${{ github.sha }}
|
name: playwright-report-electron-${{ github.sha }}
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -39,6 +39,7 @@ src/wasm-lib/grackle/test_json_output
|
|||||||
e2e/playwright/playwright-secrets.env
|
e2e/playwright/playwright-secrets.env
|
||||||
e2e/playwright/temp1.png
|
e2e/playwright/temp1.png
|
||||||
e2e/playwright/temp2.png
|
e2e/playwright/temp2.png
|
||||||
|
e2e/playwright/temp3.png
|
||||||
# exports from snapshot-tests.spec.ts "exports of each format should work"
|
# exports from snapshot-tests.spec.ts "exports of each format should work"
|
||||||
e2e/playwright/export-snapshots/*
|
e2e/playwright/export-snapshots/*
|
||||||
!e2e/playwright/export-snapshots/*.png
|
!e2e/playwright/export-snapshots/*.png
|
||||||
@ -48,6 +49,7 @@ e2e/playwright/export-snapshots/*
|
|||||||
/playwright-report/
|
/playwright-report/
|
||||||
/blob-report/
|
/blob-report/
|
||||||
/playwright/.cache/
|
/playwright/.cache/
|
||||||
|
/src/lang/std/artifactMapCache
|
||||||
|
|
||||||
|
|
||||||
## generated files
|
## generated files
|
||||||
@ -60,3 +62,11 @@ Mac_App_Distribution.provisionprofile
|
|||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
venv
|
venv
|
||||||
|
.vite/
|
||||||
|
|
||||||
|
# electron
|
||||||
|
out/
|
||||||
|
|
||||||
|
src-tauri/target
|
||||||
|
electron-test-projects-dir
|
||||||
|
electron-test-projects-dir-2
|
||||||
|
25
README.md
25
README.md
@ -89,26 +89,31 @@ enable third-party cookies. You can enable third-party cookies by clicking on
|
|||||||
the eye with a slash through it in the URL bar, and clicking on "Enable
|
the eye with a slash through it in the URL bar, and clicking on "Enable
|
||||||
Third-Party Cookies".
|
Third-Party Cookies".
|
||||||
|
|
||||||
## Tauri
|
## Desktop
|
||||||
|
|
||||||
To spin up up tauri dev, `yarn install` and `yarn build:wasm-dev` need to have been done before hand then
|
To spin up the desktop app, `yarn install` and `yarn build:wasm-dev` need to have been done before hand then
|
||||||
|
|
||||||
```
|
```
|
||||||
yarn tauri dev
|
yarn electron:start
|
||||||
```
|
```
|
||||||
|
|
||||||
Will spin up the web app before opening up the tauri dev desktop app. Note that it's probably a good idea to close the browser tab that gets opened since at the time of writing they can conflict.
|
This will start the application and hot-reload on changed.
|
||||||
|
|
||||||
The dev instance automatically opens up the browser devtools which can be disabled by [commenting it out](https://github.com/KittyCAD/modeling-app/blob/main/src-tauri/src/main.rs#L92.)
|
Devtools can be opened with the usual Cmd/Ctrl-Shift-I.
|
||||||
|
|
||||||
To build, run `yarn tauri build`, or `yarn tauri build --debug` to keep access to the devtools.
|
To build, run `yarn electron:package`.
|
||||||
|
|
||||||
Note that these became separate apps on Macos, so make sure you open the right one after a build 😉
|
## Checking out commits / Bisecting
|
||||||

|
|
||||||
|
|
||||||
<img width="1232" alt="image" src="https://user-images.githubusercontent.com/29681384/211947063-46164bb4-7bdd-45cb-9a76-2f40c71a24aa.png">
|
Which commands from setup are one off vs need to be run every time?
|
||||||
|
|
||||||
<img width="1232" alt="image (1)" src="https://user-images.githubusercontent.com/29681384/211947073-e76b4933-bef5-4636-bc4d-e930ac8e290f.png">
|
The following will need to be run when checking out a new commit and guarantees the build is not stale:
|
||||||
|
```bash
|
||||||
|
yarn install
|
||||||
|
yarn wasm-prep
|
||||||
|
yarn build:wasm-dev # or yarn build:wasm for slower but more production-like build
|
||||||
|
yarn start # or yarn build:local && yarn serve for slower but more production-like build
|
||||||
|
```
|
||||||
|
|
||||||
## Before submitting a PR
|
## Before submitting a PR
|
||||||
|
|
||||||
|
24
add-osx-cert.sh
Normal file
24
add-osx-cert.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# From https://dev.to/rwwagner90/signing-electron-apps-with-github-actions-4cof
|
||||||
|
|
||||||
|
KEY_CHAIN=build.keychain
|
||||||
|
CERTIFICATE_P12=certificate.p12
|
||||||
|
|
||||||
|
# Recreate the certificate from the secure environment variable
|
||||||
|
echo $APPLE_CERTIFICATE | base64 --decode > $CERTIFICATE_P12
|
||||||
|
|
||||||
|
#create a keychain
|
||||||
|
security create-keychain -p actions $KEY_CHAIN
|
||||||
|
|
||||||
|
# Make the keychain the default so identities are found
|
||||||
|
security default-keychain -s $KEY_CHAIN
|
||||||
|
|
||||||
|
# Unlock the keychain
|
||||||
|
security unlock-keychain -p actions $KEY_CHAIN
|
||||||
|
|
||||||
|
security import $CERTIFICATE_P12 -k $KEY_CHAIN -P $APPLE_CERTIFICATE_PASSWORD -T /usr/bin/codesign;
|
||||||
|
|
||||||
|
security set-key-partition-list -S apple-tool:,apple: -s -k actions $KEY_CHAIN
|
||||||
|
|
||||||
|
# remove certs
|
||||||
|
rm -fr *.p12
|
@ -25,5 +25,5 @@ once fixed in engine will just start working here with no language changes.
|
|||||||
|
|
||||||
Sketching on the chamfered face does not currently work.
|
Sketching on the chamfered face does not currently work.
|
||||||
|
|
||||||
- **Shell**: Shell is only working for `end` faces, not for `side` or `start`
|
- **Shell**: Shell sometimes does not work when arcs or fillets are involved.
|
||||||
faces. We are tracking the engine side bug on this.
|
We are tracking the engine side bug on this.
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
37
docs/kcl/assertEqual.md
Normal file
37
docs/kcl/assertEqual.md
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -21,6 +21,7 @@ layout: manual
|
|||||||
* [`arc`](kcl/arc)
|
* [`arc`](kcl/arc)
|
||||||
* [`asin`](kcl/asin)
|
* [`asin`](kcl/asin)
|
||||||
* [`assert`](kcl/assert)
|
* [`assert`](kcl/assert)
|
||||||
|
* [`assertEqual`](kcl/assertEqual)
|
||||||
* [`assertGreaterThan`](kcl/assertGreaterThan)
|
* [`assertGreaterThan`](kcl/assertGreaterThan)
|
||||||
* [`assertGreaterThanOrEq`](kcl/assertGreaterThanOrEq)
|
* [`assertGreaterThanOrEq`](kcl/assertGreaterThanOrEq)
|
||||||
* [`assertLessThan`](kcl/assertLessThan)
|
* [`assertLessThan`](kcl/assertLessThan)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: "legAngX"
|
title: "legAngX"
|
||||||
excerpt: "Returns the angle of the given leg for x."
|
excerpt: "Compute the angle of the given leg for x."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the angle of the given leg for x.
|
Compute the angle of the given leg for x.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: "legAngY"
|
title: "legAngY"
|
||||||
excerpt: "Returns the angle of the given leg for y."
|
excerpt: "Compute the angle of the given leg for y."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the angle of the given leg for y.
|
Compute the angle of the given leg for y.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: "legLen"
|
title: "legLen"
|
||||||
excerpt: "Returns the length of the given leg."
|
excerpt: "Compute the length of the given leg."
|
||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the length of the given leg.
|
Compute the length of the given leg.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3734
docs/kcl/std.json
3734
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
157
e2e/playwright/basic-sketch.spec.ts
Normal file
157
e2e/playwright/basic-sketch.spec.ts
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
import { test, expect, Page } from '@playwright/test'
|
||||||
|
import {
|
||||||
|
getUtils,
|
||||||
|
TEST_COLORS,
|
||||||
|
setup,
|
||||||
|
tearDown,
|
||||||
|
commonPoints,
|
||||||
|
PERSIST_MODELING_CONTEXT,
|
||||||
|
} from './test-utils'
|
||||||
|
|
||||||
|
test.beforeEach(async ({ context, page }) => {
|
||||||
|
await setup(context, page)
|
||||||
|
})
|
||||||
|
|
||||||
|
test.afterEach(async ({ page }, testInfo) => {
|
||||||
|
await tearDown(page, testInfo)
|
||||||
|
})
|
||||||
|
|
||||||
|
test.setTimeout(120000)
|
||||||
|
|
||||||
|
async function doBasicSketch(page: Page, openPanes: string[]) {
|
||||||
|
const u = await getUtils(page)
|
||||||
|
await page.setViewportSize({ width: 1200, height: 500 })
|
||||||
|
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||||
|
|
||||||
|
await u.waitForAuthSkipAppStart()
|
||||||
|
await u.openDebugPanel()
|
||||||
|
|
||||||
|
// If we have the code pane open, we should see the code.
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(u.codeLocator).toHaveText(``)
|
||||||
|
} else {
|
||||||
|
// Ensure we don't see the code.
|
||||||
|
await expect(u.codeLocator).not.toBeVisible()
|
||||||
|
}
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: 'Start Sketch' })
|
||||||
|
).not.toBeDisabled()
|
||||||
|
await expect(page.getByRole('button', { name: 'Start Sketch' })).toBeVisible()
|
||||||
|
|
||||||
|
// click on "Start Sketch" button
|
||||||
|
await u.clearCommandLogs()
|
||||||
|
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
|
||||||
|
// select a plane
|
||||||
|
await page.mouse.click(700, 200)
|
||||||
|
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(u.codeLocator).toHaveText(
|
||||||
|
`const sketch001 = startSketchOn('XZ')`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
await u.closeDebugPanel()
|
||||||
|
|
||||||
|
await page.waitForTimeout(1000) // TODO detect animation ending, or disable animation
|
||||||
|
|
||||||
|
const startXPx = 600
|
||||||
|
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(u.codeLocator)
|
||||||
|
.toHaveText(`const sketch001 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt(${commonPoints.startAt}, %)`)
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10)
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(u.codeLocator)
|
||||||
|
.toHaveText(`const sketch001 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt(${commonPoints.startAt}, %)
|
||||||
|
|> line([${commonPoints.num1}, 0], %)`)
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 20)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(u.codeLocator)
|
||||||
|
.toHaveText(`const sketch001 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt(${commonPoints.startAt}, %)
|
||||||
|
|> line([${commonPoints.num1}, 0], %)
|
||||||
|
|> line([0, ${commonPoints.num1 + 0.01}], %)`)
|
||||||
|
} else {
|
||||||
|
await page.waitForTimeout(500)
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(200)
|
||||||
|
await page.mouse.click(startXPx, 500 - PUR * 20)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(u.codeLocator)
|
||||||
|
.toHaveText(`const sketch001 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt(${commonPoints.startAt}, %)
|
||||||
|
|> line([${commonPoints.num1}, 0], %)
|
||||||
|
|> line([0, ${commonPoints.num1 + 0.01}], %)
|
||||||
|
|> line([-${commonPoints.num2}, 0], %)`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// deselect line tool
|
||||||
|
await page.getByTestId('line').click()
|
||||||
|
|
||||||
|
const line1 = await u.getSegmentBodyCoords(`[data-overlay-index="${0}"]`, 0)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect
|
||||||
|
.poll(async () => u.getGreatestPixDiff(line1, TEST_COLORS.WHITE))
|
||||||
|
.toBeLessThan(3)
|
||||||
|
await expect
|
||||||
|
.poll(() => u.getGreatestPixDiff(line1, [249, 249, 249]))
|
||||||
|
.toBeLessThan(3)
|
||||||
|
}
|
||||||
|
// click between first two clicks to get center of the line
|
||||||
|
await page.mouse.click(startXPx + PUR * 15, 500 - PUR * 10)
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
expect(await u.getGreatestPixDiff(line1, TEST_COLORS.BLUE)).toBeLessThan(3)
|
||||||
|
await expect(await u.getGreatestPixDiff(line1, [0, 0, 255])).toBeLessThan(3)
|
||||||
|
}
|
||||||
|
|
||||||
|
// hold down shift
|
||||||
|
await page.keyboard.down('Shift')
|
||||||
|
// click between the latest two clicks to get center of the line
|
||||||
|
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 20)
|
||||||
|
|
||||||
|
// selected two lines therefore there should be two cursors
|
||||||
|
if (openPanes.includes('code')) {
|
||||||
|
await expect(page.locator('.cm-cursor')).toHaveCount(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Length: open menu' }).click()
|
||||||
|
await page.getByRole('button', { name: 'Equal Length' }).click()
|
||||||
|
|
||||||
|
// Open the code pane.
|
||||||
|
await u.openKclCodePanel()
|
||||||
|
await expect(u.codeLocator).toHaveText(`const sketch001 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt(${commonPoints.startAt}, %)
|
||||||
|
|> line([${commonPoints.num1}, 0], %, $seg01)
|
||||||
|
|> line([0, ${commonPoints.num1 + 0.01}], %)
|
||||||
|
|> angledLine([180, segLen(seg01)], %)`)
|
||||||
|
}
|
||||||
|
|
||||||
|
test.describe('Basic sketch', () => {
|
||||||
|
test('code pane open at start', async ({ page }) => {
|
||||||
|
// Skip on windows it is being weird.
|
||||||
|
test.skip(process.platform === 'win32', 'Skip on windows')
|
||||||
|
await doBasicSketch(page, ['code'])
|
||||||
|
})
|
||||||
|
|
||||||
|
test('code pane closed at start', async ({ page }) => {
|
||||||
|
// Load the app with the code panes
|
||||||
|
await page.addInitScript(async (persistModelingContext) => {
|
||||||
|
localStorage.setItem(
|
||||||
|
persistModelingContext,
|
||||||
|
JSON.stringify({ openPanes: [] })
|
||||||
|
)
|
||||||
|
}, PERSIST_MODELING_CONTEXT)
|
||||||
|
await doBasicSketch(page, [])
|
||||||
|
})
|
||||||
|
})
|
@ -0,0 +1,114 @@
|
|||||||
|
import { test, expect } from '@playwright/test'
|
||||||
|
import { getUtils, setup, tearDown } from './test-utils'
|
||||||
|
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||||
|
import { uuidv4 } from 'lib/utils'
|
||||||
|
|
||||||
|
test.beforeEach(async ({ context, page }) => {
|
||||||
|
await setup(context, page)
|
||||||
|
})
|
||||||
|
|
||||||
|
test.afterEach(async ({ page }, testInfo) => {
|
||||||
|
await tearDown(page, testInfo)
|
||||||
|
})
|
||||||
|
|
||||||
|
test.describe('Can create sketches on all planes and their back sides', () => {
|
||||||
|
const sketchOnPlaneAndBackSideTest = async (
|
||||||
|
page: any,
|
||||||
|
plane: string,
|
||||||
|
clickCoords: { x: number; y: number }
|
||||||
|
) => {
|
||||||
|
const u = await getUtils(page)
|
||||||
|
const PUR = 400 / 37.5 //pixeltoUnitRatio
|
||||||
|
await page.setViewportSize({ width: 1200, height: 500 })
|
||||||
|
|
||||||
|
await u.waitForAuthSkipAppStart()
|
||||||
|
await u.openDebugPanel()
|
||||||
|
|
||||||
|
const coord =
|
||||||
|
plane === '-XY' || plane === '-YZ' || plane === 'XZ' ? -100 : 100
|
||||||
|
const camCommand: EngineCommand = {
|
||||||
|
type: 'modeling_cmd_req',
|
||||||
|
cmd_id: uuidv4(),
|
||||||
|
cmd: {
|
||||||
|
type: 'default_camera_look_at',
|
||||||
|
center: { x: 0, y: 0, z: 0 },
|
||||||
|
vantage: { x: coord, y: coord, z: coord },
|
||||||
|
up: { x: 0, y: 0, z: 1 },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const updateCamCommand: EngineCommand = {
|
||||||
|
type: 'modeling_cmd_req',
|
||||||
|
cmd_id: uuidv4(),
|
||||||
|
cmd: {
|
||||||
|
type: 'default_camera_get_settings',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const code = `const sketch001 = startSketchOn('${plane}')
|
||||||
|
|> startProfileAt([0.9, -1.22], %)`
|
||||||
|
|
||||||
|
await u.openDebugPanel()
|
||||||
|
|
||||||
|
await u.clearCommandLogs()
|
||||||
|
await page.getByRole('button', { name: 'Start Sketch' }).click()
|
||||||
|
|
||||||
|
await u.sendCustomCmd(camCommand)
|
||||||
|
await page.waitForTimeout(100)
|
||||||
|
await u.sendCustomCmd(updateCamCommand)
|
||||||
|
|
||||||
|
await u.closeDebugPanel()
|
||||||
|
await page.mouse.click(clickCoords.x, clickCoords.y)
|
||||||
|
await page.waitForTimeout(300) // wait for animation
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: 'line Line', exact: true })
|
||||||
|
).toBeVisible()
|
||||||
|
|
||||||
|
// draw a line
|
||||||
|
const startXPx = 600
|
||||||
|
|
||||||
|
await u.closeDebugPanel()
|
||||||
|
await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10)
|
||||||
|
|
||||||
|
await expect(page.locator('.cm-content')).toHaveText(code)
|
||||||
|
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: 'line Line', exact: true })
|
||||||
|
.first()
|
||||||
|
.click()
|
||||||
|
await u.openAndClearDebugPanel()
|
||||||
|
await page.getByRole('button', { name: 'Exit Sketch' }).click()
|
||||||
|
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||||
|
|
||||||
|
await u.clearCommandLogs()
|
||||||
|
await u.removeCurrentCode()
|
||||||
|
}
|
||||||
|
test('XY', async ({ page }) => {
|
||||||
|
await sketchOnPlaneAndBackSideTest(
|
||||||
|
page,
|
||||||
|
'XY',
|
||||||
|
{ x: 600, y: 388 } // red plane
|
||||||
|
// { x: 600, y: 400 }, // red plane // clicks grid helper and that causes problems, should fix so that these coords work too.
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('YZ', async ({ page }) => {
|
||||||
|
await sketchOnPlaneAndBackSideTest(page, 'YZ', { x: 700, y: 250 }) // green plane
|
||||||
|
})
|
||||||
|
|
||||||
|
test('XZ', async ({ page }) => {
|
||||||
|
await sketchOnPlaneAndBackSideTest(page, '-XZ', { x: 700, y: 80 }) // blue plane
|
||||||
|
})
|
||||||
|
|
||||||
|
test('-XY', async ({ page }) => {
|
||||||
|
await sketchOnPlaneAndBackSideTest(page, '-XY', { x: 600, y: 118 }) // back of red plane
|
||||||
|
})
|
||||||
|
|
||||||
|
test('-YZ', async ({ page }) => {
|
||||||
|
await sketchOnPlaneAndBackSideTest(page, '-YZ', { x: 700, y: 219 }) // back of green plane
|
||||||
|
})
|
||||||
|
|
||||||
|
test('-XZ', async ({ page }) => {
|
||||||
|
await sketchOnPlaneAndBackSideTest(page, 'XZ', { x: 700, y: 427 }) // back of blue plane
|
||||||
|
})
|
||||||
|
})
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user