-
Notifications
You must be signed in to change notification settings - Fork 3
155 lines (142 loc) · 4.1 KB
/
pr.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
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
name: PR Workflow
on:
pull_request:
branches:
- main
jobs:
test:
name: Run Tests
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set Up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Execute Tests
run: make test
lint:
name: Lint Code
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set Up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Run Linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.56.1
check-exclusions:
name: Check Exclusions
runs-on: ubuntu-22.04
outputs:
exclude_matrix: ${{ steps.determine-exclusions.outputs.exclude_matrix }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine Exclusions
id: determine-exclusions
run: |
if [[ -z "${{ github.event.before }}" || -z "${{ github.event.after }}" ]]; then
# Use base and head SHAs for the first PR commit.
base_sha="${{ github.event.pull_request.base.sha }}"
head_sha="${{ github.event.pull_request.head.sha }}"
else
# Use before and after SHAs for subsequent commits.
base_sha="${{ github.event.before }}"
head_sha="${{ github.event.after }}"
fi
exclude_matrix=$(bash ./scripts/determine_exclusions.sh "$base_sha" "$head_sha")
echo "exclude_matrix=${exclude_matrix}" >> $GITHUB_OUTPUT
build:
name: Build Docker Image - ${{ matrix.service }}
needs:
- test
- lint
- check-exclusions
runs-on: ubuntu-22.04
strategy:
matrix:
service:
- index
- library
- validation
- dataproxy
- nodecleaner
- revalidatenode
- schemaparser
- dataproxyupdater
- dataproxyrefresher
- maintenance
exclude: ${{ fromJSON(needs.check-exclusions.outputs.exclude_matrix) }}
steps:
- name: Checkout Code
if: matrix.service != ''
uses: actions/checkout@v4
- name: DockerHub Login
if: matrix.service != ''
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish Docker Image
if: matrix.service != ''
run: make docker-push-${{ matrix.service }} DEPLOY_ENV=pretest
deploy:
name: Deploy Services
needs:
- test
- lint
- check-exclusions
- build
runs-on: ubuntu-22.04
env:
SERVER_IP: ${{ secrets.PRETEST_SERVER_IP }}
KUBECONFIG_PATH: ${{ secrets.KUBECONFIG_PATH }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
EXCLUDE_MATRIX: ${{ needs.check-exclusions.outputs.exclude_matrix }}
DEPLOY_ENV: pretest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup SSH and Deploy Services
run: ./scripts/deploy-services.sh
e2e_test:
name: E2E Test
needs:
- test
- lint
- check-exclusions
- build
- deploy
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Newman
run: |
npm install -g newman
- name: Test Index
run: >
./scripts/wait_for_timeout.sh
https://pretest-index.murmurations.network/v2/ping 200 300
- name: Test Library
run: >
./scripts/wait_for_timeout.sh
https://pretest-library.murmurations.network/v2/ping 200 300
- name: Test Data Proxy
run: >
./scripts/wait_for_timeout.sh
https://pretest-data-proxy.murmurations.network/v1/ping 200 300
- name: Newman E2E Test
run: make newman-test DEPLOY_ENV=pretest