-
Notifications
You must be signed in to change notification settings - Fork 16
130 lines (115 loc) · 3.89 KB
/
docker.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
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
name: docker
on:
pull_request:
paths:
- .github/workflows/docker.yaml
- Dockerfile
- go.*
- api/**
- internal/**
- e2e_test/**
- '!**/*_test.go'
- '!**/*.md'
push:
branches:
- main
tags:
- v*
paths:
- .github/workflows/docker.yaml
- Dockerfile
- go.*
- api/**
- internal/**
- e2e_test/**
- '!**/*_test.go'
- '!**/*.md'
jobs:
go-version:
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
go-version: ${{ steps.go-version.outputs.go-version }}
steps:
- uses: actions/checkout@v4
- id: go-version
run: echo "go-version=$(sed -ne '/^go /s/^go //p' go.mod)" >> "$GITHUB_OUTPUT"
build:
needs: go-version
uses: int128/docker-build-workflow/.github/workflows/build.yaml@v1
with:
platforms: linux/amd64,linux/arm64
build-args: go_version=${{ needs.go-version.outputs.go-version }}
e2e-test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
# set up the test environment
- uses: actions/create-github-app-token@v1
id: e2e-test-token
with:
app-id: ${{ secrets.E2E_SETUP_GITHUB_APP_ID }}
private-key: ${{ secrets.E2E_SETUP_GITHUB_APP_PRIVATE_KEY }}
repositories: argocd-commenter-e2e-test
- uses: actions/checkout@v4
with:
token: ${{ steps.e2e-test-token.outputs.token }}
repository: int128/argocd-commenter-e2e-test
path: e2e_test/argocd-commenter-e2e-test-repository
- run: make -C e2e_test setup-fixture-branch
- run: make -C e2e_test cluster
- run: make -C e2e_test deploy-argocd
- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}
# set outputs.tags to single tag
flavor: latest=false
- uses: int128/wait-for-docker-image-action@v1
with:
tags: ${{ steps.metadata.outputs.tags }}
- run: make -C e2e_test deploy-controller
env:
CONTROLLER_IMAGE: ${{ steps.metadata.outputs.tags }}
GITHUB_APP_ID: ${{ secrets.E2E_GITHUB_APP_ID }}
GITHUB_APP_INSTALLATION_ID: ${{ secrets.E2E_GITHUB_APP_INSTALLATION_ID }}
GITHUB_APP_PRIVATE_KEY: ${{ secrets.E2E_GITHUB_APP_PRIVATE_KEY }}
- run: make -C e2e_test wait-for-apps
# test
- uses: int128/deployment-action@v1
id: deployment-app1
with:
environment-suffix: /app1
- uses: int128/deployment-action@v1
id: deployment-app2
with:
environment-suffix: /app2
- uses: int128/deployment-action@v1
id: deployment-app3
with:
environment-suffix: /app3
- run: make -C e2e_test deploy-app1
env:
PULL_REQUEST_BODY: "e2e-test ${{ github.repository }}#${{ github.event.pull_request.number }}"
DEPLOYMENT_URL: ${{ steps.deployment-app1.outputs.url }}
GITHUB_TOKEN: ${{ steps.e2e-test-token.outputs.token }}
- run: make -C e2e_test restart-app1
- run: make -C e2e_test deploy-app2
env:
PULL_REQUEST_BODY: "e2e-test ${{ github.repository }}#${{ github.event.pull_request.number }}"
DEPLOYMENT_URL: ${{ steps.deployment-app2.outputs.url }}
GITHUB_TOKEN: ${{ steps.e2e-test-token.outputs.token }}
- run: make -C e2e_test deploy-app3
env:
PULL_REQUEST_BODY: "e2e-test ${{ github.repository }}#${{ github.event.pull_request.number }}"
DEPLOYMENT_URL: ${{ steps.deployment-app3.outputs.url }}
GITHUB_TOKEN: ${{ steps.e2e-test-token.outputs.token }}
# show logs
- run: make -C e2e_test logs-argocd
if: always()
- run: make -C e2e_test logs-controller
if: always()