Tauri tests on dev when the CI's BUILD_RELEASE is false (#1183)

* Tauri tests on dev when the CI's BUILD_RELEASE is false
Fixes #1182

* Fix bin not here

* Dev token on debug

* Clean up
This commit is contained in:
Pierre Jacquier
2023-12-07 06:54:13 -05:00
committed by GitHub
parent 3ae5393dd7
commit 04ae8141c3
3 changed files with 9 additions and 4 deletions

View File

@ -181,6 +181,9 @@ jobs:
cd ../../ cd ../../
cp src/wasm-lib/pkg/wasm_lib_bg.wasm public 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 - name: Fix format
run: yarn fmt run: yarn fmt
@ -250,10 +253,12 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: | run: |
cargo install tauri-driver cargo install tauri-driver
source .env.${{ env.BUILD_RELEASE == 'true' && 'production' || 'development' }}
export VITE_KC_API_BASE_URL
xvfb-run yarn test:e2e:tauri xvfb-run yarn test:e2e:tauri
env: env:
E2E_APPLICATION: "./src-tauri/target/${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}/kittycad-modeling" E2E_APPLICATION: "./src-tauri/target/${{ env.BUILD_RELEASE == 'true' && 'release' || 'debug' }}/kittycad-modeling"
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }} KITTYCAD_API_TOKEN: ${{ env.BUILD_RELEASE == 'true' && secrets.KITTYCAD_API_TOKEN || secrets.KITTYCAD_API_TOKEN_DEV }}
publish-apps-release: publish-apps-release:

View File

@ -29,13 +29,14 @@ describe('KCMA (Tauri, Linux)', () => {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} }
const verifyUrl = `https://api.kittycad.io/oauth2/device/verify?user_code=${userCode}` const apiBaseUrl = process.env.VITE_KC_API_BASE_URL
const verifyUrl = `${apiBaseUrl}/oauth2/device/verify?user_code=${userCode}`
console.log(`GET ${verifyUrl}`) console.log(`GET ${verifyUrl}`)
const vr = await fetch(verifyUrl, { headers }) const vr = await fetch(verifyUrl, { headers })
console.log(vr.status) console.log(vr.status)
// Device flow: confirm // Device flow: confirm
const confirmUrl = 'https://api.kittycad.io/oauth2/device/confirm' const confirmUrl = `${apiBaseUrl}/oauth2/device/confirm`
const data = JSON.stringify({ user_code: userCode }) const data = JSON.stringify({ user_code: userCode })
console.log(`POST ${confirmUrl} ${data}`) console.log(`POST ${confirmUrl} ${data}`)
const cr = await fetch(confirmUrl, { const cr = await fetch(confirmUrl, {

View File

@ -1,7 +1,6 @@
{ {
"$schema": "../node_modules/@tauri-apps/cli/schema.json", "$schema": "../node_modules/@tauri-apps/cli/schema.json",
"build": { "build": {
"beforeBuildCommand": "yarn build:both",
"beforeDevCommand": "yarn start", "beforeDevCommand": "yarn start",
"devPath": "http://localhost:3000", "devPath": "http://localhost:3000",
"distDir": "../build" "distDir": "../build"