From e40b983f45684bd81db69c139bcd0dded24e595f Mon Sep 17 00:00:00 2001 From: Jeff Charles Date: Wed, 27 Nov 2024 10:56:13 -0500 Subject: [PATCH] Simplify CI workflows --- .github/actions/ci-shared-setup/action.yml | 37 ------------- .github/workflows/ci.yml | 62 ++++++++++++++-------- .github/workflows/wpt.yml | 25 --------- 3 files changed, 39 insertions(+), 85 deletions(-) delete mode 100644 .github/actions/ci-shared-setup/action.yml delete mode 100644 .github/workflows/wpt.yml diff --git a/.github/actions/ci-shared-setup/action.yml b/.github/actions/ci-shared-setup/action.yml deleted file mode 100644 index ea19f1be..00000000 --- a/.github/actions/ci-shared-setup/action.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: "Shared CI setup" -description: "Common setup for CI pipeline workflow jobs" -runs: - using: "composite" - steps: - - name: Cargo Cache - uses: actions/cache@v3 - with: - path: ~/.cargo - key: cargo-${{ hashFiles('Cargo.toml') }} - restore-keys: | - cargo-${{ hashFiles('Cargo.toml') }} - cargo - - - name: Cargo Target Cache - uses: actions/cache@v3 - with: - path: target - key: cargo-target-${{ hashFiles('Cargo.toml') }} - restore-keys: | - cargo-target-${{ hashFiles('Cargo.toml') }} - cargo-target - - - name: Read wasmtime version - id: wasmtime_version - shell: bash - run: | - VERSION=$(cargo metadata --format-version=1 --locked | jq '.packages[] | select(.name == "wasmtime") | .version' -r) - echo "wasmtime_version=$VERSION" >> "$GITHUB_OUTPUT" - - - name: Install wasmtime-cli - shell: bash - run: | - wget -nv 'https://github.com/bytecodealliance/wasmtime/releases/download/v${{ steps.wasmtime_version.outputs.wasmtime_version }}/wasmtime-v${{ steps.wasmtime_version.outputs.wasmtime_version }}-x86_64-linux.tar.xz' -O /tmp/wasmtime.tar.xz - mkdir /tmp/wasmtime - tar xvf /tmp/wasmtime.tar.xz --strip-components=1 -C /tmp/wasmtime - echo "/tmp/wasmtime" >> $GITHUB_PATH diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15e7c11d..f551f660 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,15 +7,46 @@ on: pull_request: jobs: - plugin: - name: test_plugin + ci: + name: CI runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - - uses: ./.github/actions/ci-shared-setup + - name: Cargo Cache + uses: actions/cache@v3 + with: + path: ~/.cargo + key: cargo-${{ hashFiles('Cargo.toml') }} + restore-keys: | + cargo-${{ hashFiles('Cargo.toml') }} + cargo + + - name: Cargo Target Cache + uses: actions/cache@v3 + with: + path: target + key: cargo-target-${{ hashFiles('Cargo.toml') }} + restore-keys: | + cargo-target-${{ hashFiles('Cargo.toml') }} + cargo-target + + - name: Read wasmtime version + id: wasmtime_version + shell: bash + run: | + VERSION=$(cargo metadata --format-version=1 --locked | jq '.packages[] | select(.name == "wasmtime") | .version' -r) + echo "wasmtime_version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Install wasmtime-cli + shell: bash + run: | + wget -nv 'https://github.com/bytecodealliance/wasmtime/releases/download/v${{ steps.wasmtime_version.outputs.wasmtime_version }}/wasmtime-v${{ steps.wasmtime_version.outputs.wasmtime_version }}-x86_64-linux.tar.xz' -O /tmp/wasmtime.tar.xz + mkdir /tmp/wasmtime + tar xvf /tmp/wasmtime.tar.xz --strip-components=1 -C /tmp/wasmtime + echo "/tmp/wasmtime" >> $GITHUB_PATH - name: Install cargo-hack uses: taiki-e/install-action@cargo-hack @@ -44,26 +75,6 @@ jobs: - name: Lint Runner run: cargo clippy --package=javy-runner -- -D warnings - - name: Upload plugin to artifacts - uses: actions/upload-artifact@v4 - with: - name: plugin - path: target/wasm32-wasip1/release/plugin.wasm - - cli: - name: test_cli - runs-on: ubuntu-latest - needs: plugin - steps: - - uses: actions/checkout@v4 - - - uses: ./.github/actions/ci-shared-setup - - - uses: actions/download-artifact@v4 - with: - name: plugin - path: target/wasm32-wasip1/release/ - - name: Build test-plugin run: | cargo build --package=javy-test-plugin --release --target=wasm32-wasip1 @@ -80,3 +91,8 @@ jobs: run: | cargo fmt -- --check CARGO_PROFILE_RELEASE_LTO=off cargo clippy --package=javy-cli --release --all-targets -- -D warnings + + - name: WPT + run: | + npm install --prefix wpt + npm test --prefix wpt diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml deleted file mode 100644 index bcc8c6a7..00000000 --- a/.github/workflows/wpt.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: WPT CI - -on: - push: - branches: - - main - pull_request: - -jobs: - wpt: - name: wpt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - uses: ./.github/actions/ci-shared-setup - - - name: WPT - run: | - cargo build --package=javy-plugin --release --target=wasm32-wasip1 - CARGO_PROFILE_RELEASE_LTO=off cargo build --package=javy-cli --release - npm install --prefix wpt - npm test --prefix wpt