99 branches : [ main ]
1010
1111jobs :
12- generate :
13- name : Generate cross-platform builds
12+ test :
13+ name : Test
1414 runs-on : ubuntu-latest
15- permissions :
16- contents : write
17-
1815 container :
1916 image : ixsystems/zfs:latest
2017 steps :
@@ -31,62 +28,129 @@ jobs:
3128 with :
3229 go-version : ' ^1.23'
3330
34- - name : Run golangci-lint
35- uses : golangci/golangci-lint-action@v9.2.1
36- if : false
37- env :
38- GOFLAGS : " -buildvcs=false"
39- with :
40- # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
41- version : latest
42-
43- # Optional: working directory, useful for monorepos
44- # working-directory: somedir
31+ - uses : extractions/setup-just@v2
4532
46- # Optional: golangci-lint command line arguments.
47- # args: --exclude-use-default
48- # --issues-exit-code=0
33+ - name : Test
34+ run : just test
35+
36+ build :
37+ name : Build linux/${{ matrix.goarch }}
38+ runs-on : ${{ matrix.runner }}
39+ needs : test
40+ strategy :
41+ fail-fast : false
42+ matrix :
43+ include :
44+ - goarch : amd64
45+ runner : ubuntu-latest
46+ native : true
47+ just_target : build
48+
49+ - goarch : arm64
50+ runner : ubuntu-24.04-arm
51+ native : true
52+ just_target : build
53+
54+ - goarch : ppc64le
55+ runner : ubuntu-24.04
56+ native : false
57+ just_target : build-cross
58+ cc : powerpc64le-linux-gnu-gcc
59+ dpkg_arch : ppc64el
60+ cross_pkg : crossbuild-essential-ppc64el
61+ zfs_pkg : libzfslinux-dev:ppc64el
62+
63+ - goarch : s390x
64+ runner : ubuntu-24.04
65+ native : false
66+ just_target : build-cross
67+ cc : s390x-linux-gnu-gcc
68+ dpkg_arch : s390x
69+ cross_pkg : crossbuild-essential-s390x
70+ zfs_pkg : libzfslinux-dev:s390x
71+
72+ - goarch : riscv64
73+ runner : ubuntu-24.04
74+ native : false
75+ just_target : build-cross
76+ cc : riscv64-linux-gnu-gcc
77+ dpkg_arch : riscv64
78+ cross_pkg : crossbuild-essential-riscv64
79+ zfs_pkg : libzfslinux-dev:riscv64
4980
50- # Optional: show only new issues if it's a pull request. The default value is `false`.
51- # only-new-issues: true
81+ steps :
82+ - name : Install libzfslinux-dev (native)
83+ if : matrix.native
84+ run : |
85+ sudo apt-get update
86+ sudo apt-get install -y libzfslinux-dev
5287
53- # Optional: if set to true then the all caching functionality will be complete disabled,
54- # takes precedence over all other caching options.
55- skip-cache : true
88+ - name : Set up multiarch and cross-compilation toolchain
89+ if : ${{ !matrix.native }}
90+ run : |
91+ sudo dpkg --add-architecture ${{ matrix.dpkg_arch }}
92+ # Replace the runner's ubuntu.sources with one pinned to amd64 only.
93+ sudo tee /etc/apt/sources.list.d/ubuntu.sources > /dev/null << 'EOF'
94+ Types: deb
95+ URIs: http://azure.archive.ubuntu.com/ubuntu
96+ Suites: noble noble-updates noble-backports noble-security
97+ Components: main restricted universe multiverse
98+ Architectures: amd64
99+ Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
100+ EOF
101+ # Add ports.ubuntu.com for the foreign arch
102+ printf 'Types: deb\nURIs: http://ports.ubuntu.com/ubuntu-ports\nSuites: noble noble-updates noble-security\nComponents: main restricted universe multiverse\nArchitectures: %s\nSigned-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n' "${{ matrix.dpkg_arch }}" | sudo tee /etc/apt/sources.list.d/ports-${{ matrix.dpkg_arch }}.sources
103+ sudo apt-get update
104+ sudo apt-get install -y ${{ matrix.cross_pkg }} ${{ matrix.zfs_pkg }}
56105
57- # Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
58- # skip-build-cache: true
106+ - name : Checkout the repository
107+ uses : actions/checkout@v6
59108
60- - name : Test
61- run : make test
109+ - uses : actions/setup-go@v6
110+ with :
111+ go-version : ' ^1.23'
62112
63- - name : Build
64- run : make build
113+ - uses : extractions/setup-just@v2
65114
66- - name : Generate build files
67- run : |
68- GOOS="linux"
69- GOARCH="amd64"
70- GOFLAGS="-buildmode=exe"
71- NAME="zfs-file-history-${GOOS}-${GOARCH}"
72- OUTPUT_BIN="dist/${NAME}"
73- make build GOOS="${GOOS}" OARCH="${GOARCH}" GOFLAGS="${GOFLAGS}" OUTPUT_BIN="${OUTPUT_BIN}"
74-
75- - name : Generate build files
115+ - name : Generate build files (${{ matrix.goarch }})
116+ env :
117+ CC : ${{ matrix.cc }}
118+ GOOS : linux
119+ GOARCH : ${{ matrix.goarch }}
76120 run : |
77- GOOS="linux"
78- GOARCH="arm64"
79- GOFLAGS="-buildmode=exe"
80- NAME="zfs-file-history-${GOOS}-${GOARCH}"
81- OUTPUT_BIN="dist/${NAME}"
82- make build GOOS="${GOOS}" OARCH="${GOARCH}" GOFLAGS="${GOFLAGS}" OUTPUT_BIN="${OUTPUT_BIN}"
121+ OUTPUT_BIN="dist/zfs-file-history-linux-${{ matrix.goarch }}"
122+ just OUTPUT_BIN="${OUTPUT_BIN}" ${{ matrix.just_target }}
123+ file "${OUTPUT_BIN}"
124+
125+ - name : Upload artifacts
126+ uses : actions/upload-artifact@v4
127+ with :
128+ name : zfs-file-history-linux-${{ matrix.goarch }}
129+ path : dist/zfs-file-history-linux-${{ matrix.goarch }}
130+
131+ release :
132+ name : Release
133+ runs-on : ubuntu-latest
134+ permissions :
135+ contents : write
136+ needs : build
137+ if : startsWith(github.ref, 'refs/tags/')
138+
139+ steps :
140+ - name : Download all artifacts
141+ uses : actions/download-artifact@v4
142+ with :
143+ path : dist/
144+ merge-multiple : true
83145
84146 - name : Release
85147 uses : softprops/action-gh-release@v3
86- if : startsWith(github.ref, 'refs/tags/')
87148 with :
88149 files : |
89150 dist/zfs-file-history-linux-amd64
90151 dist/zfs-file-history-linux-arm64
152+ dist/zfs-file-history-linux-ppc64le
153+ dist/zfs-file-history-linux-s390x
154+ dist/zfs-file-history-linux-riscv64
91155 env :
92156 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments