🤖 Update actions/checkout action to v7.0.1 #93
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Xodium CI/CD | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| lint: | |
| name: Lint | |
| if: | | |
| !contains(github.event.head_commit.message, '[ci-skip]') && | |
| !contains(github.event.pull_request.title, '[ci-skip]') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v7.0.1 | |
| - id: setup_rust | |
| name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3 | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - id: install_wasm_target | |
| name: Install WASM Target | |
| run: rustup target add wasm32-unknown-unknown | |
| shell: bash | |
| - id: run_sccache_cache | |
| name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad | |
| - id: cache_dependencies | |
| name: Cache dependencies | |
| uses: actions/cache@v6.1.0 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - id: cache_trunk | |
| name: Cache Trunk | |
| uses: actions/cache@v6.1.0 | |
| with: | |
| path: ~/.cargo/bin/trunk | |
| key: ${{ runner.os }}-trunk-latest | |
| - id: run_lint | |
| name: Run Lint | |
| run: | | |
| cargo clippy --all-targets --all-features -- -D warnings | |
| cargo fmt --all -- --check | |
| shell: bash | |
| - id: install_cargo_binstall | |
| name: Install cargo-binstall | |
| uses: cargo-bins/cargo-binstall@dc19f1e48450eefe5a29b8da6c6b00a87d730b37 | |
| - id: run_cargo_machete | |
| name: Run cargo-machete | |
| run: | | |
| cargo binstall cargo-machete --no-confirm --force | |
| cargo machete | |
| test: | |
| name: Test | |
| if: | | |
| !contains(github.event.head_commit.message, '[ci-skip]') && | |
| !contains(github.event.pull_request.title, '[ci-skip]') | |
| needs: [lint] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v7.0.1 | |
| - id: setup_rust | |
| name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3 | |
| with: | |
| toolchain: stable | |
| - id: install_wasm_target | |
| name: Install WASM Target | |
| run: rustup target add wasm32-unknown-unknown | |
| shell: bash | |
| - id: cache_dependencies | |
| name: Cache dependencies | |
| uses: actions/cache@v6.1.0 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - id: install_wasm_pack | |
| name: Install wasm-pack | |
| run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| shell: bash | |
| - id: run_tests | |
| name: Run WASM tests | |
| run: wasm-pack test --headless --chrome | |
| shell: bash | |
| build: | |
| name: Build | |
| if: | | |
| !contains(github.event.head_commit.message, '[ci-skip]') && | |
| !contains(github.event.pull_request.title, '[ci-skip]') | |
| needs: [lint, test] | |
| runs-on: ubuntu-latest | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - id: setup_rust | |
| name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3 | |
| with: | |
| toolchain: stable | |
| - id: install_wasm_target | |
| name: Install WASM Target | |
| run: rustup target add wasm32-unknown-unknown | |
| shell: bash | |
| - id: run_sccache_cache | |
| name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad | |
| - id: cache_dependencies | |
| name: Cache dependencies | |
| uses: actions/cache@v6.1.0 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - id: cache_trunk | |
| name: Cache Trunk | |
| uses: actions/cache@v6.1.0 | |
| with: | |
| path: ~/.cargo/bin/trunk | |
| key: ${{ runner.os }}-trunk-latest | |
| - id: setup_trunk | |
| name: Setup Trunk | |
| uses: jetli/trunk-action@1346cc09eace4beb84e403e199a471346d4684c9 | |
| with: | |
| version: latest | |
| - id: build_app | |
| name: Build App | |
| run: trunk build --release | |
| - id: wasm_size_budget | |
| name: Check WASM size budget | |
| run: | | |
| WASM_FILE=$(find dist -name "*.wasm" | head -n 1) | |
| if [ -z "$WASM_FILE" ]; then | |
| echo "Error: No WASM file found in dist/" | |
| exit 1 | |
| fi | |
| SIZE=$(stat -c%s "$WASM_FILE") | |
| LIMIT=512000 | |
| echo "WASM size: ${SIZE} bytes (${LIMIT} byte limit)" | |
| if [ "$SIZE" -gt "$LIMIT" ]; then | |
| echo "Error: WASM size exceeds 500 KB budget" | |
| exit 1 | |
| fi | |
| shell: bash | |
| - name: Upload dist artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist | |
| path: dist/ | |
| deploy: | |
| name: Deploy | |
| if: | | |
| !contains(github.event.head_commit.message, '[ci-skip]') && | |
| !contains(github.event.pull_request.title, '[ci-skip]') | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| steps: | |
| - name: Download dist artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dist | |
| path: dist | |
| - id: deploy | |
| name: Deploy to Cloudflare Pages | |
| uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy dist --project-name=xodiumorg --branch=${{ github.ref_name }} --commit-dirty=true |