Skip to content

Commit

Permalink
Merge pull request #12 from fpco/release-artifacts
Browse files Browse the repository at this point in the history
Github action for release artifacts
  • Loading branch information
snoyberg authored Oct 3, 2023
2 parents 8388907 + c29f5ff commit 2be0445
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10

jobs:
checks:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest

toolchain:
- 1.71.0

steps:
- uses: actions/checkout@v2
- uses: extractions/setup-just@v1
with:
just-version: 1.10.0
- uses: cargo-bins/cargo-binstall@main
- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-${{ matrix.toolchain }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Install musl tools
run: |
sudo apt-get install -y musl-tools
rustup target add x86_64-unknown-linux-musl
cargo binstall cross --no-confirm
- name: Build Musl binary
run: just build-release-binary
- name: Build other binaryies
run: just binaries true
- name: Generate artifacts
run: just cp-binaries
- uses: actions/upload-artifact@v3
with:
name: binaries
path: artifacts/*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/*
generate_release_notes: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ and use it in your container directly. Example:
``` dockerfile
FROM alpine:3.14.2

ADD FIXME_LINK /usr/bin/pid1
ADD https://github.com/fpco/pid1-rs/releases/download/v0.1.0/pid1-x86_64-unknown-linux-musl /usr/bin/pid1

RUN chmod +x /usr/bin/pid1

Expand Down
43 changes: 43 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,46 @@ test-init-image:
# Exec init image
exec-init-image:
docker run --rm --name pid --tty --interactive pid1runner sh

# Build binary for other architectures
binaries clean='false':
cross build --target x86_64-unknown-linux-gnu --release
cross build --target aarch64-unknown-linux-gnu --release
cross build --target aarch64-unknown-linux-musl --release
cross build --target arm-unknown-linux-musleabi --release
cross build --target arm-unknown-linux-musleabihf --release
cross build --target armv5te-unknown-linux-musleabi --release
cross build --target armv7-unknown-linux-musleabi --release
cross build --target armv7-unknown-linux-musleabihf --release
cross build --target i586-unknown-linux-musl --release
cross build --target i686-unknown-linux-musl --release
{{clean}} && docker image rm ghcr.io/cross-rs/x86_64-unknown-linux-gnu:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/aarch64-unknown-linux-gnu:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/aarch64-unknown-linux-musl:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/arm-unknown-linux-musleabi:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/arm-unknown-linux-musleabihf:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/armv5te-unknown-linux-musleabi:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/armv7-unknown-linux-musleabi:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/armv7-unknown-linux-musleabihf:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/i586-unknown-linux-musl:0.2.5
{{clean}} && docker image rm ghcr.io/cross-rs/i686-unknown-linux-musl:0.2.5
cross build --target mips64-unknown-linux-muslabi64 --release
cross build --target mips64el-unknown-linux-muslabi64 --release

# Copy binaries to artifacts directory
cp-binaries:
mkdir -p artifacts
cp target/x86_64-unknown-linux-musl/release/pid1 ./artifacts/pid1-x86_64-unknown-linux-musl
cp target/x86_64-unknown-linux-gnu/release/pid1 ./artifacts/pid1-x86_64-unknown-linux-gnu
cp target/aarch64-unknown-linux-gnu/release/pid1 ./artifacts/pid1-aarch64-unknown-linux-gnu
cp target/aarch64-unknown-linux-musl/release/pid1 ./artifacts/pid1-aarch64-unknown-linux-musl
cp target/arm-unknown-linux-musleabi/release/pid1 ./artifacts/pid1-arm-unknown-linux-musleabi
cp target/arm-unknown-linux-musleabihf/release/pid1 ./artifacts/pid1-arm-unknown-linux-musleabihf
cp target/armv5te-unknown-linux-musleabi/release/pid1 ./artifacts/pid1-armv5te-unknown-linux-musleabi
cp target/armv7-unknown-linux-musleabi/release/pid1 ./artifacts/pid1-armv7-unknown-linux-musleabi
cp target/armv7-unknown-linux-musleabihf/release/pid1 ./artifacts/pid1-armv7-unknown-linux-musleabihf
cp target/i586-unknown-linux-musl/release/pid1 ./artifacts/pid1-i586-unknown-linux-musl
cp target/i686-unknown-linux-musl/release/pid1 ./artifacts/pid1-i686-unknown-linux-musl
cp target/mips64-unknown-linux-muslabi64/release/pid1 ./artifacts/pid1-mips64-unknown-linux-muslabi64
cp target/mips64el-unknown-linux-muslabi64/release/pid1 ./artifacts/pid1-mips64el-unknown-linux-muslabi64
file artifacts/*

0 comments on commit 2be0445

Please sign in to comment.