Skip to content

Commit

Permalink
chore: share builds across gha (#3120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Nov 21, 2024
1 parent 3a02b42 commit 86e9f72
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 42 deletions.
4 changes: 0 additions & 4 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
[env]
RUST_TEST_THREADS = '1'

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
5 changes: 2 additions & 3 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ env:
RUST_BACKTRACE: 1
NPM_CONFIG_FUND: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS: -C link-arg=-fuse-ld=mold

jobs:
autofix:
Expand All @@ -30,9 +32,6 @@ jobs:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
with:
shared-key: test-ubuntu-latest
save-if: false
- run: |
cargo build --all-features
echo "$PWD/target/debug" >> "$GITHUB_PATH"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/hyperfine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.RTX_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
MISE_EXPERIMENTAL: 1
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS: -C link-arg=-fuse-ld=mold

permissions:
pull-requests: write
Expand All @@ -36,7 +38,7 @@ jobs:
echo "release=$(mise-release v | awk '{print $1}')" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: $HOME/bin/mise-${{ steps.versions.outputs.main }}
path: ~/bin/mise-${{ steps.versions.outputs.main }}
key: mise-hyperfine-main-${{ steps.versions.outputs.main }}-${{ runner.os }}
- name: build main
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-fig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
with:
shared-key: test-ubuntu-latest
shared-key: build
save-if: false
- run: mkdir -p "$HOME/bin" && echo "$HOME/bin" >> "$GITHUB_PATH"
- run: cargo build --all-features && cp target/debug/mise "$HOME"/bin
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ jobs:
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
with:
shared-key: test-ubuntu-latest
save-if: false
shared-key: build
- run: mkdir -p "$HOME/bin" && echo "$HOME/bin" >> "$GITHUB_PATH"
- run: cargo build --all-features && cp target/debug/mise "$HOME"/bin
- run: mise install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: test-ubuntu-latest
shared-key: build
save-if: false
- uses: rui314/setup-mold@v1
- run: scripts/build-tarball.sh x86_64-unknown-linux-gnu
- uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ repos:
rev: v1.7.4
hooks:
- id: actionlint
args: ["-shellcheck", ""]
- repo: https://github.com/kykosic/pre-commit-rust
rev: 0.4.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ shfmt = "3"
jq = "latest"
cargo-binstall = "latest"
"cargo:cargo-edit" = "latest"
"cargo:cargo-show" = {version = "latest", os = ["linux", "macos"]}
"cargo:cargo-show" = { version = "latest", os = ["linux", "macos"] }
"cargo:cargo-insta" = "latest"
"cargo:git-cliff" = "latest"
"npm:markdownlint-cli" = "latest"
"npm:prettier" = "3"
actionlint = "latest"
ripgrep = "latest"
"pipx:toml-sort" = "latest"
"cargo:usage-cli" = {version = "1.3", os = ["linux", "macos"]}
"cargo:usage-cli" = { version = "1.3", os = ["linux", "macos"] }
bun = "latest"
#python = { version = "latest", virtualenv = "{{env.HOME}}/.cache/venv" }

Expand Down
2 changes: 1 addition & 1 deletion tasks/lint-fix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ shfmt -w -i 2 -ci -bn "${scripts_dirs[@]}"
prettier -w $(git ls-files '*.yml' '*.yaml')
prettier -w .
markdownlint --fix .
actionlint
SHELLCHECK_OPTS="--exclude=SC1090" actionlint
toml-sort -i settings.toml --spaces-indent-inline-array 4
toml-sort -i registry.toml --spaces-indent-inline-array 4

Expand Down
1 change: 1 addition & 0 deletions tasks/lint/actionlint
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail

export SHELLCHECK_OPTS="--exclude=SC1090"
actionlint
28 changes: 3 additions & 25 deletions tasks/test/coverage
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,19 @@ echo "::group::Setup"
set -euxo pipefail
# shellcheck disable=SC1090
source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov clean --workspace
if [[ -n ${MISE_GITHUB_BOT_TOKEN:-} ]]; then
export GITHUB_API_TOKEN="$MISE_GITHUB_BOT_TOKEN"
fi
export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$PWD/target}"
export PATH="${CARGO_TARGET_DIR}/debug:$PATH"

echo "::group::Build w/ coverage"
cargo build -q --all-features
echo "::endgroup::"
echo "::group::mise install"
mise install
mise x -- bun i
echo "::endgroup::"
if [[ ${TEST_TRANCHE:-} == 8 ]]; then
cp target/debug/{mise,mise-backup}
echo "::group::Unit tests"
cargo test --all-features
echo "::group::Self update"
# pick a version from the previous month because the current release might not have been published yet
y=$(date +%Y)
m=$(($(date +%m) - 1))
if [[ $m -eq 0 ]]; then
m=12
y=$((y - 1))
fi
mise self-update -fy "$y.$m.0" || true
cp target/debug/{mise-backup,mise}
echo "::group::Implode"
mise implode
cp target/debug/{mise-backup,mise}
else
mise x -- ./e2e/run_all_tests
echo "::group::mist test-tool"
mise test-tool --all
fi
mise x -- ./e2e/run_all_tests
echo "::group::mise test-tool"
mise test-tool --all
echo "::group::Render lcov report"
cargo llvm-cov report --lcov --output-path "coverage-${TEST_TRANCHE:-}.lcov"

0 comments on commit 86e9f72

Please sign in to comment.