Skip to content

fix: update paths for documentation checks and reports in tests #21

fix: update paths for documentation checks and reports in tests

fix: update paths for documentation checks and reports in tests #21

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "1"
CARGO_TARGET_DIR: target/ci
jobs:
build_ci:
name: Build (CI)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target/ci
shared-key: ci-${{ runner.os }}
save-if: true
- name: Prebuild CLI for JS runtime tests
run: cargo build -p edge-cli --locked
- name: Prebuild test targets (no-run)
run: cargo test --workspace --all-targets --no-run
test_rust_crates:
name: Test Rust (${{ matrix.package }})
runs-on: ubuntu-latest
needs: build_ci
strategy:
fail-fast: false
matrix:
package:
- runtime-core
- functions
- edge-server
- edge-cli
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Restore Rust cache from build stage
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target/ci
shared-key: ci-${{ runner.os }}
save-if: false
- name: Run Rust tests for crate
run: cargo test -p ${{ matrix.package }} --all-targets
test_js:
name: Test JS/TS (CI)
runs-on: ubuntu-latest
needs: build_ci
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Restore Rust cache from build stage
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target/ci
shared-key: ci-${{ runner.os }}
save-if: false
- name: Run JS/TS runtime tests
run: make test-js
verify_web_standards_report:
name: Verify Web Standards Report
runs-on: ubuntu-latest
needs: build_ci
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Restore Rust cache from build stage
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target/ci
shared-key: ci-${{ runner.os }}
save-if: false
- name: Verify web standards report is up to date
run: |
cargo test -p functions --test web_api_report generate_web_standards_report -- --nocapture
git diff --exit-code docs/reports/web_standards_api_report.md
build_release_artifacts:
name: Build Release Artifacts (${{ matrix.label }})
needs: [test_rust_crates, test_js, verify_web_standards_report]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
label: linux-x86_64
binary_name: thunder
archive_name: thunder-linux-x86_64.tar.gz
- os: macos-latest
label: macos-x86_64
binary_name: thunder
archive_name: thunder-macos-x86_64.tar.gz
- os: macos-14
label: macos-aarch64
binary_name: thunder
archive_name: thunder-macos-aarch64.tar.gz
# - os: windows-latest
# label: windows-x86_64
# binary_name: thunder.exe
# archive_name: thunder-windows-x86_64.zip
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target/ci
shared-key: release-${{ runner.os }}
- name: Build release binary
run: cargo build -p edge-cli --release --locked
- name: Package artifact (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p dist
cp ${CARGO_TARGET_DIR}/release/${{ matrix.binary_name }} dist/${{ matrix.binary_name }}
chmod +x dist/${{ matrix.binary_name }}
tar -czf dist/${{ matrix.archive_name }} -C dist ${{ matrix.binary_name }}
- name: Package artifact (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -Path dist -ItemType Directory -Force | Out-Null
Copy-Item "${env:CARGO_TARGET_DIR}/release/${{ matrix.binary_name }}" "dist/${{ matrix.binary_name }}" -Force
Compress-Archive -Path "dist/${{ matrix.binary_name }}" -DestinationPath "dist/${{ matrix.archive_name }}" -Force
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.label }}
path: dist/${{ matrix.archive_name }}
release_unstable:
name: Publish Unstable Release (main)
runs-on: ubuntu-latest
needs: build_release_artifacts
if: github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Move unstable tag to current commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -f unstable $GITHUB_SHA
git push origin refs/tags/unstable --force
- name: Publish unstable prerelease
uses: softprops/action-gh-release@v2
with:
tag_name: unstable
name: Unstable
prerelease: true
make_latest: false
generate_release_notes: true
files: |
dist/**/*.tar.gz
dist/**/*.zip
release_stable:
name: Publish Stable Release (tags)
runs-on: ubuntu-latest
needs: build_release_artifacts
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Publish stable release
uses: softprops/action-gh-release@v2
with:
files: |
dist/**/*.tar.gz
dist/**/*.zip
generate_release_notes: true