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 5, 2024
1 parent afa44e0 commit b3d7f4c
Show file tree
Hide file tree
Showing 10 changed files with 593 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", "--"]
48 changes: 39 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,43 @@ 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: src/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
path: src/html

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.parcel-cache
/node_modules
/src/html/assets.rs
/target
/ui/dist
Loading

0 comments on commit b3d7f4c

Please sign in to comment.