-
-
Notifications
You must be signed in to change notification settings - Fork 22
139 lines (126 loc) · 4.61 KB
/
ci.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
- dev
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
defaults:
run:
shell: bash --noprofile --norc -CeEuxo pipefail {0}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
tidy:
uses: taiki-e/github-actions/.github/workflows/tidy.yml@main
permissions:
contents: read
pull-requests: write # for gh pr edit --add-assignee
repository-projects: read # for gh pr edit --add-assignee
secrets: inherit
test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
build_tool: cargo
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu.2.17
build_tool: cargo-zigbuild
- os: ubuntu-latest
target: x86_64-pc-windows-gnu
- os: macos-latest # AArch64
checksums: sha256,sha512,sha1,md5
- os: macos-13 # x86_64
checksums: sha256,sha512,sha1,md5
- os: macos-latest
checksums: sha256,sha512,sha1,md5
target: x86_64-apple-darwin
- os: macos-latest
checksums: sha256,sha512,sha1,md5
target: aarch64-apple-darwin
- os: macos-latest
checksums: sha256,sha512,sha1,md5
target: universal-apple-darwin
- os: macos-latest
checksums: sha256,sha512,sha1,md5
target: universal-apple-darwin
build_tool: cargo
- os: windows-latest
- os: windows-latest
target: aarch64-pc-windows-msvc
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: 60
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/install-rust@stable
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
if: matrix.target != '' && matrix.build_tool == 'cargo'
- run: cargo new --bin test-crate
- uses: ./
id: upload-rust-binary-action
with:
dry-run: true
bin: test-crate
target: ${{ matrix.target }}
build-tool: ${{ matrix.build_tool }}
checksum: ${{ matrix.checksums || 'b2,sha256,sha512,sha1,md5' }}
tar: all
zip: all
manifest-path: test-crate/Cargo.toml
codesign: '-'
codesign-prefix: 'com.example.'
codesign-options: 'runtime'
upx: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.target != 'x86_64-pc-windows-gnu' }}
- name: Check action outputs
run: |
printf 'outputs.archive should not be empty\n'
test -n "${{ steps.upload-rust-binary-action.outputs.archive }}"
printf 'outputs.zip should be a file\n'
test -f "${{ steps.upload-rust-binary-action.outputs.zip }}"
printf 'outputs.tar should be a file\n'
test -f "${{ steps.upload-rust-binary-action.outputs.tar }}"
printf 'outputs.sha256 should be a file\n'
test -f "${{ steps.upload-rust-binary-action.outputs.sha256 }}"
printf 'outputs.sha512 should be a file\n'
test -f "${{ steps.upload-rust-binary-action.outputs.sha512 }}"
printf 'outputs.sha1 should be a file\n'
test -f "${{ steps.upload-rust-binary-action.outputs.sha1 }}"
printf 'outputs.md5 should be a file\n'
test -f "${{ steps.upload-rust-binary-action.outputs.md5 }}"
- name: Check UPX
if: |
startsWith(matrix.os, 'ubuntu-') &&
matrix.target != 'x86_64-pc-windows-gnu' &&
(matrix.target != 'aarch64-unknown-linux-gnu' || matrix.build_tool == 'cargo')
run: |
printf 'binary should be compressed with UPX\n'
target_dir="./test-crate/target/release"
tar -C "$target_dir" -xf "${{ steps.upload-rust-binary-action.outputs.tar }}"
test -n "$(file "$target_dir/test-crate" | grep 'no section header')"
- name: Check b2 output
if: ${{ contains(matrix.checksums || 'b2,sha256,sha512,sha1,md5', 'b2') }}
run: |
printf 'outputs.b2 should not be empty\n'
test -n "${{ steps.upload-rust-binary-action.outputs.b2 }}"