Skip to content

Commit 9ff1ed5

Browse files
authored
chore(ci): fixes/improvements + build Darwin/ARM64 (#15)
* chore(ci): download macOS sdk in a separate job * chore(ci): upgrade to fedora 34 Now that we have newer macOS SDK this is now possible. * chore(ci): add build-darwin-arm64 target * chore(ci): download xz source code from dnf * chore(ci): handle osxcross cache properly
1 parent 9378850 commit 9ff1ed5

File tree

2 files changed

+83
-25
lines changed

2 files changed

+83
-25
lines changed

.github/workflows/goreleaser.yml

+72-25
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,55 @@ on:
66
- '*'
77

88
jobs:
9+
macos-sdk:
10+
runs-on: macos-latest
11+
steps:
12+
- id: osxcross-macos-sdk
13+
uses: actions/cache@v2
14+
with:
15+
path: osxcross/tarballs
16+
key: ${{ runner.os }}-osxcross-macos-sdk
17+
18+
- name: Package MacOSX SDK
19+
if: steps.osxcross-macos-sdk.outputs.cache-hit != 'true'
20+
run: |
21+
git clone https://github.com/tpoechtrager/osxcross osxcross
22+
pushd osxcross
23+
XCODEDIR=/Applications/Xcode_12.4.app tools/gen_sdk_package.sh
24+
mv MacOSX*.sdk.tar.xz tarballs/
25+
popd
26+
27+
- uses: actions/upload-artifact@master
28+
with:
29+
name: osxcross-tarballs
30+
path: osxcross/tarballs
31+
932
goreleaser:
1033
runs-on: ubuntu-latest
11-
container: fedora:33
34+
container: fedora:34
35+
needs: macos-sdk
1236

1337
steps:
1438
- name: Install dependencies
15-
run: dnf -y install git golang mingw{32,64}-gcc{-c++,} mingw{32,64}-{winpthreads,xz-libs}-static glibc-{devel,static}.{i686,x86_64} xz-{devel,static}.{i686,x86_64}
39+
run: |
40+
dnf -y install autoconf bash clang cmake gettext-devel git glibc-{devel,static}.{i686,x86_64} golang libstdc++-static libtool libuuid-devel libxml2-devel llvm-devel make mingw{32,64}-{winpthreads,xz-libs}-static mingw{32,64}-gcc{-c++,} openssl-devel patch po4a xz-{devel,static}.{i686,x86_64}
41+
dnf -y install 'dnf-command(download)'
42+
dnf download --source xz-devel
43+
rpm -ivh *.src.rpm
44+
rm -f *.src.rpm
1645
1746
- name: Setup cross compile environment for Linux ARMv7
1847
env:
1948
CC: arm-linux-gnueabihf-gcc
2049
CXX: arm-linux-gnueabihf-c++
2150
CFLAGS: -fPIC
2251
run: |
23-
dnf -y install 'dnf-command(copr)'
2452
dnf -y copr enable lantw44/arm-linux-gnueabihf-toolchain
2553
dnf -y install arm-linux-gnueabihf-{binutils,gcc,glibc}
26-
dnf -y install autoconf gettext-devel libtool po4a wget
2754
mkdir /linux-armv7-buildroot
2855
pushd /linux-armv7-buildroot
29-
wget https://tukaani.org/xz/xz-5.2.5.tar.gz
30-
tar -xvf xz-5.2.5.tar.gz
31-
pushd xz-5.2.5
56+
tar -xvf $HOME/rpmbuild/SOURCES/xz-*.tar.xz
57+
pushd $(basename $HOME/rpmbuild/SOURCES/xz-*.tar.xz .tar.xz)
3258
./autogen.sh
3359
./configure --host=armv7 --prefix=/linux-armv7-buildroot/sys-root
3460
make -j$(nproc) install
@@ -44,30 +70,37 @@ jobs:
4470
dnf -y install aarch64-linux-gnu-{binutils,gcc,glibc}
4571
mkdir /linux-aarch64-buildroot
4672
pushd /linux-aarch64-buildroot
47-
wget https://tukaani.org/xz/xz-5.2.5.tar.gz
48-
tar -xvf xz-5.2.5.tar.gz
49-
pushd xz-5.2.5
73+
tar -xvf $HOME/rpmbuild/SOURCES/xz-*.tar.xz
74+
pushd $(basename $HOME/rpmbuild/SOURCES/xz-*.tar.xz .tar.xz)
5075
./autogen.sh
5176
./configure --host=aarch64 --prefix=/linux-aarch64-buildroot/sys-root
5277
make -j$(nproc) install
5378
popd
5479
popd
5580
56-
- id: osxcross-cache
81+
- name: Download osxcross
82+
run: git clone https://github.com/tpoechtrager/osxcross /osxcross
83+
84+
- id: osxcross-target
5785
uses: actions/cache@v2
5886
with:
59-
path: /osxcross
60-
key: ${{ runner.os }}-osxcross
87+
path: /osxcross/target
88+
key: ${{ runner.os }}-osxcross-target
89+
90+
- uses: actions/download-artifact@master
91+
if: steps.osxcross-target.outputs.cache-hit != 'true'
92+
with:
93+
name: osxcross-tarballs
94+
path: /osxcross/tarballs
95+
96+
- uses: geekyeggo/delete-artifact@v1
97+
with:
98+
name: osxcross-tarballs
6199

62100
- name: Build osxcross
63-
if: steps.osxcross-cache.outputs.cache-hit != 'true'
64-
run: |
65-
git clone https://github.com/tpoechtrager/osxcross /osxcross
66-
pushd /osxcross
67-
dnf -y install clang llvm-devel libxml2-devel libuuid-devel openssl-devel bash patch libstdc++-static make cmake
68-
wget https://s3.dockerproject.org/darwin/v2/MacOSX10.11.sdk.tar.xz -O tarballs/MacOSX10.11.sdk.tar.xz
69-
UNATTENDED=1 ./build.sh
70-
popd
101+
if: steps.osxcross-target.outputs.cache-hit != 'true'
102+
run: UNATTENDED=1 ./build.sh
103+
working-directory: /osxcross
71104

72105
- name: Setup cross compile environment for Darwin AMD64
73106
env:
@@ -76,11 +109,25 @@ jobs:
76109
run: |
77110
mkdir /darwin-amd64-buildroot
78111
pushd /darwin-amd64-buildroot
79-
wget https://tukaani.org/xz/xz-5.2.5.tar.gz
80-
tar -xvf xz-5.2.5.tar.gz
81-
pushd xz-5.2.5
112+
tar -xvf $HOME/rpmbuild/SOURCES/xz-*.tar.xz
113+
pushd $(basename $HOME/rpmbuild/SOURCES/xz-*.tar.xz .tar.xz)
114+
PATH=/osxcross/target/bin:$PATH ./autogen.sh
115+
PATH=/osxcross/target/bin:$PATH ./configure --host=x86_64-apple-darwin20.2 --prefix=/darwin-amd64-buildroot/sys-root --enable-shared=no
116+
PATH=/osxcross/target/bin:$PATH make -j$(nproc) install
117+
popd
118+
popd
119+
120+
- name: Setup cross compile environment for Darwin AArch64
121+
env:
122+
CC: oa64-clang
123+
CXX: oa64-clang++
124+
run: |
125+
mkdir /darwin-aarch64-buildroot
126+
pushd /darwin-aarch64-buildroot
127+
tar -xvf $HOME/rpmbuild/SOURCES/xz-*.tar.xz
128+
pushd $(basename $HOME/rpmbuild/SOURCES/xz-*.tar.xz .tar.xz)
82129
PATH=/osxcross/target/bin:$PATH ./autogen.sh
83-
PATH=/osxcross/target/bin:$PATH ./configure --host=x86_64-apple-darwin15 --prefix=/darwin-amd64-buildroot/sys-root --enable-shared=no
130+
PATH=/osxcross/target/bin:$PATH ./configure --host=aarch64-apple-darwin20.2 --prefix=/darwin-aarch64-buildroot/sys-root --enable-shared=no
84131
PATH=/osxcross/target/bin:$PATH make -j$(nproc) install
85132
popd
86133
popd

.goreleaser.yml

+11
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,14 @@ builds:
7272
- darwin
7373
goarch:
7474
- amd64
75+
- id: build-darwin-arm64
76+
env:
77+
- CC=oa64-clang
78+
- CXX=oa64-clang++
79+
- CGO_CFLAGS=-I/darwin-aarch64-buildroot/sys-root/include
80+
- CGO_LDFLAGS=-L/darwin-aarch64-buildroot/sys-root/lib
81+
- PATH=/osxcross/target/bin:$PATH
82+
goos:
83+
- darwin
84+
goarch:
85+
- arm64

0 commit comments

Comments
 (0)