forked from Parchive/par2cmdline
-
Notifications
You must be signed in to change notification settings - Fork 7
165 lines (161 loc) · 5.77 KB
/
build.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Build release binary
on:
release:
types: [published]
#push:
# tags:
# - v*.*.*
jobs:
build-win:
strategy:
matrix:
include:
- platform: x64
bcj: -mf=BCJ2
name: x64
- platform: Win32
bcj: -mf=BCJ2
name: x86
- platform: ARM64
bcj: # -mf=ARM64
name: arm64
name: Build ${{ matrix.name }} Windows binary
runs-on: windows-2019
steps:
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ github.token }}
- run: msbuild -property:PlatformToolset=ClangCL -property:Configuration=Release -property:Platform=${{ matrix.platform }} par2cmdline.sln
- run: move "${{ matrix.platform }}\Release\par2.exe" par2.exe && 7z a -t7z -mx=9 ${{ matrix.bcj }} par2.7z par2.exe
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./par2.7z
asset_name: par2cmdline-turbo-${{ steps.get_release.outputs.tag_name }}-win-${{ matrix.name }}.7z
asset_content_type: application/octet-stream
build-linux-static:
strategy:
matrix:
include:
- arch: amd64
xz_bcj: --x86
xcc:
configure_host:
- arch: arm64
xz_bcj: # --arm64 # requires xz utils >=5.4 to decompress
xcc: aarch64-linux-gnu-
configure_host: --host=aarch64-linux-gnu
- arch: armhf
xz_bcj: --arm
xcc: arm-linux-gnueabihf-
configure_host: --host=armv7l-linux-gnueabihf
name: Build ${{ matrix.arch }} Linux static binary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ github.token }}
- uses: junelife/gha-ubuntu-cross@v6
with:
arch: ${{ matrix.arch }}
if: ${{ matrix.arch != 'amd64' }}
- run: aclocal && automake --warnings=all --add-missing && autoconf --warnings=all
- run: ./configure ${{ matrix.configure_host }}
env:
CC: ${{ matrix.xcc }}gcc
CXX: ${{ matrix.xcc }}g++
LDFLAGS: -static -s
- run: make
- run: ./par2 -h
if: ${{ matrix.arch == 'amd64' }}
- run: make check
if: ${{ matrix.arch == 'amd64' }}
- run: xz -9e ${{ matrix.xz_bcj }} --lzma2 par2 -c > par2.xz
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./par2.xz
asset_name: par2cmdline-turbo-${{ steps.get_release.outputs.tag_name }}-linux-${{ matrix.arch }}.xz
asset_content_type: application/octet-stream
build-mac-x64:
name: Build x64 MacOS binary
runs-on: macos-latest
steps:
- uses: ConorMacBride/install-package@v1
with:
brew: automake llvm
# force past "The `brew link` step did not complete successfully"
continue-on-error: true
- run: |
if [ -f "`brew --prefix llvm`/bin/clang" ]; then
echo "CC=`brew --prefix llvm`/bin/clang" >> $GITHUB_ENV
echo "CXX=`brew --prefix llvm`/bin/clang++" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ github.token }}
- run: aclocal && automake --warnings=all --add-missing && autoconf --warnings=all
- run: ./configure
- run: make
- run: strip par2
- run: ./par2 -h
- run: make check
- run: xz -9e --x86 --lzma2 par2
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./par2.xz
asset_name: par2cmdline-turbo-${{ steps.get_release.outputs.tag_name }}-macos-x64.xz
asset_content_type: application/octet-stream
build-mac-arm64:
name: Build arm64 MacOS binary
# avoid OpenSSL 3.0.2 on 22.04: https://github.com/tpoechtrager/osxcross/issues/349
runs-on: ubuntu-20.04
steps:
- uses: mbround18/setup-osxcross@main # OSXCROSS_TARGET unavailable in v1.1
with:
osx-version: "12.3"
- uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ github.token }}
- run: aclocal && automake --warnings=all --add-missing && autoconf --warnings=all
- run: ./configure --host=aarch64-macos
env:
CC: oa64-clang
CXX: oa64-clang++
AR: arm64-apple-darwin21.4-ar
RANLIB: arm64-apple-darwin21.4-ranlib
STRIP: arm64-apple-darwin21.4-strip
- run: make
- run: arm64-apple-darwin21.4-strip par2
- run: |
wget -q -O- https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-x86_64-unknown-linux-musl.tar.gz | tar zxf -
apple-codesign*/rcodesign sign par2
- run: xz -9e --lzma2 par2
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./par2.xz
asset_name: par2cmdline-turbo-${{ steps.get_release.outputs.tag_name }}-macos-arm64.xz
asset_content_type: application/octet-stream