Skip to content

Commit 2cf895d

Browse files
authored
far2l release reusable workflow (#17)
1 parent f1b2334 commit 2cf895d

14 files changed

+286
-758
lines changed

.github/workflows/build-alpine.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
workflow:
5+
required: true
6+
type: string
7+
toolset:
8+
required: false
9+
type: string
10+
default: 'musl'
11+
version:
12+
required: false
13+
type: string
14+
default: '3.15.0'
15+
16+
jobs:
17+
build-alpine:
18+
runs-on: ubuntu-latest
19+
container: alpine:${{ inputs.version }}
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: build ${{ inputs.workflow }}-alpine-${{ inputs.toolset }}
23+
run: |
24+
apk add --no-cache bash
25+
./${{ inputs.workflow }}/build_${{ inputs.toolset }}.sh
26+
27+
- uses: actions/upload-artifact@v3
28+
with:
29+
name: build-${{ inputs.toolset }}
30+
path: ./${{ inputs.workflow }}/release/build-${{ inputs.toolset }}.tar.gz

.github/workflows/build-ubuntu.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
workflow:
5+
required: true
6+
type: string
7+
toolset:
8+
required: false
9+
type: string
10+
default: 'glibc'
11+
version:
12+
required: false
13+
type: string
14+
default: '20.04'
15+
16+
jobs:
17+
build-ubuntu:
18+
runs-on: ubuntu-latest
19+
container: ubuntu:${{ inputs.version }}
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: build ${{ inputs.workflow }}-ubuntu-${{ inputs.toolset }}
23+
run: |
24+
./${{ inputs.workflow }}/build_${{ inputs.toolset }}.sh
25+
26+
- uses: actions/upload-artifact@v3
27+
with:
28+
name: build-${{ inputs.toolset }}
29+
path: ./${{ inputs.workflow }}/release/build-${{ inputs.toolset }}.tar.gz

.github/workflows/ci-test-run.yml

-119
Original file line numberDiff line numberDiff line change
@@ -127,122 +127,3 @@ jobs:
127127
allowUpdates: true
128128
token: ${{ secrets.GITHUB_TOKEN }}
129129

130-
alpine-far2l-linux:
131-
needs: prejob
132-
if: ${{ needs.prejob.outputs.tool=='far2l' }}
133-
runs-on: ubuntu-latest
134-
container: alpine:3.12.9
135-
136-
steps:
137-
- uses: actions/checkout@v2
138-
139-
- name: build
140-
run: |
141-
apk add --no-cache bash
142-
./far2l/build.sh
143-
144-
- uses: actions/upload-artifact@v1
145-
with:
146-
name: far2l-linux-musl
147-
path: ./far2l/release/far2l_musl.tar.gz
148-
149-
ubuntu-far2l-linux:
150-
needs: prejob
151-
if: ${{ needs.prejob.outputs.tool=='far2l' }}
152-
runs-on: ubuntu-latest
153-
container: ubuntu:18.04
154-
155-
steps:
156-
- uses: actions/checkout@v2
157-
158-
- name: build
159-
run: ./far2l_deb/build.sh
160-
161-
- uses: actions/upload-artifact@v1
162-
with:
163-
name: far2l-linux-glibc
164-
path: ./far2l_deb/release/far2l_glibc.tar.gz
165-
166-
alpine-far2l-test:
167-
needs: [alpine-far2l-linux, ubuntu-far2l-linux]
168-
169-
runs-on: ubuntu-latest
170-
container: alpine:3.15.0
171-
172-
steps:
173-
- uses: actions/download-artifact@v2
174-
with:
175-
name: far2l-linux-musl
176-
path: musl
177-
178-
- uses: actions/download-artifact@v2
179-
with:
180-
name: far2l-linux-glibc
181-
path: glibc
182-
183-
- name: Test musl build on Alpine
184-
run: |
185-
(cd musl && tar -xf ./far2l_musl.tar.gz)
186-
ldd ./musl/far2l
187-
./musl/far2l --help | head -n2
188-
189-
- name: Test glibc build on Alpine
190-
run: |
191-
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
192-
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk
193-
apk add glibc-2.34-r0.apk
194-
(cd glibc && tar -xf ./far2l_glibc.tar.gz)
195-
ldd ./glibc/far2l || true
196-
./glibc/far2l --help | head -n2
197-
198-
ubuntu-far2l-test:
199-
needs: [alpine-far2l-linux, ubuntu-far2l-linux]
200-
201-
runs-on: ubuntu-latest
202-
container: ubuntu:20.04
203-
204-
steps:
205-
- uses: actions/download-artifact@v2
206-
with:
207-
name: far2l-linux-musl
208-
path: musl
209-
- uses: actions/download-artifact@v2
210-
with:
211-
name: far2l-linux-glibc
212-
path: glibc
213-
214-
- name: Test glibc build on Ubuntu
215-
run: |
216-
(cd glibc && tar -xf ./far2l_glibc.tar.gz)
217-
ldd ./glibc/far2l
218-
./glibc/far2l --help | head -n2
219-
220-
- name: Test musl build on Ubuntu
221-
run: |
222-
apt update
223-
apt -y install musl
224-
ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
225-
(cd musl && tar -xf ./far2l_musl.tar.gz)
226-
ldd ./musl/far2l
227-
./musl/far2l --help | head -n2
228-
229-
far2l-release:
230-
needs: [alpine-far2l-test, ubuntu-far2l-test]
231-
232-
runs-on: ubuntu-latest
233-
steps:
234-
- uses: actions/download-artifact@v2
235-
with:
236-
name: far2l-linux-musl
237-
path: .
238-
- uses: actions/download-artifact@v2
239-
with:
240-
name: far2l-linux-glibc
241-
path: .
242-
- uses: ncipollo/release-action@v1
243-
with:
244-
tag: 'far2l-2.4.0-beta'
245-
body: 'farl without plugins'
246-
artifacts: '*.tar.gz'
247-
allowUpdates: true
248-
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/far2l.yml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: far2l
2+
3+
on: [pull_request, workflow_dispatch]
4+
5+
jobs:
6+
prejob:
7+
uses: ./.github/workflows/set-output-workflow.yml
8+
with:
9+
workflow: ${{ github.workflow }}
10+
secrets:
11+
_WORKFLOW: ${{ secrets._CURRENT_TOOL }}
12+
13+
far2l-alpine-musl:
14+
needs: prejob
15+
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
16+
uses: ./.github/workflows/build-alpine.yml
17+
with:
18+
workflow: ${{ github.workflow }}
19+
version: 3.12.9
20+
21+
far2l-ubuntu-glibc:
22+
needs: prejob
23+
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
24+
uses: ./.github/workflows/build-ubuntu.yml
25+
with:
26+
workflow: ${{ github.workflow }}
27+
version: 18.04
28+
29+
far2l-alpine-musl-test:
30+
needs: far2l-alpine-musl
31+
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
32+
uses: ./.github/workflows/test-alpine.yml
33+
with:
34+
artifact: build-musl
35+
test-run: |
36+
ldd ./${{ github.workflow }}
37+
./${{ github.workflow }} --help | head -n2
38+
39+
far2l-alpine-glibc-test:
40+
needs: far2l-ubuntu-glibc
41+
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
42+
uses: ./.github/workflows/test-alpine.yml
43+
with:
44+
artifact: build-glibc
45+
test-run: |
46+
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
47+
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk
48+
apk add --no-cache glibc-2.34-r0.apk
49+
50+
ldd ./${{ github.workflow }} || true
51+
./${{ github.workflow }} --help | head -n2
52+
53+
far2l-ubuntu-musl-test:
54+
needs: far2l-alpine-musl
55+
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
56+
uses: ./.github/workflows/test-ubuntu.yml
57+
with:
58+
artifact: build-musl
59+
test-run: |
60+
apt update
61+
apt -y install musl
62+
ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
63+
64+
ldd ./${{ github.workflow }}
65+
./${{ github.workflow }} --help | head -n2
66+
67+
far2l-ubuntu-glibc-test:
68+
needs: far2l-ubuntu-glibc
69+
if: ${{ needs.prejob.outputs.workflow == github.workflow }}
70+
uses: ./.github/workflows/test-ubuntu.yml
71+
with:
72+
artifact: build-glibc
73+
test-run: |
74+
ldd ./${{ github.workflow }}
75+
./${{ github.workflow }} --help | head -n2
76+
77+
far2l-release:
78+
needs: [far2l-alpine-musl-test,
79+
far2l-alpine-glibc-test,
80+
far2l-ubuntu-musl-test,
81+
far2l-ubuntu-glibc-test]
82+
uses: ./.github/workflows/release.yml
83+
with:
84+
workflow: ${{ github.workflow }}
85+
tool_version: '2.4.0-beta'
86+
prepare_body: |
87+
bsdtar -Oxf ./build-musl/build-musl.tar.gz build-musl.md >> body.md
88+
bsdtar -Oxf ./build-glibc/build-glibc.tar.gz build-glibc.md >> body.md
89+
artifacts: ./build-musl/*.tar.gz;./build-glibc/*.tar.gz
90+
secrets:
91+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
workflow:
5+
required: true
6+
type: string
7+
tool_version:
8+
required: true
9+
type: string
10+
prepare_body:
11+
required: true
12+
type: string
13+
artifacts:
14+
required: true
15+
type: string
16+
secrets:
17+
token:
18+
required: true
19+
jobs:
20+
release:
21+
runs-on: ubuntu-latest
22+
container: ubuntu:latest
23+
steps:
24+
- run: |
25+
apt update -y
26+
apt install -y libarchive-tools
27+
- uses: actions/download-artifact@v3
28+
- run: ${{ inputs.prepare_body }}
29+
- uses: ncipollo/release-action@v1
30+
with:
31+
tag: ${{ inputs.workflow }}-${{ inputs.tool_version }}
32+
bodyFile: './body.md'
33+
artifacts: ${{ inputs.artifacts }}
34+
allowUpdates: true
35+
token: ${{ secrets.GITHUB_TOKEN }}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
workflow:
5+
required: true
6+
type: string
7+
secrets:
8+
_WORKFLOW:
9+
required: true
10+
outputs:
11+
workflow:
12+
value: ${{ jobs.set-output.outputs.workflow }}
13+
14+
jobs:
15+
set-output:
16+
runs-on: ubuntu-latest
17+
environment: release
18+
outputs:
19+
workflow: ${{ steps.setvar.outputs.envvar }}
20+
steps:
21+
- id: setvar
22+
run: |
23+
echo ${{ secrets._WORKFLOW }} > CI_ENV
24+
echo "::set-output name=envvar::$(sed -e 's/^_//' CI_ENV)"
25+
- run: echo "workflow:" '${{ inputs.workflow }}', "OUTPUT_WORKFLOW:" '${{ steps.setvar.outputs.envvar }}'

.github/workflows/test-alpine.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
artifact:
5+
required: true
6+
type: string
7+
test-run:
8+
required: true
9+
type: string
10+
version:
11+
required: false
12+
type: string
13+
default: 'latest'
14+
15+
jobs:
16+
test-alpine:
17+
runs-on: ubuntu-latest
18+
container: alpine:${{ inputs.version }}
19+
20+
steps:
21+
- uses: actions/download-artifact@v3
22+
with:
23+
name: ${{ inputs.artifact }}
24+
path: .
25+
26+
- name: Test ${{ inputs.artifact }} build on alpine:${{ inputs.version }}
27+
run: |
28+
tar -xf ./${{ inputs.artifact }}.tar.gz
29+
${{ inputs.test-run }}
30+

.github/workflows/test-ubuntu.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
artifact:
5+
required: true
6+
type: string
7+
test-run:
8+
required: true
9+
type: string
10+
version:
11+
required: false
12+
type: string
13+
default: 'latest'
14+
15+
jobs:
16+
test-alpine:
17+
runs-on: ubuntu-latest
18+
container: ubuntu:${{ inputs.version }}
19+
20+
steps:
21+
- uses: actions/download-artifact@v3
22+
with:
23+
name: ${{ inputs.artifact }}
24+
path: .
25+
26+
- name: Test ${{ inputs.artifact }} build on ubuntu:${{ inputs.version }}
27+
run: |
28+
tar -xf ./${{ inputs.artifact }}.tar.gz
29+
${{ inputs.test-run }}
30+

0 commit comments

Comments
 (0)