mirror of
https://github.com/penpot/penpot.git
synced 2026-11-19 00:20:35 +00:00
123 lines
3.8 KiB
YAML
123 lines
3.8 KiB
YAML
name: "CI: WASM"
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'render-wasm/**'
|
|
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- ready_for_review
|
|
|
|
push:
|
|
branches:
|
|
- develop
|
|
- staging
|
|
|
|
paths:
|
|
- 'render-wasm/**'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test-render-wasm:
|
|
if: ${{ !github.event.pull_request.draft }}
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write # coverage comment on the PR
|
|
name: "Render WASM Tests"
|
|
runs-on: penpot-extended-runner
|
|
container:
|
|
image: penpotapp/devenv:latest
|
|
volumes:
|
|
- /var/cache/github-runner/m2:/root/.m2
|
|
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Format
|
|
working-directory: ./render-wasm
|
|
run: |
|
|
./fmt --check
|
|
|
|
- name: Lint
|
|
working-directory: ./render-wasm
|
|
run: |
|
|
./lint
|
|
|
|
- name: Install cargo-llvm-cov
|
|
env:
|
|
CARGO_LLVM_COV_VERSION: "0.9.1"
|
|
run: |
|
|
case "$(uname -m)" in
|
|
aarch64|arm64)
|
|
arch="aarch64"
|
|
sha256="abf5f13c1520f8756d2192bfaaeadb0208f5b7eaa8cadc15bf847befa42b7360"
|
|
;;
|
|
*)
|
|
arch="x86_64"
|
|
sha256="b3f68e625481fed9b16444174f3fa5ebcdbde4a1878803a35eabe2dcefcdc41a"
|
|
;;
|
|
esac
|
|
archive="cargo-llvm-cov-${arch}-unknown-linux-gnu.tar.gz"
|
|
curl -fsSL --retry 3 -o "$RUNNER_TEMP/$archive" \
|
|
"https://github.com/taiki-e/cargo-llvm-cov/releases/download/v${CARGO_LLVM_COV_VERSION}/${archive}"
|
|
echo "${sha256} $RUNNER_TEMP/$archive" | sha256sum -c -
|
|
tar -xzf "$RUNNER_TEMP/$archive" -C /usr/local/bin cargo-llvm-cov
|
|
cargo llvm-cov --version
|
|
|
|
- name: Test
|
|
working-directory: ./render-wasm
|
|
env:
|
|
RENDER_WASM_COVERAGE: "true"
|
|
run: |
|
|
./test
|
|
|
|
- name: Coverage summary
|
|
if: ${{ !cancelled() && hashFiles('render-wasm/target/coverage/lcov.info') != '' }}
|
|
run: |
|
|
node scripts/coverage-summary.mjs \
|
|
--title "Render WASM test coverage" \
|
|
--note "Rust sources under \`render-wasm/src\`, measured by cargo-llvm-cov on the native test build." \
|
|
--lcov render-wasm/target/coverage/lcov.info \
|
|
> render-wasm/target/coverage/summary.md
|
|
cat render-wasm/target/coverage/summary.md >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Coverage comment
|
|
# Fork PRs get a read-only token, so only branches of this repo comment.
|
|
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('render-wasm/target/coverage/lcov.info') != '' }}
|
|
continue-on-error: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: |
|
|
node scripts/coverage-comment.mjs \
|
|
--project "Render WASM" \
|
|
--lcov render-wasm/target/coverage/lcov.info \
|
|
--llvm-json render-wasm/target/coverage/summary.json
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
if: ${{ !cancelled() }}
|
|
with:
|
|
name: render-wasm-coverage
|
|
path: render-wasm/target/coverage/
|
|
overwrite: true
|
|
if-no-files-found: ignore
|
|
retention-days: 7
|