19
19
outputs :
20
20
crate : ${{ steps.parse-ref.outputs.crate }}
21
21
version : ${{ steps.parse-ref.outputs.version }}
22
+ runtime : ${{ steps.parse-ref.outputs.runtime }}
22
23
steps :
23
24
- uses : actions/checkout@v3
24
25
with :
41
42
exit 1
42
43
fi
43
44
45
+ RUNTIME="$(cut -d- -f3 <<<"${CRATE}")"
46
+
44
47
echo "CRATE=${CRATE}" >> $GITHUB_OUTPUT
45
48
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
49
+ echo "RUNTIME=${RUNTIME}" >> $GITHUB_OUTPUT
46
50
47
51
setVersion="$(./scripts/version.sh "${CRATE}")"
48
52
if [ ! "${VERSION#v}" = "${setVersion}" ]; then
@@ -55,26 +59,46 @@ jobs:
55
59
- generate
56
60
strategy :
57
61
matrix :
58
- os : ["ubuntu-20.04 ", "ubuntu-22.04 "]
59
- runs-on : ${{ matrix.os }}
62
+ arch : ["x86_64 ", "aarch64 "]
63
+ runs-on : " ubuntu-22.04 "
60
64
steps :
61
- - uses : Swatinem/rust-cache@v2
62
- with :
63
- key : release-${{ needs.generate.outputs.crate }}
64
65
- uses : actions/checkout@v3
65
66
- name : Setup build env
66
67
run : ./scripts/setup-linux.sh
67
- shell : bash
68
- - name : Install rust
69
- uses : actions- rust-lang/setup-rust-toolchain@v1
68
+ - uses : actions-rust-lang/setup-rust-toolchain@v1
69
+ env :
70
+ RUST_CACHE_KEY_OS : rust-release-cache-${{ needs.generate.outputs.crate }}-${{ matrix.arch }}
70
71
with :
71
- cache : false
72
+ rustflags : ' ' # Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
73
+ - name : Setup cross-rs
74
+ run : ./scripts/setup-cross.sh ${{ matrix.arch }}-unknown-linux-musl
75
+ - name : Setup build profile
76
+ shell : bash
77
+ run : echo "OPT_PROFILE=release" >> ${GITHUB_ENV}
72
78
- name : Build
73
- timeout-minutes : 5
74
- run : make build-$(cut -d- -f3 <<<"$ {{ needs.generate.outputs.crate }}")
79
+ timeout-minutes : 10
80
+ run : make build-${{ needs.generate.outputs.runtime }}
75
81
- name : Test
76
- timeout-minutes : 5
77
- run : make test-$(cut -d- -f3 <<<"${{ needs.generate.outputs.crate }}")
82
+ if : ${{ matrix.arch == 'x86_64' }}
83
+ timeout-minutes : 10
84
+ run : make test-${{ needs.generate.outputs.runtime }}
85
+ - name : Package artifacts
86
+ if : ${{ needs.generate.outputs.runtime != 'wasm' }}
87
+ shell : bash
88
+ run : |
89
+ make dist-${{ needs.generate.outputs.runtime }}
90
+ # Check if there's any files to archive as tar fails otherwise
91
+ if stat dist/bin/* >/dev/null 2>&1; then
92
+ tar -czf dist/containerd-shim-${{ needs.generate.outputs.runtime }}-${{ matrix.arch }}.tar.gz -C dist/bin .
93
+ else
94
+ tar -czf dist/containerd-shim-${{ needs.generate.outputs.runtime }}-${{ matrix.arch }}.tar.gz -T /dev/null
95
+ fi
96
+ - name : Upload artifacts
97
+ if : ${{ needs.generate.outputs.runtime != 'wasm' }}
98
+ uses : actions/upload-artifact@master
99
+ with :
100
+ name : containerd-shim-${{ needs.generate.outputs.runtime }}-${{ matrix.arch }}
101
+ path : dist/containerd-shim-${{ needs.generate.outputs.runtime }}-${{ matrix.arch }}.tar.gz
78
102
79
103
release :
80
104
permissions :
@@ -85,29 +109,23 @@ jobs:
85
109
runs-on : ubuntu-latest
86
110
steps :
87
111
- uses : actions/checkout@v3
88
- - name : Setup buildx
89
- run : docker buildx create --use
90
- - name : build binaries
91
- run : docker buildx bake --set *.cache-from=type=gha,scope=buildkit-release-${CRATE} --set *.cache-to=type=gha,scope=buildkit-release-${CRATE} tar-cross
92
- env :
93
- CRATE : ${{ needs.generate.outputs.crate }}
94
- - name : upload binary as GitHub artifact
95
- uses : actions/upload-artifact@v3
112
+ - name : Download artifacts
113
+ if : ${{ needs.generate.outputs.runtime != 'wasm' }}
114
+ uses : actions/download-artifact@master
96
115
with :
97
- path : release/
98
- name : ${{ needs.generate.outputs.crate }}-${{ needs.generate.outputs.version }}
116
+ path : release
99
117
- name : Create release
100
118
run : |
101
119
gh release create ${{ github.ref }} --generate-notes --prerelease
102
- # skip upload if there are no files
103
- if stat release/* >/dev/null 2>&1; then
104
- for i in release/*; do
105
- gh release upload ${RELEASE_NAME} $i
106
- done
107
- else
108
- echo "No files to upload"
109
- exit 0
110
- fi
120
+ env :
121
+ GH_TOKEN : ${{ github.token }}
122
+ RELEASE_NAME : ${{ needs.generate.outputs.crate }}/${{ needs.generate.outputs.version }}
123
+ - name : Upload release artifacts
124
+ if : ${{ needs.generate.outputs.runtime != 'wasm' }}
125
+ run : |
126
+ for i in release/*/*; do
127
+ gh release upload ${RELEASE_NAME} $i
128
+ done
111
129
env :
112
130
GH_TOKEN : ${{ github.token }}
113
131
RELEASE_NAME : ${{ needs.generate.outputs.crate }}/${{ needs.generate.outputs.version }}
0 commit comments