Skip to content

Commit 83b3820

Browse files
committed
Use reusable workflow
1 parent d9f536c commit 83b3820

File tree

3 files changed

+127
-126
lines changed

3 files changed

+127
-126
lines changed

.github/actions/run-in-docker-action/action.yml

-125
This file was deleted.

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
uses: actions/checkout@v3
8383

8484
- name: Run in Docker
85-
uses: ./.github/actions/run-in-docker-action
85+
uses: ./.github/workflows/run-in-docker.yml
8686
with:
8787
dockerfile: ./ci/linux-debian-wine.Dockerfile
8888
tag: ci-image

.github/workflows/run-in-docker.yml

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
dockerfile:
5+
required: true
6+
type: string
7+
tag:
8+
required: true
9+
type: string
10+
11+
jobs:
12+
reusable_workflow_job:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set environment variables
16+
run: |
17+
read -r -a vars <<< "${{ matrix.configuration.env_vars }}"
18+
for var in "${vars[@]}"; do
19+
echo "$var" >> "$GITHUB_ENV"
20+
done
21+
echo "MAKEFLAGS=-j$(($(nproc) + 1))" >> "$GITHUB_ENV"
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v2
25+
26+
- name: Build container
27+
uses: docker/build-push-action@v4
28+
with:
29+
context: .
30+
file: ${{ inputs.dockerfile }}
31+
tags: ${{ inputs.tag }}
32+
push: false
33+
load: true
34+
cache-from: type=gha
35+
36+
- name: CI script
37+
run: >
38+
docker run \
39+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
40+
--volume ${{ github.workspace }}:${{ github.workspace }} \
41+
--workdir ${{ github.workspace }} \
42+
${{ inputs.tag }} bash -c " \
43+
git config --global --add safe.directory ${{ github.workspace }} && \
44+
./ci/cirrus.sh \
45+
"
46+
47+
- name: tests.log
48+
run: >
49+
docker run \
50+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
51+
--volume ${{ github.workspace }}:${{ github.workspace }} \
52+
--workdir ${{ github.workspace }} \
53+
${{ inputs.tag }} bash -c " \
54+
cat tests.log || true \
55+
"
56+
if: ${{ always() }}
57+
- name: noverify_tests.log
58+
run: >
59+
docker run \
60+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
61+
--volume ${{ github.workspace }}:${{ github.workspace }} \
62+
--workdir ${{ github.workspace }} \
63+
${{ inputs.tag }} bash -c " \
64+
cat noverify_tests.log || true \
65+
"
66+
if: ${{ always() }}
67+
- name: exhaustive_tests.log
68+
run: >
69+
docker run \
70+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
71+
--volume ${{ github.workspace }}:${{ github.workspace }} \
72+
--workdir ${{ github.workspace }} \
73+
${{ inputs.tag }} bash -c " \
74+
cat exhaustive_tests.log || true \
75+
"
76+
if: ${{ always() }}
77+
- name: ctime_tests.log
78+
run: >
79+
docker run \
80+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
81+
--volume ${{ github.workspace }}:${{ github.workspace }} \
82+
--workdir ${{ github.workspace }} \
83+
${{ inputs.tag }} bash -c " \
84+
cat ctime_tests.log || true \
85+
"
86+
if: ${{ always() }}
87+
- name: bench.log
88+
run: >
89+
docker run \
90+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
91+
--volume ${{ github.workspace }}:${{ github.workspace }} \
92+
--workdir ${{ github.workspace }} \
93+
${{ inputs.tag }} bash -c " \
94+
cat bench.log || true \
95+
"
96+
if: ${{ always() }}
97+
- name: config.log
98+
run: >
99+
docker run \
100+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
101+
--volume ${{ github.workspace }}:${{ github.workspace }} \
102+
--workdir ${{ github.workspace }} \
103+
${{ inputs.tag }} bash -c " \
104+
cat config.log || true \
105+
"
106+
if: ${{ always() }}
107+
- name: test_env.log
108+
run: >
109+
docker run \
110+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
111+
--volume ${{ github.workspace }}:${{ github.workspace }} \
112+
--workdir ${{ github.workspace }} \
113+
${{ inputs.tag }} bash -c " \
114+
cat test_env.log || true \
115+
"
116+
if: ${{ always() }}
117+
- name: env
118+
run: >
119+
docker run \
120+
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
121+
--volume ${{ github.workspace }}:${{ github.workspace }} \
122+
--workdir ${{ github.workspace }} \
123+
${{ inputs.tag }} bash -c " \
124+
env \
125+
"
126+
if: ${{ always() }}

0 commit comments

Comments
 (0)