Skip to content

A bunch of CI improvements #5

A bunch of CI improvements

A bunch of CI improvements #5

Workflow file for this run

name: CD
on:
push:
branches: [main]
pull_request: # TODO: Don't do this on PR's
workflow_dispatch:
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
updater: ${{ steps.filter.outputs.updater }}
rust: ${{ steps.filter.outputs.rust }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
updater:
- 'apps/updater/**'
rust:
- 'apps/mattrax/**'
- 'apps/mattraxd/**'
- 'apps/mttx/**'
- 'crates/**'
- Cargo.toml
- Cargo.lock
updater:
name: Updater
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.updater == 'true' }}
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Deploy to Deno Deploy
uses: denoland/deployctl@v1
with:
project: mattrax-updater
entrypoint: src/main.ts
root: apps/updater
rust:
name: Rust
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.updater == 'true' }}
strategy:
matrix:
target:
[
aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
aarch64-apple-darwin,
x86_64-apple-darwin,
x86_64-pc-windows-gnu,
]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- name: Install Zig toolchain
uses: korandoru/setup-zig@v1
with:
zig-version: 0.12.0
- name:
Install 'cargo-zigbuild'
# The Rust cache action is not happy with `cargo bininstall` so we do a manual install.
run: |
curl -s https://api.github.com/repos/rust-cross/cargo-zigbuild/releases/latest \
| grep "browser_download_url.*.x86_64-unknown-linux-musl.tar.gz\"" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
tar -xf cargo-zigbuild-*.tar.gz
mv cargo-zigbuild /usr/local/bin
- name: Add '${{ matrix.target }}' target
run: rustup target add ${{ matrix.target }}
- name: Build
run: cargo zigbuild --locked --release --target ${{ matrix.target }}
# TODO: Upload to R2
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: rust
steps:
- run: echo "Hello World"
# TODO: Cloudflare workers deploy