generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (101 loc) · 3.65 KB
/
main.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
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
name: main
on:
pull_request:
push:
branches:
- "main"
jobs:
build:
name: Build
runs-on: ubuntu-22.04
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make setup
- run: make lint
- run: make check-generate
- run: make test
- run: make build
- run: make image
kindtest:
name: Run test on kind
strategy:
matrix:
k8s-version: ["1.28.13", "1.29.8", "1.30.4"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Configure GIT
run: |
git config --global user.email "example@example.com"
git config --global user.name "ci-kindtest"
echo '${{ secrets.TESTREPO_DEPLOY_KEY }}' > /tmp/deploy-key.pem
chmod 600 /tmp/deploy-key.pem
- name: Create secret files
run: |
echo '${{ secrets.APP_PRIVATE_KEY }}' > .secret.private-key.pem
cat <<'EOF' > .secret.env.sh
export GITHUB_APP_ID=${{ secrets.APP_ID }}
export GITHUB_APP_INSTALLATION_ID=${{ secrets.APP_INSTALLATION_ID }}
export SLACK_CHANNEL=${{ secrets.SLACK_CHANNEL }}
export SLACK_APP_TOKEN=${{ secrets.SLACK_APP_TOKEN }}
export SLACK_BOT_TOKEN=${{ secrets.SLACK_BOT_TOKEN }}
EOF
- name: Clean up unnecessary files
run: |
docker image prune -af
sudo rm -rf /home/linuxbrew || true
sudo rm -rf /opt/az || true
sudo rm -rf /opt/microsoft || true
sudo rm -rf /opt/pipx || true
sudo rm -rf /opt/google || true
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /usr/local/share/boost || true
sudo rm -rf /usr/lib/jvm || true
sudo rm -rf /usr/share/swift || true
sudo rm -rf /usr/local/julia* || true
sudo rm -rf /usr/local/n || true
sudo rm -rf /usr/share/kotlinc || true
sudo rm -rf /usr/local/share/edge_driver || true
sudo rm -rf /usr/local/share/chromedriver-linux64 || true
sudo rm -rf /usr/local/share/gecko_driver || true
sudo rm -rf /usr/share/miniconda || true
sudo rm -rf /usr/local/share/phantomjs* || true
sudo rm -rf /usr/share/sbt || true
sudo rm -rf /usr/local/aws-cli || true
sudo rm -rf /usr/local/aws-sam-cli || true
sudo rm -rf /usr/local/sqlpackage || true
sudo rm -rf /usr/local/bin/minikube || true
sudo rm -rf /usr/local/bin/kustomize || true
sudo rm -rf /usr/local/bin/kubectl || true
sudo rm -rf /usr/local/bin/kind || true
sudo rm -rf /usr/local/bin/helm || true
- run: make setup KINDTEST_K8S_VERSION=${{ matrix.k8s-version }}
- run: make -C kindtest start KINDTEST_K8S_VERSION=${{ matrix.k8s-version }}
- run: make -C kindtest test
env:
GIT_SSH_COMMAND: "ssh -i /tmp/deploy-key.pem"
- run: make -C kindtest logs
if: always()
- name: Check disk usage and docker images
run: |
df -h
docker images
if: always()
- name: Check directory sizes
run: sudo du -sh /usr/local/* /home/* /opt/* /tmp/* /usr/* /var/* | sort -hr
if: always()
- uses: actions/upload-artifact@v4
if: always()
with:
name: logs-${{ matrix.k8s-version }}
path: ./tmp/logs/