-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (111 loc) · 3.48 KB
/
lint-test-build.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: lint-test-build-push
on:
push:
paths-ignore:
- '**/*.md'
- 'ci/**'
- '.github/workflows/delete.yml'
- 'renovate.json5'
tags:
- '*'
branches:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: check valid yml
run: yq . ./examples/*/scyllaridae.yml
- name: check valid sh
run: shellcheck examples/*/*.sh
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
with:
go-version: '>=1.22.2'
- name: golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6
with:
version: latest
- name: Install dependencies
run: go get .
- name: Build
run: go build -v ./...
- name: Put fixture in place
run: cp scyllaridae.example.yml scyllaridae.yml
- name: Test with the Go CLI
run: go test -v -race ./...
build-push-base:
needs: [lint-test]
uses: ./.github/workflows/build-push.yml
with:
dockerFile: Dockerfile
permissions:
contents: read
id-token: write
secrets: inherit
find-images:
needs: [build-push-base]
name: Find docker images needing built
runs-on: ubuntu-latest
outputs:
dockerFiles: ${{ steps.images.outputs.dockerFiles }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Find docker files
id: images
run: |
dockerFiles=$(find examples -name Dockerfile | grep -v -E '(mergepdf|coverpage|ocrpdf)' | jq -c --raw-input --slurp 'split("\n")| .[0:-1]')
echo "dockerFiles=$dockerFiles" >> $GITHUB_OUTPUT
env:
GITHUB_REF: ${{ github.ref }}
build-push:
needs: [find-images]
strategy:
matrix:
dockerFile: ${{ fromJson(needs.find-images.outputs.dockerFiles )}}
uses: ./.github/workflows/build-push.yml
with:
dockerFile: ${{ matrix.dockerFile }}
permissions:
contents: read
id-token: write
secrets: inherit
build-push-dependencies:
needs: [build-push]
strategy:
matrix:
dockerFile: ["examples/coverpage/Dockerfile", "examples/mergepdf/Dockerfile", "examples/ocrpdf/Dockerfile",]
uses: ./.github/workflows/build-push.yml
with:
dockerFile: ${{ matrix.dockerFile }}
permissions:
contents: read
id-token: write
secrets: inherit
integration-tests:
needs: [build-push-dependencies]
name: Integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Extract branch name as docker tag
shell: bash
run: |-
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG=$(echo "${GITHUB_REF#refs/tags/}" | sed 's/[^a-zA-Z0-9._-]//g' | awk '{print substr($0, length($0)-120)}')
else
TAG=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/[^a-zA-Z0-9._-]//g' | awk '{print substr($0, length($0)-120)}')
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
id: extract_tag
- name: Run tests
id: images
run: ./ci/run.sh
env:
DOCKER_REPOSITORY_BASE: lehighlts/scyllaridae
DOCKER_TAG: ${{steps.extract_tag.outputs.tag}}