-
Notifications
You must be signed in to change notification settings - Fork 3
94 lines (84 loc) · 3.45 KB
/
Copy pathintegration-test.yml
File metadata and controls
94 lines (84 loc) · 3.45 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
name: Integration Tests
run-name: "Integration Tests #${{ github.run_id }}"
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
outputs:
test-matrix: ${{ steps.labels.outputs.matrix }}
known-labels: ${{ steps.labels.outputs.known }}
steps:
- name: Configure test labels
id: labels
run: |
# Add new labels here; 'unlabeled' is appended automatically for the matrix.
KNOWN="workspace,list,error-handling,log,pipeline,git,wakeup,curl,local"
echo "known=$KNOWN" >> "$GITHUB_OUTPUT"
echo "matrix=[\"$(echo "$KNOWN" | sed 's/,/","/g')\",\"unlabeled\"]" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version-file: 'go.mod'
- name: Build CLI and test binary
run: |
make build
go test -c -o int.test ./int
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: test-artifacts-${{ github.run_id }}
path: |
cs
int.test
retention-days: 1
integration-tests:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
label: ${{ fromJSON(needs.build.outputs.test-matrix) }}
env:
CS_TOKEN: ${{ secrets.CS_TOKEN }}
CS_API: ${{ secrets.CS_API }}
CS_TEAM_ID: ${{ secrets.CS_TEAM_ID }}
steps:
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: test-artifacts-${{ github.run_id }}
- name: Make binaries executable
run: chmod +x ./cs ./int.test
- name: Install linting tools
if: matrix.label == 'local'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
HADOLINT_VERSION=$(gh release view --repo hadolint/hadolint --json tagName -q '.tagName')
[ -n "$HADOLINT_VERSION" ] || { echo "::error::Failed to fetch hadolint version"; exit 1; }
sudo curl -fsSL -o /usr/local/bin/hadolint \
"https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-x86_64"
sudo chmod +x /usr/local/bin/hadolint
hadolint --version
KUBECONFORM_VERSION=$(gh release view --repo yannh/kubeconform --json tagName -q '.tagName')
[ -n "$KUBECONFORM_VERSION" ] || { echo "::error::Failed to fetch kubeconform version"; exit 1; }
curl -fsSL "https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" | \
sudo tar xz -C /usr/local/bin
kubeconform -v
- name: Run integration tests - ${{ matrix.label }}
run: |
mkdir -p int
mv int.test int/
cd int
if [ "${{ matrix.label }}" = "unlabeled" ]; then
echo "::warning::Running tests without a known label. If tests are found here, please add a label to the Describe block."
FILTER=$(echo "${{ needs.build.outputs.known-labels }}" | sed 's/[^,]*/!\0/g; s/,/ \&\& /g')
./int.test -test.v -ginkgo.label-filter="$FILTER"
else
./int.test -test.v -ginkgo.label-filter='${{ matrix.label }}'
fi