Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(capi): Add MUSL Support + SHA256 checksums #239

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 56 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,77 @@ jobs:
strategy:
matrix:
include:
# deactivated for now, the x86 workers are more expensive
# - os: macos-latest-large
# target_arch: x86_64-apple-darwin
- os: macos-13
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target_arch: x86_64-apple-darwin
arch: x86_64-macos
- os: macos-latest
target_arch: aarch64-apple-darwin
arch: arm64-macos
- os: ubuntu-latest
target_arch: x86_64-unknown-linux-gnu
arch: x86_64-linux
- os: ubuntu-latest
target_arch: x86_64-unknown-linux-musl
arch: x86_64-linux-musl
use_musl: true

steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install musl tools
if: matrix.use_musl
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target_arch }}
- name: Install cargo-c
run: cargo install cargo-c --version 0.10.5+cargo-0.83.0
- name: Install cargo-c (macOS)
if: startsWith(matrix.os, 'macos')
env:
LINK: https://github.com/lu-zero/cargo-c/releases/download
CARGO_C_FILE: cargo-c-macos.zip
CARGO_C_VERSION: v0.10.5
run: |
curl -L $LINK/$CARGO_C_VERSION/$CARGO_C_FILE -o cargo-c-macos.zip
unzip cargo-c-macos.zip -d ~/.cargo/bin
- name: Install cargo-c (Linux)
if: matrix.os == 'ubuntu-latest'
env:
LINK: https://github.com/lu-zero/cargo-c/releases/download
CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz
CARGO_C_VERSION: v0.10.5
run: |
curl -L $LINK/$CARGO_C_VERSION/$CARGO_C_FILE | tar xz -C ~/.cargo/bin
- name: Run cargo-c tests
run: cargo ctest --release --features="capi"
if: matrix.os == 'ubuntu-latest' && matrix.target_arch == 'x86_64-unknown-linux-gnu'
- name: Build C-API
run: cargo cinstall --release --prefix=/usr --destdir=./build --features="capi"

- name: Build C-API (Linux)
if: matrix.os == 'ubuntu-latest' && !matrix.use_musl
run: cargo cinstall --release --target ${{ matrix.target_arch }} --prefix=/usr --destdir=./build --features="capi"
- name: Build C-API (musl)
if: matrix.use_musl
run: |
cargo cinstall --target ${{ matrix.target_arch }} --release --prefix=/usr --destdir=./build --features="capi"
- name: Build C-API (macOS)
if: startsWith(matrix.os, 'macos')
run: |
cargo cinstall --target ${{ matrix.target_arch }} --release --prefix=/usr --destdir=./build --features="capi"

- name: Compress
run: tar cvzf biscuit_capi-${{github.ref_name}}-${{matrix.target_arch}}.tar.gz -C build/ .
run: tar cvzf biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz -C build/ .

- name: Generate checksum
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sha256sum "biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz" > "biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz.sha256"
else
shasum -a 256 "biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz" > "biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz.sha256"
fi
- name: Release
uses: softprops/action-gh-release@v1
with:
files: biscuit_capi-${{github.ref_name}}-${{matrix.target_arch}}.tar.gz
files: |
biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz
biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz.sha256
7 changes: 6 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ jobs:
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-c
run: cargo install cargo-c --version 0.10.5+cargo-0.83.0
env:
LINK: https://github.com/lu-zero/cargo-c/releases/download
CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz
CARGO_C_VERSION: v0.10.5
run: |
curl -L $LINK/$CARGO_C_VERSION/$CARGO_C_FILE | tar xz -C ~/.cargo/bin
- name: Run cargo-c tests
run: cargo ctest --features="capi" --release

Expand Down
Loading