Skip to content

Commit 667a69d

Browse files
Merge pull request #46 from alienc0der/cicd
cicd: update Github Actions workflow
2 parents bba4060 + b1843bd commit 667a69d

File tree

1 file changed

+92
-24
lines changed

1 file changed

+92
-24
lines changed

.github/workflows/znn_builder.yml

Lines changed: 92 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1717
- name: Ensure SHA pinned actions
18-
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@21991cec25093947ff3f62e4c223df0260c39944
18+
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@2d6823da4039243036c86d76f503c84e2ded2517
1919
xgo:
2020
needs: harden_security
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
2525
- name: Install zip utility
2626
run: |
2727
sudo apt update
@@ -37,10 +37,10 @@ jobs:
3737
# go install golang.org/x/vuln/cmd/govulncheck@latest
3838
# /home/runner/go/bin/govulncheck -json ./...
3939
- name: Build znnd
40-
uses: crazy-max/ghaction-xgo@588a1a9bc6aa44305ce5d2c669c11687316f87bf
40+
uses: crazy-max/ghaction-xgo@acf46aa99b919eb9ef6bba89dfd13bafa680667f
4141
with:
42-
xgo_version: latest
43-
go_version: latest
42+
xgo_version: "v0.36.0"
43+
go_version: 1.24.1
4444
dest: build
4545
prefix: znnd
4646
pkg: cmd/znnd
@@ -52,10 +52,10 @@ jobs:
5252
buildmode: default
5353
trimpath: true
5454
- name: Build libznn
55-
uses: crazy-max/ghaction-xgo@588a1a9bc6aa44305ce5d2c669c11687316f87bf
55+
uses: crazy-max/ghaction-xgo@acf46aa99b919eb9ef6bba89dfd13bafa680667f
5656
with:
57-
xgo_version: latest
58-
go_version: latest
57+
xgo_version: "v0.36.0"
58+
go_version: 1.24.1
5959
dest: build
6060
prefix: libznn
6161
pkg: cmd/libznn
@@ -67,11 +67,11 @@ jobs:
6767
buildvcs: false
6868
buildmode: c-shared
6969
trimpath: true
70-
- name: Build libznn (windows/amd64)
71-
uses: crazy-max/ghaction-xgo@588a1a9bc6aa44305ce5d2c669c11687316f87bf
70+
- name: Build libznn
71+
uses: crazy-max/ghaction-xgo@acf46aa99b919eb9ef6bba89dfd13bafa680667f
7272
with:
73-
xgo_version: latest
74-
go_version: 1.19.10
73+
xgo_version: "v0.36.0"
74+
go_version: 1.24.1
7575
dest: build
7676
prefix: libznn
7777
pkg: cmd/libznn
@@ -83,15 +83,15 @@ jobs:
8383
buildvcs: false
8484
buildmode: c-shared
8585
trimpath: true
86-
# - name: Run makefat for darwin builds
87-
# run: |
88-
# cd ..
89-
# git clone https://github.com/randall77/makefat.git
90-
# cd makefat/
91-
# git checkout 7ddd0e42c8442593c87c1705a5545099604008e5
92-
# go build -o mainfat makefat.go
93-
# ./mainfat ../go-zenon/build/libznn-darwin-universal.dylib ../go-zenon/build/libznn-darwin-amd64.dylib ../go-zenon/build/libznn-darwin-arm64.dylib
94-
# ./mainfat ../go-zenon/build/znnd-darwin-universal ../go-zenon/build/znnd-darwin-amd64 ../go-zenon/build/znnd-darwin-arm64
86+
- name: Upload Darwin builds for makefat
87+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
88+
with:
89+
name: darwin-bins
90+
path: |
91+
build/znnd-darwin-amd64
92+
build/znnd-darwin-arm64
93+
build/libznn-darwin-amd64.dylib
94+
build/libznn-darwin-arm64.dylib
9595
- name: Go back to build directory, remove header files and add execute flag
9696
run: |
9797
cd build/
@@ -102,16 +102,21 @@ jobs:
102102
cd build/
103103
for file in *windows*; do zip $(echo $file | rev | cut -d '.' -f2- | rev)".zip" "$file" && rm "$file" ; done && for so in "linux" "darwin"; do for file in *"$so"*; do tar cvzf $(echo $file | rev | cut -d '.' -f2- | rev)".tar.gz" "$file" && rm "$file" ; done; done
104104
- name: Generate checksums
105-
run: |
105+
run: |
106106
cd build/
107107
sha256sum *
108108
sha256sum * > SHA256CHECKSUMS.txt
109+
- name: Upload slice checksums
110+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
111+
with:
112+
name: slice-checksums
113+
path: build/SHA256CHECKSUMS.txt
109114
- name: Set version
110115
run: |
111116
GOZENON=$(cat metadata/version.go | grep Version | awk -F '"' '{print $2}')
112117
echo "GOZENON_VERSION=$GOZENON" >> $GITHUB_ENV
113118
- name: Upload files to a GitHub release
114-
uses: svenstaro/upload-release-action@7319e4733ec7a184d739a6f412c40ffc339b69c7
119+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd
115120
with:
116121
repo_token: ${{ secrets.GITHUB_TOKEN }}
117122
file: build/*
@@ -120,3 +125,66 @@ jobs:
120125
file_glob: true
121126
overwrite: true
122127
body: ""
128+
makefat:
129+
name: Create universal Darwin binaries
130+
needs: xgo
131+
runs-on: macos-latest
132+
steps:
133+
- name: Checkout repo
134+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
135+
- name: Download Darwin slices
136+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
137+
with:
138+
name: darwin-bins
139+
path: darwin-bins
140+
- name: Download slice checksums
141+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
142+
with:
143+
name: slice-checksums
144+
path: slice-checksums
145+
- name: Prepare output dir
146+
run: |
147+
mkdir -p universal
148+
- name: Create universal znnd
149+
run: |
150+
lipo -create \
151+
darwin-bins/znnd-darwin-amd64 \
152+
darwin-bins/znnd-darwin-arm64 \
153+
-output universal/znnd-darwin-universal
154+
- name: Create universal libznn
155+
run: |
156+
lipo -create \
157+
darwin-bins/libznn-darwin-amd64.dylib \
158+
darwin-bins/libznn-darwin-arm64.dylib \
159+
-output universal/libznn-darwin-universal.dylib
160+
- name: Archive files
161+
run: |
162+
cd universal/
163+
tar -czvf libznn-darwin-universal.tar.gz libznn-darwin-universal.dylib
164+
tar -czvf znnd-darwin-universal.tar.gz znnd-darwin-universal
165+
rm libznn-darwin-universal.dylib
166+
rm znnd-darwin-universal
167+
- name: Generate universal checksums
168+
run: |
169+
cd universal
170+
shasum -a 256 * > UNIVERSAL_CHECKSUMS.txt
171+
cd ..
172+
- name: Merge all checksums
173+
run: |
174+
cat slice-checksums/SHA256CHECKSUMS.txt universal/UNIVERSAL_CHECKSUMS.txt > SHA256CHECKSUMS.txt
175+
rm universal/UNIVERSAL_CHECKSUMS.txt
176+
- name: Set version
177+
run: |
178+
GOZENON=$(grep Version metadata/version.go \
179+
| awk -F '"' '{print $2}')
180+
echo "GOZENON_VERSION=$GOZENON" >> $GITHUB_ENV
181+
- name: Upload universal Darwin binaries
182+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd
183+
with:
184+
repo_token: ${{ secrets.GITHUB_TOKEN }}
185+
file: universal/*
186+
release_name: ${{ env.GOZENON_VERSION }}
187+
tag: ${{ env.GOZENON_VERSION }}-alphanet
188+
overwrite: true
189+
file_glob: true
190+
body: ""

0 commit comments

Comments
 (0)