-
Notifications
You must be signed in to change notification settings - Fork 22
135 lines (119 loc) · 4.59 KB
/
devcontainer-podman.yml
File metadata and controls
135 lines (119 loc) · 4.59 KB
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
131
132
133
134
135
name: CI (Podman Devcontainer)
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
permissions:
contents: read
checks: write
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
devcontainer-checks:
name: Devcontainer CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if codegen inputs changed
id: codegen
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE="${{ github.event.pull_request.base.sha }}"
elif [[ -n "${{ github.event.before }}" && "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then
BASE="${{ github.event.before }}"
else
echo "needed=true" >> "$GITHUB_OUTPUT"
echo "no base ref available, running codegen"
exit 0
fi
CHANGED=$(git diff --name-only "$BASE" HEAD -- \
singularity.go docgen.sh 'api/' 'handler/' 'cmd/' \
'storagesystem/' 'docs/gen/' 'model/' || true)
if [[ -n "$CHANGED" ]]; then
echo "needed=true" >> "$GITHUB_OUTPUT"
else
echo "needed=false" >> "$GITHUB_OUTPUT"
fi
echo "changed files for codegen: ${CHANGED:-none}"
- name: Setup Podman as Docker
uses: parkan/github-actions/setup-podman-docker@v3
with:
disable-docker: true
cache-storage: true
- name: Build devcontainer
id: build
uses: parkan/github-actions/devcontainer-build@v3
with:
workspace-folder: .
container-runtime: podman
container-id-label: ci=podman
- name: Generate swagger code
if: steps.codegen.outputs.needed == 'true'
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && go generate ./...'
container-runtime: podman
- name: Check formatting
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && gofmt -w . && git diff --exit-code'
container-runtime: podman
- name: Run go vet
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && go vet ./...'
container-runtime: podman
- name: Run staticcheck
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && staticcheck ./...'
container-runtime: podman
- name: Build binary
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && go build -o singularity .'
container-runtime: podman
- name: Run tests
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: >
cd /workspaces/singularity && mkdir -p artifacts && make test GOTESTSUM_ARGS="--junitfile artifacts/unit-tests.xml"
container-runtime: podman
- name: Run integration tests
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: >
cd /workspaces/singularity &&
mkdir -p artifacts &&
SINGULARITY_TEST_INTEGRATION=true make test GOTESTSUM_ARGS="--junitfile artifacts/integration-tests.xml -- -timeout 20m -run Integration ./cmd/... ./service/pdptracker/..."
container-runtime: podman
- name: Report test results
if: always()
uses: dorny/test-reporter@v2
with:
name: Go tests
path: artifacts/*.xml
reporter: java-junit
list-tests: failed
use-actions-summary: true
fail-on-error: false
- name: Cleanup
if: always()
uses: parkan/github-actions/devcontainer-cleanup@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
container-runtime: podman