-
-
Notifications
You must be signed in to change notification settings - Fork 511
130 lines (117 loc) · 4.19 KB
/
ci.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
129
130
# This file is autogenerated by the 'modulegen' tool.
# Please update the 'ci.yml' template instead.
name: Main pipeline
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
detect-modules:
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.set-modified-modules.outputs.modules }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- id: changed-files
name: Get changed files
uses: tj-actions/changed-files@v45
- id: set-modified-modules
name: Set all modified modules
env:
ALL_CHANGED_FILES: "${{ steps.changed-files.outputs.all_changed_files }}"
run: echo "modules=$(./scripts/changed-modules.sh)" >> $GITHUB_OUTPUT
- name: Print out the modules to be used
run: echo "${{ steps.set-modified-modules.outputs.modules }}"
lint:
needs: detect-modules
strategy:
matrix:
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
uses: ./.github/workflows/ci-lint-go.yml
with:
fail-fast: true
project-directory: "${{ matrix.module }}"
rootless-docker: false
ryuk-disabled: false
test:
needs:
- detect-modules
- lint
strategy:
matrix:
go-version: [1.22.x, 1.x]
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
uses: ./.github/workflows/ci-test-go.yml
with:
go-version: ${{ matrix.go-version }}
fail-fast: true
platforms: ${{ matrix.module == 'modulegen' && '["ubuntu-latest", "macos-latest", "windows-latest"]' || '["ubuntu-latest"]' }}
project-directory: "${{ matrix.module }}"
rootless-docker: false
ryuk-disabled: false
# The job below is a copy of the job above, but with ryuk disabled.
# It's executed in the first stage to avoid concurrency issues.
test-reaper-off:
# the core module is identified by the empty string (the root path)
if: ${{ contains(fromJSON(needs.detect-modules.outputs.modules), '') }}
needs:
- detect-modules
- lint
name: "Test with reaper off"
strategy:
matrix:
go-version: [1.22.x, 1.x]
uses: ./.github/workflows/ci-test-go.yml
with:
go-version: ${{ matrix.go-version }}
fail-fast: false
platforms: '["ubuntu-latest"]'
project-directory: "."
rootless-docker: false
ryuk-disabled: true
# The job below is a copy of the job above, but with Docker rootless.
# It's executed in the first stage to avoid concurrency issues.
test-rootless-docker:
# the core module is identified by the empty string (the root path)
if: ${{ contains(fromJSON(needs.detect-modules.outputs.modules), '') }}
needs:
- detect-modules
- lint
name: "Test with Rootless Docker"
strategy:
matrix:
go-version: [1.22.x, 1.x]
uses: ./.github/workflows/ci-test-go.yml
with:
go-version: ${{ matrix.go-version }}
fail-fast: false
platforms: '["ubuntu-latest"]'
project-directory: "."
rootless-docker: true
ryuk-disabled: false
sonarcloud:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for sonarsource/sonarcloud-github-action to determine which PR to decorate
if: ${{ github.ref_name == 'main' && github.repository_owner == 'testcontainers' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: sonarcloud
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@49e6cd3b187936a73b8280d59ffd9da69df63ec9 # v2.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}