Skip to content

Commit

Permalink
Move from a build script to xtasks
Browse files Browse the repository at this point in the history
A build script is great if the assets are guaranteed to be available,
but they would not be available once packaged and uploaded to a
registry.

Instead, this commit moves us to a system where `cargo xtask assets`
will generate the appropriate Rust file. This file can be checked in
immediately before a release is tagged and can then be a part of the
package.
  • Loading branch information
shepmaster committed May 3, 2024
1 parent f0fe238 commit 873a82c
Show file tree
Hide file tree
Showing 9 changed files with 590 additions and 128 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --"
47 changes: 38 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@ name: Continuous integration
on: [push, pull_request]

jobs:
check:
name: Build and test

assets:
name: Build assets
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.77 # MSRV
- stable
- nightly

steps:
- name: Checkout code
Expand Down Expand Up @@ -50,6 +43,42 @@ jobs:
- name: Format UI assets
run: pnpm fmt:check

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 'stable'

- name: Convert assets to Rust
run: cargo xtask assets

- name: Upload assets
uses: actions/upload-artifact@v4
with:
name: assets
path: srs/html/assets.rs

check:
name: Build and test

runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.77 # MSRV
- stable
- nightly

needs: assets

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download assets
uses: actions/download-artifact@v4
with:
name: assets

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
Expand Down
Loading

0 comments on commit 873a82c

Please sign in to comment.