-
Notifications
You must be signed in to change notification settings - Fork 183
65 lines (61 loc) · 1.99 KB
/
scripts-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: test for rocker scripts
on:
pull_request:
branches:
- master
paths:
- tests/rocker_scripts/Dockerfile
- tests/rocker_scripts/matrix.json
- tests/rocker_scripts/test.sh
- scripts/*.sh
- "!scripts/install_R_*.sh"
- "!scripts/setup_R.sh"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
CONTENT=$(jq 'tostring' -r tests/rocker_scripts/matrix.json)
echo ::set-output name=matrix::"${CONTENT}"
echo "${CONTENT}"
build:
needs: generate_matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate_matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Prepare build
id: prep
run: |
lower_script_name=$(echo ${{ matrix.script_name }} | tr '[:upper:]' '[:lower:]')
test_name="${{ matrix.base_image }}-${{ matrix.tag }}-${lower_script_name}-${{ matrix.script_arg }}"
echo ::set-output name=output_tag::"${test_name/"/"/"-"}"
- name: test build
run: |
docker buildx build . -f tests/rocker_scripts/Dockerfile \
--output=type=docker \
--build-arg base_image=${{ matrix.base_image }} \
--build-arg tag=${{ matrix.tag }} \
--build-arg script_name=${{ matrix.script_name }} \
--build-arg script_arg=${{ matrix.script_arg }} \
--tag ${{ steps.prep.outputs.output_tag }}
- name: inspect image
run: |
make inspect-image/"${{ steps.prep.outputs.output_tag }}"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: tmp
path: tmp