-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (66 loc) · 2.81 KB
/
build.yml
File metadata and controls
79 lines (66 loc) · 2.81 KB
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
name: Build
on:
push:
branches:
- 'master'
workflow_dispatch:
workflow_call:
inputs:
upload-artifacts:
type: boolean
default: false
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
uses: ./.github/workflows/check.yml
build:
name: Build ${{ matrix.platform.target }}
needs: [check]
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: true
matrix:
platform:
- { os: 'macos-15', target: 'x86_64-apple-darwin', arch: 'x86_64', osn: 'mac', tests_integration: true }
- { os: 'macos-15', target: 'aarch64-apple-darwin', arch: 'aarch64', osn: 'mac', tests_integration: false }
- { os: 'ubuntu-24.04', target: 'x86_64-unknown-linux-musl', arch: 'x86_64', osn: 'ubuntu-latest', tests_integration: true }
- { os: 'ubuntu-24.04-arm', target: 'aarch64-unknown-linux-musl', arch: 'aarch64', osn: 'ubuntu-latest', tests_integration: true }
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}
- name: Install musl tools
if: contains(matrix.platform.target, 'musl')
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Run tests
if: ${{ matrix.platform.tests_integration == true }}
run: cargo test --target ${{ matrix.platform.target }} --bin vault
- name: Compile
run: cargo build --release --target ${{ matrix.platform.target }} --bin vault
- name: Get version
if: ${{ inputs.upload-artifacts }}
id: version
run: echo "version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" >> $GITHUB_OUTPUT
- name: Copy artifacts
if: ${{ inputs.upload-artifacts }}
run: |
mkdir -p artifact
cp target/${{ matrix.platform.target }}/release/vault artifact/vault-v${{ steps.version.outputs.version }}-${{ matrix.platform.target }}
cp target/${{ matrix.platform.target }}/release/vault artifact/vault_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}
- name: Upload artifact (versioned)
if: ${{ inputs.upload-artifacts }}
uses: actions/upload-artifact@v7
with:
name: vault-v${{ steps.version.outputs.version }}-${{ matrix.platform.target }}
path: artifact/vault-v${{ steps.version.outputs.version }}-${{ matrix.platform.target }}
- name: Upload artifact (platform)
if: ${{ inputs.upload-artifacts }}
uses: actions/upload-artifact@v7
with:
name: vault_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}
path: artifact/vault_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}