mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 14:28:42 +00:00
Migrate CI and builds to Just, add "full" builds (#660)
This commit is contained in:
parent
305bf8123d
commit
aea9df602c
30 changed files with 717 additions and 463 deletions
52
.github/actions/just-setup/action.yml
vendored
Normal file
52
.github/actions/just-setup/action.yml
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
name: Setup tools and cache
|
||||
inputs:
|
||||
tools:
|
||||
description: Extra tools
|
||||
required: false
|
||||
default: ""
|
||||
cache:
|
||||
description: Enable caches
|
||||
required: true
|
||||
default: true
|
||||
type: boolean
|
||||
cache-suffix:
|
||||
description: Suffix for cache key
|
||||
required: false
|
||||
default: ""
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- if: inputs.tools == ''
|
||||
name: Install just
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: just
|
||||
- if: inputs.tools != ''
|
||||
name: Install just and tools
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: just,${{ inputs.tools }}
|
||||
|
||||
- if: inputs.cache
|
||||
name: Configure index cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.cache-suffix }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-
|
||||
${{ runner.os }}-cargo-index-
|
||||
|
||||
- if: inputs.cache
|
||||
name: Configure build cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.cache-suffix }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}-
|
|
@ -1,13 +0,0 @@
|
|||
[package]
|
||||
name = "cargo-binstall"
|
||||
description = "Rust binary package installer for CI integration"
|
||||
repository = "https://bitbucket.org/nobodyxusdcdc/hello-world"
|
||||
version = "0.12.0"
|
||||
rust-version = "1.61.0"
|
||||
authors = ["ryan <ryan@kurte.nz>"]
|
||||
edition = "2021"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[[bin]]
|
||||
name = "cargo-binstall"
|
||||
path = "src/main.rs"
|
|
@ -1,13 +0,0 @@
|
|||
[package]
|
||||
name = "cargo-binstall"
|
||||
description = "Rust binary package installer for CI integration"
|
||||
repository = "https://github.com/cargo-bins/cargo-binstall"
|
||||
version = "0.12.0"
|
||||
rust-version = "1.61.0"
|
||||
authors = ["ryan <ryan@kurte.nz>"]
|
||||
edition = "2021"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[[bin]]
|
||||
name = "cargo-binstall"
|
||||
path = "src/main.rs"
|
|
@ -1,16 +0,0 @@
|
|||
[package]
|
||||
name = "cargo-binstall"
|
||||
description = "Rust binary package installer for CI integration"
|
||||
repository = "https://github.com/cargo-bins/cargo-binstall"
|
||||
version = "0.12.0"
|
||||
rust-version = "1.61.0"
|
||||
authors = ["ryan <ryan@kurte.nz>"]
|
||||
edition = "2021"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[package.metadata.binstall]
|
||||
bin-dir = "{ bin }{ binary-ext }"
|
||||
|
||||
[[bin]]
|
||||
name = "cargo-binstall"
|
||||
path = "src/main.rs"
|
|
@ -1,13 +0,0 @@
|
|||
[package]
|
||||
name = "cargo-binstall"
|
||||
description = "Rust binary package installer for CI integration"
|
||||
repository = "https://gitlab.kitware.com/NobodyXu/hello-world"
|
||||
version = "0.2.0"
|
||||
rust-version = "1.61.0"
|
||||
authors = ["ryan <ryan@kurte.nz>"]
|
||||
edition = "2021"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[[bin]]
|
||||
name = "cargo-binstall"
|
||||
path = "src/main.rs"
|
4
.github/scripts/fake-cargo/cargo
vendored
4
.github/scripts/fake-cargo/cargo
vendored
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo Always returns 1 to prevent use of "cargo-build"
|
||||
exit 1
|
6
.github/scripts/install-deps.sh
vendored
6
.github/scripts/install-deps.sh
vendored
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
apt update
|
||||
exec apt install -y --no-install-recommends liblzma-dev libzip-dev libzstd-dev
|
17
.github/scripts/pack-release-archives.sh
vendored
17
.github/scripts/pack-release-archives.sh
vendored
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
for o in outputs/*; do
|
||||
pushd "$o"
|
||||
|
||||
chmod +x cargo-binstall*
|
||||
|
||||
target=$(basename "$o" | cut -d. -f1)
|
||||
if grep -qE '(apple|windows)' <<< "$target"; then
|
||||
zip -9 "../cargo-binstall-${target}.zip" *
|
||||
else
|
||||
tar cv * | gzip -9 > "../cargo-binstall-${target}.tgz"
|
||||
fi
|
||||
|
||||
popd
|
||||
done
|
126
.github/scripts/tests.sh
vendored
126
.github/scripts/tests.sh
vendored
|
@ -1,126 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
unset CARGO_INSTALL_ROOT
|
||||
|
||||
crates="b3sum cargo-release cargo-binstall cargo-watch miniserve sccache"
|
||||
|
||||
if [ "$2" = "Windows" ]; then
|
||||
# Install binaries using cargo-binstall
|
||||
# shellcheck disable=SC2086
|
||||
"./$1" --log-level debug --no-confirm $crates
|
||||
else
|
||||
export CARGO_HOME=/tmp/cargo-home-for-test
|
||||
export PATH="$CARGO_HOME/bin:/tmp/t/bin:$PATH"
|
||||
|
||||
mkdir -p "/tmp/t/bin"
|
||||
# Copy it to bin to test use of env var `CARGO`
|
||||
cp "./$1" "/tmp/t/bin/cargo-binstall"
|
||||
|
||||
# Install binaries using cargo-binstall
|
||||
# shellcheck disable=SC2086
|
||||
cargo binstall --log-level debug --no-confirm $crates
|
||||
|
||||
rm -r /tmp/t
|
||||
fi
|
||||
|
||||
# Test that the installed binaries can be run
|
||||
b3sum --version
|
||||
cargo-release release --version
|
||||
cargo-binstall --help >/dev/null
|
||||
cargo binstall --help >/dev/null
|
||||
cargo watch -V
|
||||
miniserve -V
|
||||
|
||||
test_resources=".github/scripts/cargo-tomls"
|
||||
|
||||
# Install binaries using `--manifest-path`
|
||||
# Also test default github template
|
||||
"./$1" binstall --force --log-level debug --manifest-path "$test_resources/github-test-Cargo.toml" --no-confirm cargo-binstall
|
||||
# Test that the installed binaries can be run
|
||||
cargo binstall --help >/dev/null
|
||||
|
||||
# FIXME: test this some other way that is not dependent on the version being published!
|
||||
# "./$1" binstall --force --log-level debug --manifest-path crates/bin --no-confirm cargo-binstall
|
||||
|
||||
min_tls=1.3
|
||||
[[ "${2:-}" == "Windows" ]] && min_tls=1.2 # WinTLS on GHA doesn't support 1.3 yet
|
||||
|
||||
"./$1" binstall \
|
||||
--force \
|
||||
--log-level debug \
|
||||
--min-tls-version $min_tls \
|
||||
--no-confirm \
|
||||
cargo-binstall
|
||||
# Test that the installed binaries can be run
|
||||
cargo binstall --help >/dev/null
|
||||
|
||||
# Test --version
|
||||
"./$1" binstall --force --log-level debug --no-confirm --version 0.11.1 cargo-binstall
|
||||
# Test that the installed binaries can be run
|
||||
cargo binstall --help >/dev/null
|
||||
|
||||
# Test "$crate_name@$version"
|
||||
"./$1" binstall --force --log-level debug --no-confirm cargo-binstall@0.11.1
|
||||
# Test that the installed binaries can be run
|
||||
cargo binstall --help >/dev/null
|
||||
|
||||
# Test skip when installed
|
||||
"./$1" binstall --no-confirm --force cargo-binstall@0.11.1
|
||||
"./$1" binstall --no-confirm cargo-binstall@0.11.1 | grep -q 'cargo-binstall v0.11.1 is already installed'
|
||||
|
||||
"./$1" binstall --no-confirm cargo-binstall@0.10.0 | grep -q -v 'cargo-binstall v0.10.0 is already installed'
|
||||
|
||||
## Test When 0.11.0 is installed but can be upgraded.
|
||||
"./$1" binstall --no-confirm cargo-binstall@0.12.0
|
||||
"./$1" binstall --no-confirm cargo-binstall@0.12.0 | grep -q 'cargo-binstall v0.12.0 is already installed'
|
||||
"./$1" binstall --no-confirm cargo-binstall@^0.12.0 | grep -q -v 'cargo-binstall v0.12.0 is already installed'
|
||||
|
||||
# Test default GitLab pkg-url templates
|
||||
"./$1" binstall \
|
||||
--force \
|
||||
--manifest-path "$test_resources/gitlab-test-Cargo.toml" \
|
||||
--log-level debug \
|
||||
--no-confirm \
|
||||
--disable-strategies compile \
|
||||
cargo-binstall
|
||||
|
||||
# Test default BitBucket pkg-url templates
|
||||
"./$1" binstall \
|
||||
--force \
|
||||
--manifest-path "$test_resources/bitbucket-test-Cargo.toml" \
|
||||
--log-level debug \
|
||||
--no-confirm \
|
||||
--disable-strategies compile \
|
||||
cargo-binstall
|
||||
|
||||
# Test default Github pkg-url templates,
|
||||
# with bin-dir provided
|
||||
"./$1" binstall \
|
||||
--force \
|
||||
--manifest-path "$test_resources/github-test-Cargo2.toml" \
|
||||
--log-level debug \
|
||||
--no-confirm \
|
||||
--disable-strategies compile \
|
||||
cargo-binstall
|
||||
|
||||
## Test --disable-strategies
|
||||
set +e
|
||||
|
||||
"./$1" binstall --no-confirm --disable-strategies quick-install,compile cargo-update
|
||||
exit_code="$?"
|
||||
|
||||
if [ "$exit_code" != 94 ]; then
|
||||
echo "Expected exit code 94, but actual exit code $exit_code"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Test --strategies
|
||||
"./$1" binstall --no-confirm --strategies crate-meta-data cargo-update
|
||||
exit_code="$?"
|
||||
|
||||
if [ "$exit_code" != 94 ]; then
|
||||
echo "Expected exit code 94, but actual exit code $exit_code"
|
||||
exit 1
|
||||
fi
|
149
.github/workflows/build.yml
vendored
149
.github/workflows/build.yml
vendored
|
@ -1,149 +0,0 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
for_release:
|
||||
description: "True if the build is for a release"
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
for_release:
|
||||
description: "True if the build is for a release"
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
os: ubuntu-20.04
|
||||
debug_features: [ rustls, pkg-config ]
|
||||
- target: x86_64-apple-darwin
|
||||
os: macos-latest
|
||||
- target: aarch64-apple-darwin
|
||||
os: macos-latest
|
||||
- target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
debug_features: [ native-tls ]
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
- target: armv7-unknown-linux-musleabihf
|
||||
os: ubuntu-20.04
|
||||
use-cross: true
|
||||
- target: armv7-unknown-linux-gnueabihf
|
||||
os: ubuntu-20.04
|
||||
use-cross: true
|
||||
- target: aarch64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
use-cross: true
|
||||
- target: aarch64-unknown-linux-gnu
|
||||
os: ubuntu-20.04
|
||||
use-cross: true
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.target }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Configure toolchain
|
||||
run: |
|
||||
rustup toolchain install --profile minimal --no-self-update nightly
|
||||
rustup default nightly
|
||||
|
||||
- name: Install cross
|
||||
if: matrix.use-cross
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cross
|
||||
|
||||
- name: Install host target
|
||||
if: "!matrix.use-cross"
|
||||
run: rustup target add ${{ matrix.target }}
|
||||
|
||||
- name: Install rust-src
|
||||
if: inputs.for_release
|
||||
run: rustup component add rust-src
|
||||
|
||||
- name: Select compile settings
|
||||
shell: bash
|
||||
run: |
|
||||
jq \
|
||||
--argjson for_release '${{ toJSON(inputs.for_release) }}' \
|
||||
--argjson matrix '${{ toJSON(matrix) }}' \
|
||||
-nrf .github/scripts/compile-settings.jq \
|
||||
| tee -a $GITHUB_ENV
|
||||
|
||||
- name: Configure caching
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}-${{ env.COUTPUT }}
|
||||
|
||||
- name: Install musl-tools
|
||||
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
|
||||
run: sudo apt-get install -y musl-tools
|
||||
|
||||
- name: Install deps
|
||||
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && !startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: sudo .github/scripts/install-deps.sh
|
||||
|
||||
- name: Build
|
||||
run: ${{ env.CTOOL }} build ${{ env.CARGS }}
|
||||
env:
|
||||
RUSTFLAGS: ${{ env.RUSTFLAGS }}
|
||||
|
||||
- name: Get output
|
||||
shell: bash
|
||||
run: |
|
||||
cp target/${{ matrix.target }}/${{ env.COUTPUT }}/${{ env.CBIN }} ${{ env.CBIN }}
|
||||
chmod +x ${{ env.CBIN }} || true
|
||||
ls -l ${{ env.CBIN }}
|
||||
|
||||
- name: Upload output
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
retention-days: 1
|
||||
name: "${{ matrix.target }}.${{ env.CBIN }}"
|
||||
path: "${{ env.CBIN }}"
|
||||
macos_universal_bin:
|
||||
needs: build
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
aarch64: aarch64-apple-darwin.cargo-binstall
|
||||
x86_64: x86_64-apple-darwin.cargo-binstall
|
||||
steps:
|
||||
- name: Download aarch64 artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.aarch64 }}
|
||||
path: ${{ env.aarch64 }}
|
||||
- name: Download x86-64 artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.x86_64 }}
|
||||
path: ${{ env.x86_64 }}
|
||||
- name: Create universal binary for MacOS
|
||||
run: lipo -create -output cargo-binstall $aarch64/cargo-binstall $x86_64/cargo-binstall
|
||||
- name: Upload output
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
retention-days: 1
|
||||
name: universal-apple-darwin.cargo-binstall
|
||||
path: cargo-binstall
|
119
.github/workflows/ci.yml
vendored
Normal file
119
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-apple-darwin
|
||||
os: macos-latest
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
os: ubuntu-latest
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
- target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
CARGO_BUILD_TARGET: ${{ matrix.target }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/just-setup
|
||||
with:
|
||||
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
||||
|
||||
- run: just toolchain
|
||||
- run: just ci-install-deps
|
||||
- run: just test
|
||||
|
||||
linux-cross-check:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- armv7-unknown-linux-musleabihf
|
||||
- armv7-unknown-linux-gnueabihf
|
||||
- aarch64-unknown-linux-musl
|
||||
- aarch64-unknown-linux-gnu
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CARGO_BUILD_TARGET: ${{ matrix.target }}
|
||||
JUST_USE_CROSS: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/just-setup
|
||||
with:
|
||||
tools: cross
|
||||
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
||||
|
||||
- run: just toolchain
|
||||
- run: just ci-install-deps
|
||||
- run: just check
|
||||
|
||||
apple-m1-check:
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
CARGO_BUILD_TARGET: aarch64-apple-darwin
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/just-setup
|
||||
with:
|
||||
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
|
||||
|
||||
- run: just toolchain
|
||||
- run: just check
|
||||
|
||||
lint:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/just-setup
|
||||
|
||||
- run: just toolchain rustfmt,clippy
|
||||
- run: just ci-install-deps
|
||||
- run: just lint
|
||||
|
||||
# Dummy job to have a stable name for the "all tests pass" requirement
|
||||
tests-pass:
|
||||
name: Tests pass
|
||||
needs:
|
||||
- test
|
||||
- linux-cross-check
|
||||
- apple-m1-check
|
||||
- lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "Tests pass"
|
||||
|
||||
# if everything succeeds and PR is ready for review, test the release/package process
|
||||
release-builds:
|
||||
if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || github.event_name == 'workflow_dispatch'
|
||||
needs:
|
||||
- tests-pass
|
||||
uses: ./.github/workflows/release-build.yml
|
54
.github/workflows/integration.yml
vendored
54
.github/workflows/integration.yml
vendored
|
@ -1,54 +0,0 @@
|
|||
name: Integration
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
for_release: false
|
||||
|
||||
test:
|
||||
needs: build
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-apple-darwin
|
||||
os: macos-latest
|
||||
bin: cargo-binstall
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
os: ubuntu-latest
|
||||
bin: cargo-binstall
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
bin: cargo-binstall
|
||||
- target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
bin: cargo-binstall.exe
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Download build
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: "${{ matrix.target }}.${{ matrix.bin }}"
|
||||
|
||||
- run: chmod +x ${{ matrix.bin }}
|
||||
if: matrix.os != 'windows-latest'
|
||||
|
||||
- name: Test
|
||||
shell: bash
|
||||
run: .github/scripts/tests.sh ${{ matrix.bin }} ${{ runner.os }}
|
||||
|
119
.github/workflows/release-build.yml
vendored
Normal file
119
.github/workflows/release-build.yml
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
name: Build for release
|
||||
|
||||
on:
|
||||
workflow_dispatch: # can't publish from dispatch
|
||||
workflow_call:
|
||||
inputs:
|
||||
publish:
|
||||
description: "Set to the release metadata JSON to publish the release"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { o: macos-latest, t: x86_64-apple-darwin }
|
||||
- { o: macos-latest, t: aarch64-apple-darwin }
|
||||
- { o: ubuntu-20.04, t: x86_64-unknown-linux-gnu }
|
||||
- { o: ubuntu-20.04, t: armv7-unknown-linux-gnueabihf, c: true }
|
||||
- { o: ubuntu-20.04, t: aarch64-unknown-linux-gnu, c: true }
|
||||
- { o: ubuntu-latest, t: x86_64-unknown-linux-musl }
|
||||
- { o: ubuntu-latest, t: armv7-unknown-linux-musleabihf, c: true }
|
||||
- { o: ubuntu-latest, t: aarch64-unknown-linux-musl, c: true }
|
||||
- { o: windows-latest, t: x86_64-pc-windows-msvc }
|
||||
- { o: windows-latest, t: aarch64-pc-windows-msvc }
|
||||
|
||||
name: ${{ matrix.t }}
|
||||
runs-on: ${{ matrix.o }}
|
||||
env:
|
||||
CARGO_BUILD_TARGET: ${{ matrix.t }}
|
||||
JUST_USE_CROSS: ${{ matrix.c }}
|
||||
JUST_FOR_RELEASE: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/just-setup
|
||||
with:
|
||||
tools: cross
|
||||
cache-suffix: release-${{ matrix.t }}
|
||||
|
||||
- run: just toolchain rust-src
|
||||
- run: just ci-install-deps
|
||||
- run: just package
|
||||
- if: runner.os == 'Windows'
|
||||
run: Get-ChildItem packages/
|
||||
- if: runner.os != 'Windows'
|
||||
run: ls -shal packages/
|
||||
|
||||
- if: ${{ inputs.publish }}
|
||||
name: Publish release
|
||||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
|
||||
with:
|
||||
tag_name: ${{ fromJSON(inputs.publish).version }}
|
||||
name: ${{ fromJSON(inputs.publish).version }}
|
||||
body: ${{ fromJSON(inputs.publish).notes }}
|
||||
append_body: false
|
||||
files: |
|
||||
packages/cargo-binstall-*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- if: ${{ !inputs.publish || runner.os == 'macOS' }}
|
||||
name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.t }}
|
||||
path: packages/cargo-binstall-*
|
||||
retention-days: 1
|
||||
|
||||
lipo:
|
||||
needs: build
|
||||
name: universal-apple-darwin
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
JUST_FOR_RELEASE: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/just-setup
|
||||
with:
|
||||
cache: false
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: x86_64-apple-darwin
|
||||
path: packages/
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: aarch64-apple-darwin
|
||||
path: packages/
|
||||
|
||||
- run: ls -shalr packages/
|
||||
- run: just repackage-lipo
|
||||
- run: ls -shal packages/
|
||||
|
||||
- if: ${{ inputs.publish }}
|
||||
name: Publish release
|
||||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
|
||||
with:
|
||||
tag_name: ${{ fromJSON(inputs.publish).version }}
|
||||
name: ${{ fromJSON(inputs.publish).version }}
|
||||
body: ${{ fromJSON(inputs.publish).notes }}
|
||||
append_body: false
|
||||
files: |
|
||||
packages/cargo-binstall-universal-*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- if: ${{ !inputs.publish }}
|
||||
name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: universal-apple-darwin
|
||||
path: packages/cargo-binstall-universal-*
|
||||
retention-days: 1
|
41
.github/workflows/release.yml
vendored
41
.github/workflows/release.yml
vendored
|
@ -49,40 +49,11 @@ jobs:
|
|||
custom_tag: ${{ needs.info.outputs.version }}
|
||||
tag_prefix: ''
|
||||
|
||||
build:
|
||||
if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
|
||||
needs: info # not really, but just so it fails fast
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
for_release: true
|
||||
|
||||
release:
|
||||
package:
|
||||
if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
|
||||
needs:
|
||||
- info
|
||||
- tag
|
||||
- build
|
||||
name: Package and release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Get outputs
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: outputs/
|
||||
|
||||
- name: Pack archives
|
||||
run: .github/scripts/pack-release-archives.sh
|
||||
|
||||
- name: Publish release
|
||||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
|
||||
with:
|
||||
tag_name: ${{ needs.info.outputs.version }}
|
||||
name: ${{ needs.info.outputs.version }}
|
||||
body: ${{ needs.info.outputs.notes }}
|
||||
append_body: true
|
||||
files: |
|
||||
outputs/cargo-binstall-*.zip
|
||||
outputs/cargo-binstall-*.tgz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- info
|
||||
- tag
|
||||
uses: ./.github/workflows/release-build.yml
|
||||
with:
|
||||
publish: ${{ toJSON(needs.info.outputs) }}
|
||||
|
|
61
.github/workflows/unit-tests.yml
vendored
61
.github/workflows/unit-tests.yml
vendored
|
@ -1,61 +0,0 @@
|
|||
name: Unit tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- macos
|
||||
- ubuntu
|
||||
- windows
|
||||
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
name: unit tests on ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure toolchain
|
||||
run: |
|
||||
rustup toolchain install nightly --component rustfmt,clippy --no-self-update --profile minimal
|
||||
rustup default nightly
|
||||
|
||||
- name: Configure caching
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-unit-tests-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-unit-tests
|
||||
|
||||
- name: Install deps
|
||||
if: matrix.os == 'ubuntu'
|
||||
run: sudo .github/scripts/install-deps.sh
|
||||
|
||||
- name: Test (Unix)
|
||||
if: matrix.os != 'windows'
|
||||
run: cargo test --no-default-features --features pkg-config,native-tls
|
||||
|
||||
- name: Test (Windows)
|
||||
if: matrix.os == 'windows'
|
||||
run: cargo test --no-default-features --features native-tls
|
||||
|
||||
- name: fmt
|
||||
run: cargo fmt --all --check
|
||||
|
||||
- name: clippy
|
||||
run: cargo clippy --no-deps -- -D clippy::all
|
Loading…
Add table
Add a link
Reference in a new issue