chore: share builds across gha (#3120)

This commit is contained in:
jdx 2024-11-21 11:41:13 -06:00 committed by GitHub
parent 3a02b427f5
commit 86e9f72fae
11 changed files with 17 additions and 42 deletions

View File

@ -1,6 +1,2 @@
[env]
RUST_TEST_THREADS = '1'
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=mold"]

View File

@ -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:
@ -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"

View File

@ -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
@ -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: |

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -10,7 +10,7 @@ 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"
@ -18,7 +18,7 @@ cargo-binstall = "latest"
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" }

View File

@ -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

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
export SHELLCHECK_OPTS="--exclude=SC1090"
actionlint

View File

@ -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"