Skip to content

Commit

Permalink
Use reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Aug 10, 2023
1 parent d9f536c commit 83b3820
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 126 deletions.
125 changes: 0 additions & 125 deletions .github/actions/run-in-docker-action/action.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
uses: actions/checkout@v3

- name: Run in Docker
uses: ./.github/actions/run-in-docker-action
uses: ./.github/workflows/run-in-docker.yml
with:
dockerfile: ./ci/linux-debian-wine.Dockerfile
tag: ci-image
Expand Down
126 changes: 126 additions & 0 deletions .github/workflows/run-in-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
on:
workflow_call:
inputs:
dockerfile:
required: true
type: string
tag:
required: true
type: string

jobs:
reusable_workflow_job:
runs-on: ubuntu-latest
steps:
- name: Set environment variables
run: |
read -r -a vars <<< "${{ matrix.configuration.env_vars }}"
for var in "${vars[@]}"; do
echo "$var" >> "$GITHUB_ENV"
done
echo "MAKEFLAGS=-j$(($(nproc) + 1))" >> "$GITHUB_ENV"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build container
uses: docker/build-push-action@v4
with:
context: .
file: ${{ inputs.dockerfile }}
tags: ${{ inputs.tag }}
push: false
load: true
cache-from: type=gha

- name: CI script
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
git config --global --add safe.directory ${{ github.workspace }} && \
./ci/cirrus.sh \
"
- name: tests.log
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
cat tests.log || true \
"
if: ${{ always() }}
- name: noverify_tests.log
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
cat noverify_tests.log || true \
"
if: ${{ always() }}
- name: exhaustive_tests.log
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
cat exhaustive_tests.log || true \
"
if: ${{ always() }}
- name: ctime_tests.log
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
cat ctime_tests.log || true \
"
if: ${{ always() }}
- name: bench.log
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
cat bench.log || true \
"
if: ${{ always() }}
- name: config.log
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
cat config.log || true \
"
if: ${{ always() }}
- name: test_env.log
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
cat test_env.log || true \
"
if: ${{ always() }}
- name: env
run: >
docker run \
$(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "-e \(.)"' | paste -sd " ") \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
${{ inputs.tag }} bash -c " \
env \
"
if: ${{ always() }}

0 comments on commit 83b3820

Please sign in to comment.