-
Notifications
You must be signed in to change notification settings - Fork 30
93 lines (85 loc) · 3.39 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Release
on:
push:
tags:
- "*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build-capi:
runs-on: ${{ matrix.os }}
name: Build C-API (${{ matrix.arch }})
strategy:
matrix:
include:
- os: macos-latest
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
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install musl tools
if: matrix.os == 'ubuntu-latest' && matrix.target_arch == 'x86_64-unknown-linux-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 (macOS)
if: matrix.os == 'macos-latest'
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 (Linux)
if: matrix.os == 'ubuntu-latest' && matrix.target_arch == 'x86_64-unknown-linux-gnu'
run: cargo cinstall --release --target ${{ matrix.target_arch }} --prefix=/usr --destdir=./build
- name: Build C-API (musl)
if: matrix.os == 'ubuntu-latest' && matrix.target_arch == 'x86_64-unknown-linux-musl'
run: |
cargo cinstall --target ${{ matrix.target_arch }} --release --prefix=/usr --destdir=./build
- name: Build C-API (macOS)
if: matrix.os == 'macos-latest'
run: |
cargo cinstall --target ${{ matrix.target_arch }} --release --prefix=/usr --destdir=./build
- name: Compress
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@v2
with:
files: |
biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz
biscuit-auth-${{github.ref_name}}-${{matrix.arch}}.tar.gz.sha256