-
Notifications
You must be signed in to change notification settings - Fork 4
63 lines (62 loc) · 1.68 KB
/
test.yaml
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
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Grafana Tanka and Jsonnet-Bundler
run: |
sudo curl -Lo /usr/local/bin/tk https://github.com/grafana/tanka/releases/latest/download/tk-linux-amd64
sudo chmod a+x /usr/local/bin/tk
sudo curl -Lo /usr/local/bin/jb https://github.com/jsonnet-bundler/jsonnet-bundler/releases/latest/download/jb-linux-amd64
sudo chmod a+x /usr/local/bin/jb
- name: Install dependencies
run: |
cd tests
jb install
- name: Run tests
run: |
export FAILED=0
cd tests
for f in environments/*/main.jsonnet; do
echo "$f"
if tk show "$f" --dangerous-allow-redirect > /dev/null; then
echo "OK"
else
echo "ERR"
export FAILED=1
fi
done
if [ "$FAILED" != "0" ]; then
echo "FAIL"
exit 1
else
echo "SUCCESS"
exit 0
fi
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Grafana Tanka
run: |
sudo curl -Lo /usr/local/bin/tk https://github.com/grafana/tanka/releases/latest/download/tk-linux-amd64
sudo chmod a+x /usr/local/bin/tk
- name: Test fmt
run: |
if $(tk fmt . 2>&1 | grep -q 'No changes'); then
echo "SUCCESS"
exit 0
else
echo "Formating needed. Please run 'tk fmt .'"
git diff
exit 1
fi