Skip to content

Commit

Permalink
Merge pull request #63 from pact-foundation/feat/musl_static_win_aarch64
Browse files Browse the repository at this point in the history
feat: linux musl static bins / windows aarch64
  • Loading branch information
rholshausen committed Apr 25, 2024
2 parents b7e4aba + efa86ca commit 3118495
Show file tree
Hide file tree
Showing 12 changed files with 631 additions and 386 deletions.
104 changes: 91 additions & 13 deletions .github/workflows/release.yml
Expand Up @@ -4,37 +4,115 @@ on:
release:
types: [published]

pull_request:
branches:
- master

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

jobs:
build-release:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
include:
- operating-system: ubuntu-20.04
targets: x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,aarch64-unknown-linux-gnu,aarch64-unknown-linux-musl
- operating-system: windows-2019
targets: aarch64-pc-windows-msvc,x86_64-pc-windows-msvc
- operating-system: macos-12
targets: aarch64-apple-darwin,x86_64-apple-darwin
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install stable Rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
target: aarch64-apple-darwin
targets: ${{ matrix.targets }}

- name: Rust caching
uses: Swatinem/rust-cache@v2
with:
workspaces: rust

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v3

- name: Cargo flags
id: cargo-flags
shell: bash
run: |
if [[ "${{ github.event_name }}" = "release" ]]; then
echo "flags=--release" >> "$GITHUB_OUTPUT"
else
echo "flags=" >> "$GITHUB_OUTPUT"
fi
- name: Install LLVM
run: choco install -y llvm
if: runner.os == 'Windows'
- if: runner.os == 'Linux'
run: ./scripts/release-linux.sh
- if: runner.os == 'Windows'
run: ./scripts/release-win.sh
shell: bash
- if: runner.os == 'macOS'
run: ./scripts/release-osx.sh

- name: build and release ${{ runner.os }}
run: ./release.sh ${{ runner.os }} ${{ steps.cargo-flags.outputs.flags }}
shell: bash

- name: Upload Release Assets
if: |
startsWith(github.ref, 'refs/tags/v')
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release_artifacts/*
file_glob: true
tag: ${{ github.ref }}

release_docker:
runs-on: ubuntu-latest
needs: build-release
if: |
startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Log into ghcr registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log into docker registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: push_image
id: cargo-flags
shell: bash
run: |
if [[ "${{ github.event_name }}" = "release" ]]; then
echo "PUSH_IMAGE=true" >> "$GITHUB_ENV"
fi
- name: Release image
run: cd docker && hooks/build
env:
DOCKER_TAG: ${{ github.ref }}
PUSH_IMAGE: ${{ env.PUSH_IMAGE }}
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
# Generated by Cargo
# will have compiled files and executables
/target/
# Generated Release Artifacts
release_artifacts
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Expand Down

0 comments on commit 3118495

Please sign in to comment.