ci: Fix e2e workflow to install rust toolchain when needed (#5728)
* ci: Fix e2e workflow to install rust toolchain when needed * Unify conditions * Pull out condition to variable * Add echo so that debuggin is easier
This commit is contained in:
16
.github/workflows/build-and-store-wasm.yml
vendored
16
.github/workflows/build-and-store-wasm.yml
vendored
@ -16,15 +16,21 @@ jobs:
|
|||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn
|
run: yarn
|
||||||
- name: Setup Rust
|
- name: Use correct Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
shell: bash
|
||||||
- name: Cache wasm
|
run: |
|
||||||
uses: Swatinem/rust-cache@v2
|
cp --update=none rust/rust-toolchain.toml ./ || true
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
workspaces: './rust'
|
cache: false # Configured below.
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: rust
|
||||||
- name: build wasm
|
- name: build wasm
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
|
|
||||||
|
17
.github/workflows/build-apps.yml
vendored
17
.github/workflows/build-apps.yml
vendored
@ -33,18 +33,25 @@ jobs:
|
|||||||
|
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Use correct Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
shell: bash
|
||||||
|
run: |
|
||||||
- uses: Swatinem/rust-cache@v2
|
cp --update=none rust/rust-toolchain.toml ./ || true
|
||||||
|
- name: Install rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
workspaces: './rust'
|
cache: false # Configured below.
|
||||||
|
|
||||||
# TODO: see if we can fetch from main instead if no diff at rust
|
# TODO: see if we can fetch from main instead if no diff at rust
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
|
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: rust
|
||||||
|
|
||||||
- name: Run build:wasm
|
- name: Run build:wasm
|
||||||
run: "yarn build:wasm"
|
run: "yarn build:wasm"
|
||||||
|
|
||||||
|
44
.github/workflows/e2e-tests.yml
vendored
44
.github/workflows/e2e-tests.yml
vendored
@ -135,19 +135,35 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
|
run: cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: Setup Rust
|
- name: Build WASM condition
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' }}
|
id: wasm
|
||||||
uses: dtolnay/rust-toolchain@stable
|
if: needs.conditions.outputs.should-run == 'true'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euox pipefail
|
||||||
|
# Build wasm if this is a scheduled run, there are Rust changes, or
|
||||||
|
# downloading from the wasm cache failed.
|
||||||
|
if [[ ${{github.event_name}} == 'schedule' || ${{steps.filter.outputs.rust}} == 'true' || ${{steps.download-wasm.outcome}} == 'failure' ]]; then
|
||||||
|
echo "should-build-wasm=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "should-build-wasm=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Use correct Rust toolchain
|
||||||
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cp --update=none rust/rust-toolchain.toml ./ || true
|
||||||
|
- name: Install rust
|
||||||
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false # Configured below.
|
||||||
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
- uses: taiki-e/install-action@955a6ff1416eae278c9f833008a9beb4b7f9afe3
|
||||||
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
with:
|
with:
|
||||||
tool: wasm-pack
|
tool: wasm-pack
|
||||||
- name: Cache Wasm (because rust diff)
|
- name: Rust Cache
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && (github.event_name == 'schedule' || steps.filter.outputs.rust == 'true') }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: './rust'
|
|
||||||
- name: OR Cache Wasm (because wasm cache failed)
|
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.download-wasm.outcome == 'failure' }}
|
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: './rust'
|
workspaces: './rust'
|
||||||
@ -174,12 +190,8 @@ jobs:
|
|||||||
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
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && (github.event_name == 'schedule' || steps.filter.outputs.rust == 'true') }}
|
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.wasm.outputs.should-build-wasm == 'true' }}
|
||||||
shell: bash
|
|
||||||
run: yarn build:wasm
|
|
||||||
- name: OR Build Wasm (because wasm cache failed)
|
|
||||||
if: ${{ needs.conditions.outputs.should-run == 'true' && steps.download-wasm.outcome == 'failure' }}
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: yarn build:wasm
|
run: yarn build:wasm
|
||||||
- name: build web
|
- name: build web
|
||||||
|
Reference in New Issue
Block a user