-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (101 loc) 路 4.22 KB
/
Copy pathreusable-build.yml
File metadata and controls
102 lines (101 loc) 路 4.22 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
on:
workflow_call:
inputs:
target:
description: 'Target platform'
required: true
default: 'x86_64-apple-darwin'
type: string
slim:
description: 'Enable slim mode'
required: false
default: true
type: boolean
use-cross:
description: 'Enable cross-compilation'
required: true
default: false
type: boolean
os:
description: 'Operating system'
required: true
default: 'macos-14'
type: string
version:
description: 'Version of the release'
default: 'latest'
type: string
jobs:
build_workflow:
runs-on: ${{ inputs.os }}
env:
SLIM: ${{ inputs.slim }}
steps:
- uses: actions/checkout@v4
- name: Install stable Rust Toolchain Components
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ inputs.target }}
toolchain: stable
if: ${{ inputs.target != 'aarch64-unknown-freebsd' && inputs.target != 'mips64-unknown-linux-gnuabi64' && inputs.target != 'mips64el-unknown-linux-gnuabi64' && inputs.target != 'mips64-unknown-linux-muslabi64' && inputs.target != 'mips64el-unknown-linux-muslabi64' && inputs.target != 's390x-unknown-linux-musl' && inputs.target != 'riscv64gc-unknown-linux-musl' }}
- name: Install nightly Rust Toolchain Components
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ inputs.target }}
toolchain: nightly
if: ${{ inputs.use-cross != true && env.SLIM == 'true' }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
if: ${{ inputs.target != 'x86_64-apple-darwin' && inputs.target != 'aarch64-apple-darwin' }}
- name: Install Rust Toolchain Components
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
toolchain: nightly
if: ${{ inputs.target == 'aarch64-unknown-freebsd' || inputs.target == 's390x-unknown-linux-musl' || inputs.target == 'riscv64gc-unknown-linux-musl' }}
- name: update cargo toml version
run: |
awk -v ver="${{ inputs.version }}" '{
if (!done && $0 ~ /^version = "/) {
print "version = \"" ver "\""
done=1
next
}
print
}' Cargo.toml > Cargo.toml.tmp && rm Cargo.toml && mv Cargo.toml.tmp Cargo.toml
- name: set MACOSX_DEPLOYMENT_TARGET to 10.9 for x86_64-apple-darwin (mavericks)
if: ${{ inputs.target == 'x86_64-apple-darwin' }}
run: echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV
- name: set MACOSX_DEPLOYMENT_TARGET to 11.0 for aarch64-apple-darwin (big sur)
if: ${{ inputs.target == 'aarch64-apple-darwin' }}
run: echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
- name: Build
run: make cargo_build_release TARGET=${{ inputs.target }} SLIM=${{ inputs.slim }} USE_CROSS=${{ inputs.use-cross }}
- name: Test
if: ${{ inputs.target == 'aarch64-apple-darwin' }} # currently no cross-platform specific tests, so only test for a single platform
run: make cargo_test
- name: test pact-cli with locally running Pact Broker (Unix)
if: ${{ runner.os != 'Windows' && inputs.use-cross != true || (inputs.target == 'x86_64-unknown-linux-gnu' || inputs.target == 'x86_64-unknown-linux-musl') }}
run: ./run.sh
shell: bash
env:
PACT_BROKER_BASE_URL: http://localhost:9292
BIN: target/${{ inputs.target }}/release/pact --otel-exporter stdout --enable-otel-traces --enable-otel --log-level info
- name: test pact-cli with locally running Pact Broker (Windows)
if: ${{ runner.os == 'Windows' && inputs.target != 'aarch64-pc-windows-msvc' }}
run: ./run.ps1
shell: pwsh
env:
PACT_BROKER_BASE_URL: http://localhost:9292
BIN: target/${{ inputs.target }}/release/pact.exe
- name: Create dist
id: dist
shell: bash
run: |
./prep_dist.sh ${{ inputs.target }}
- uses: actions/upload-artifact@master
with:
name: ${{ inputs.target }}
path: dist/