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