-
Notifications
You must be signed in to change notification settings - Fork 82
187 lines (156 loc) · 4.63 KB
/
pull_request.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
---
name: CI
on:
pull_request:
jobs:
lint-receptor:
name: lint-receptor
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.52
lint-receptorctl:
name: lint-receptorctl
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup up python
uses: actions/setup-python@v2
- name: Install tox
run: pip install tox
- name: Run receptorctl linters
run: make receptorctl-lint
receptor:
name: receptor (Go ${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ["1.19", "1.20"]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: build and install receptor
run: |
make build-all
sudo cp ./receptor /usr/local/bin/receptor
- name: Download kind binary
run: curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64 && chmod +x ./kind
- name: Create k8s cluster
run: ./kind create cluster
- name: Interact with the cluster
run: kubectl get nodes
- name: Run receptor tests with coverage
run: make coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: get k8s logs
if: ${{ failure() }}
run: .github/workflows/artifact-k8s-logs.sh
- name: remove sockets before archiving logs
if: ${{ failure() }}
run: find /tmp/receptor-testing -name controlsock -delete
- name: Artifact receptor data
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: test-logs
path: /tmp/receptor-testing
- name: Archive receptor binary
uses: actions/upload-artifact@v2
with:
name: receptor
path: /usr/local/bin/receptor
receptorctl:
name: receptorctl (Python ${{ matrix.python-version }})
needs: receptor
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download receptor
uses: actions/download-artifact@v2
with:
name: receptor
path: /usr/local/bin/
- name: Fix permissions on receptor binary
run: sudo chmod a+x /usr/local/bin/receptor
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: pip install tox
- name: Run receptorctl tests
run: make receptorctl-test
container:
name: container
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
- name: Install python dependencies
run: pip install build
- name: Build container
run: make container REPO=receptor LATEST=yes
- name: Write out basic config
run: |
cat << EOF > test.cfg
---
- local-only:
- control-service:
service: control
filename: /tmp/receptor.sock
- work-command:
worktype: cat
command: cat
EOF
- name: Run receptor (and wait a few seconds for it to boot)
run: |
podman run --name receptor -d -v $PWD/test.cfg:/etc/receptor/receptor.conf:Z localhost/receptor
sleep 3
podman logs receptor
- name: Submit work and assert the output we expect
run: |
output=$(podman exec -i receptor receptorctl work submit cat -l 'hello world' -f)
echo $output
if [[ "$output" != "hello world" ]]; then
echo "Output did not contain expected value"
exit 1
fi