Skip to content

Commit

Permalink
chore: run e2e in actions (#1477)
Browse files Browse the repository at this point in the history
run e2e test in gh actions

---------

Co-authored-by: sorrycc <[email protected]>
  • Loading branch information
stormslowly and sorrycc authored Aug 7, 2024
1 parent 7353c9a commit 711611d
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 18 deletions.
107 changes: 90 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,122 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'master' }}

jobs:
test:
name: Test
cargo-test:
name: Cargo Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get cache expires mark
id: week_mark
run: echo "EXPIRES_WEEK_MARK=$(date +%U)" >> "$GITHUB_OUTPUT"
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
clippy: false
save-cache: true
shared-key: x86-cargo-test-ubuntu-latest-${{ steps.week_mark.outputs.EXPIRES_WEEK_MARK }}-${{ hashFiles('./Cargo.lock') }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.8
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: "pnpm"
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- run: pnpm i
- name: Clean Sailfish cache
run: rm -rf target/debug/build/sailfish-*
- run: cargo test
build:
name: Mako Build
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
if: ${{ !startsWith(github.event.head_commit.message, 'release:') && !startsWith(github.event.head_commit.message, 'ci:') && !startsWith(github.event.head_commit.message, 'docs:') }}
steps:
- uses: actions/checkout@v4
- name: Get cache expires mark
id: week_mark
run: echo "EXPIRES_WEEK_MARK=$(date +%U)" >> "$GITHUB_OUTPUT"
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
clippy: true
save-cache: ${{ github.ref_name == 'master' }}
save-cache: true
shared-key: mako-build-${{ matrix.os }}-${{ steps.week_mark.outputs.EXPIRES_WEEK_MARK }}-${{ hashFiles('./Cargo.lock') }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: '20'
cache: "pnpm"
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- run: pnpm i --no-lockfile
- name: Install cargo-nextest
uses: taiki-e/install-action@cargo-nextest
- name: Test
shell: bash
run: cargo nextest run

- run: pnpm i
- name: Build
run: pnpm build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.os }}
path: |
./packages/mako/*.node
./packages/mako/binding.*
./packages/mako/dist
if-no-files-found: error
test_e2e:
name: E2E
needs: build
strategy:
fail-fast: false
matrix:
script: [ "test:e2e", "test:hmr", "test:umi" ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.8
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: "pnpm"
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- run: |
pnpm i
pnpm playwright install chromium
- name: Download bindings
uses: actions/download-artifact@v4
with:
name: bindings-${{ matrix.os }}
path: packages/mako/
- name: LS
run: ls -l ./packages/mako
- name: Test E2E
run: pnpm ${{ matrix.script }}

lint:
name: Clippy
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, 'release:') && !startsWith(github.event.head_commit.message, 'ci:') && !startsWith(github.event.head_commit.message, 'docs:') }}
steps:
- uses: actions/checkout@v4
- name: Get cache expires mark
id: week_mark
run: echo "EXPIRES_WEEK_MARK=$(date +%U)" >> "$GITHUB_OUTPUT"
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
clippy: true
restore-cache: false
shared-key: x86-cargo-test-ubuntu-latest-${{ steps.week_mark.outputs.EXPIRES_WEEK_MARK }}-${{ hashFiles('./Cargo.lock') }}

- name: Clippy
run: cargo clippy --locked -- -D warnings

Expand All @@ -77,9 +150,9 @@ jobs:
uses: pnpm/action-setup@v4
with:
version: 8.15.8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: '20'
cache: "pnpm"
token: ${{ secrets.GH_DOTCOM_TOKEN }}
- run: pnpm i
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node-bind-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
~/.cargo/git/db/
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}-${{ hashFiles('./Cargo.lock') }}
- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
with:
Expand Down

0 comments on commit 711611d

Please sign in to comment.