Skip to content

Commit

Permalink
chore(ci): faster builds (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jssblck authored Dec 14, 2024
1 parent 0defd40 commit 8e33a95
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 26 deletions.
64 changes: 47 additions & 17 deletions .github/workflows/check-dynamic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,65 @@ name: dynamic
on: pull_request

jobs:
check-build:
check-test:
strategy:
matrix:
settings:
- host: windows-latest
setup: echo "no setup"
build: cargo build
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
- host: ubuntu-latest
setup: echo "no setup"
build: cargo build
target: x86_64-unknown-linux-musl
- host: macos-latest
setup: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
build: |
cargo build --target aarch64-apple-darwin
cargo build --target x86_64-apple-darwin
target: aarch64-apple-darwin
- host: macos-latest
target: x86_64-apple-darwin

runs-on: ${{ matrix.settings.host }}
name: test / ${{ matrix.settings.host }}
name: test / ${{ matrix.settings.host }} / ${{ matrix.settings.target }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- uses: taiki-e/install-action@nextest
- uses: Swatinem/[email protected]
with:
key: ${{ matrix.settings.host }}
- run: ${{ matrix.settings.setup }}
- run: ${{ matrix.settings.build }}
- run: cargo check --release --all --bins --examples --tests
key: test_${{ matrix.settings.host }}_${{ matrix.settings.target }}
- run: cargo nextest run --all-targets
- run: cargo test --doc

check-build:
strategy:
matrix:
settings:
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
- host: macos-latest
target: aarch64-apple-darwin
- host: macos-latest
target: x86_64-apple-darwin

runs-on: ${{ matrix.settings.host }}
name: build / ${{ matrix.settings.host }} / ${{ matrix.settings.target }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- uses: Swatinem/[email protected]
with:
key: build_${{ matrix.settings.host }}_${{ matrix.settings.target }}
- run: cargo check --all --bins --examples --tests
- run: cargo build
14 changes: 11 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.25.1/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.26.1/cargo-dist-installer.sh | sh"
- name: Cache dist
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -107,6 +107,7 @@ jobs:
# - N "local" tasks that build each platform's binaries and platform-specific installers
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container && matrix.container.image || null }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
Expand All @@ -117,8 +118,15 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust non-interactively if not already installed
if: ${{ matrix.container }}
run: |
if ! command -v cargo > /dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
fi
- name: Install dist
run: ${{ matrix.install_dist }}
run: ${{ matrix.install_dist.run }}
# Get the dist-manifest
- name: Fetch local artifacts
uses: actions/download-artifact@v4
Expand All @@ -143,7 +151,7 @@ jobs:
run: |
# Parse out what we just built and upload it to scratch storage
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## [0.3.3](https://github.com/fossas/circe/releases/tag/0.3.3)
## [v0.3.3](https://github.com/fossas/circe/releases/tag/v0.3.3)

_Released: 2024-12-14_

Expand Down
2 changes: 1 addition & 1 deletion bin/release.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tag-prefix = ""
shared-version = true
pre-release-hook = ["git", "cliff", "--workdir", "..", "-o", "../CHANGELOG.md", "--tag", "{{version}}" ]
pre-release-hook = ["git", "cliff", "--workdir", "..", "--tag", "{{version}}" ]
2 changes: 0 additions & 2 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ footer = """
"""

trim = true

render_always = true
output = "CHANGELOG.md"

[git]
Expand Down
4 changes: 2 additions & 2 deletions dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ members = ["cargo:."]
# Config for 'dist'
[dist]
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.25.1"
cargo-dist-version = "0.26.1"
# CI backends to support
ci = "github"
# The installers to generate for each app
installers = ["shell", "powershell"]
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
# Path that installers should place binaries in
install-path = "~/.circe/bin"
# Whether to install an updater program
Expand Down
8 changes: 8 additions & 0 deletions docs/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ if this is not realistic at minimum every non-bugfix release **must** ensure dep
> [!TIP]
> Requires `cargo-release` and `git-cliff` to be installed.
> [!NOTE]
> In order to have your changes integrate with the changelog,
> make sure to merge commits to `main` with a meaningful commit message.
>
> Additionally, if those commits are parseable as [conventional commits](https://www.conventionalcommits.org),
> they will be grouped into sections in the changelog.
> See the `cliff.toml` file for more details and group examples.
Use `cargo release` to create a release.
Since we cannot push to `main` directly, perform the steps below:

Expand Down

0 comments on commit 8e33a95

Please sign in to comment.