-
Notifications
You must be signed in to change notification settings - Fork 5
181 lines (157 loc) · 6.03 KB
/
ci-solana.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
---
name: "CI Tests - Solana"
on: push
jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.23
if: success()
uses: actions/setup-go@v3
with:
go-version: 1.23
- name: Checkout code
if: success()
uses: actions/checkout@v3
- name: Download module dependencies
if: success()
env:
GOPROXY: "https://proxy.golang.org"
run: |
go clean -modcache
go mod download
- name: Copy config to /etc/metrikad
if: success()
run: |
sudo rm -rf /etc/metrikad;
sudo mkdir -vp /etc/metrikad;
sudo chown -R ${USER} /etc/metrikad
cp -r configs /etc/metrikad/
- name: Install libsystemd-dev
run: |
sudo apt-get update
sudo apt-get install -y libsystemd-dev
- name: Run go test
if: success()
id: tests
run: make test-solana
- name: Slack Notification Failure
if: failure()
id: status
uses: rtCamp/action-slack-notify@v2
env:
SLACK_MESSAGE: "${{ github.event.head_commit.message }}"
SLACK_TITLE: GitHub CI Agent tests
SLACK_WEBHOOK: ${{ secrets.METRIKA_SLACK_NON_PROD_WEBHOOK }}
SLACK_ICON: https://app.metrika.co/logo192.png?size=48
SLACK_CHANNEL: "cicd-node-agent"
SLACK_USERNAME: "github-ci-metrika-agent"
SLACK_COLOR: ${{ job.status }}
SLACK_FOOTER: "Sent by GitHub CI from Metrika Agent repo"
agent_install_tests:
name: Agent Install Tests
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.23
if: success()
uses: actions/setup-go@v3
with:
go-version: 1.23
- name: Checkout code
if: success()
uses: actions/checkout@v3
- name: "Get tag data"
if: success()
id: git_tags
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git fetch --prune --unshallow
- name: Download module dependencies
if: success()
env:
GOPROXY: "https://proxy.golang.org"
run: |
go clean -modcache
go mod download
- name: Get latest release tag
if: success()
id: git_last_tag
run: |
echo '::set-output name=previous_tag::$(git tag --sort=version:refname | grep -E "v[0-9]+.[0-9]+.[0-9]+$" | tail -n1)'
- name: Run Agent Install Tests - Solana
if: success()
id: run_agent_install_tests_solana
env:
MA_PLATFORM: amd64
MA_BLOCKCHAIN: solana
INSTALLER_STATUS: ""
run: |
if ! MA_BLOCKCHAIN=$MA_BLOCKCHAIN ./install.sh --prerelease >installer.log 2>&1; then
cat installer.log
echo "::set-output name=installer_status::Installer exited with error"
exit 1
fi
# if ! grep -i 'Latest Release:' installer.log | grep -i "$(echo ${{ steps.git_last_tag.outputs.previous_tag }} | cut -d 'v' -f2)"; then
# # expected_ver=$(echo ${{ steps.git_last_tag.outputs.previous_tag }} | cut -d 'v' -f2)
# expected_ver="solana-pre"
# found_ver=$(grep -i 'Latest Release:' installer.log | cut -d ':' -f2)
# echo "::set-output name=installer_status::Installer tag is not latest tag $found_ver - Expected $expected_ver"
# exit 1
# fi
cat /etc/passwd | grep -i metrikad
if ! grep -iq "metrikad" /etc/passwd; then
echo "::set-output name=installer_status::Metrikad user not found"
exit 1
fi
if [[ ! -e /etc/metrikad/configs || ! -d /etc/metrikad/configs ]]; then
echo "::set-output name=installer_status::/etc/metrikad/configs does not exist or it is not a directory"
exit 1
fi
if [[ ! -e /opt/metrikad || ! -d /opt/metrikad ]]; then
echo "::set-output name=installer_status::/opt/metrikad does not exist or it is not a directory"
exit 1
fi
if ! systemctl list-unit-files | grep -iE "^metrikad-solana"; then
echo "::set-output name=installer_status::metrikad systemd unit does not exist"
exit 1
fi
if ! systemctl is-active metrikad-solana.service >/dev/null; then
echo "::set-output name=installer_status::metrikad systemd unit is not running"
exit 1
fi
if ! systemctl is-enabled metrikad-solana.service >/dev/null; then
echo "::set-output name=installer_status::metrikad systemd unit is not enabled"
exit 1
fi
- name: Slack Notification Failure - Solana
if: failure()
id: status_failure_solana
uses: rtCamp/action-slack-notify@v2
env:
SLACK_MESSAGE: "${{ steps.run_agent_install_tests_solana.outputs.installer_status }}"
SLACK_TITLE: GitHub CI Agent Install Tests
SLACK_WEBHOOK: ${{ secrets.METRIKA_SLACK_NON_PROD_WEBHOOK }}
SLACK_ICON: https://app.metrika.co/logo192.png?size=48
SLACK_CHANNEL: "cicd-node-agent"
SLACK_USERNAME: "github-ci-metrika-agent"
SLACK_COLOR: ${{ job.status }}
SLACK_FOOTER: "Sent by GitHub CI from Metrika Agent repo"
reports:
needs: agent_install_tests
name: CI Report - Solana
runs-on: ubuntu-latest
steps:
- name: Slack Notification Success
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_MESSAGE: "${{ github.event.head_commit.message }}"
SLACK_TITLE: GitHub CI Agent
SLACK_WEBHOOK: ${{ secrets.METRIKA_SLACK_NON_PROD_WEBHOOK }}
SLACK_ICON: https://avatars.githubusercontent.com/u/72256945?s=400&u=69542ec14c7e72b8e1c203782d63e653d6853f0e&v=4&size=48
SLACK_CHANNEL: "cicd-node-agent"
SLACK_USERNAME: "github-ci-metrika-agent"
SLACK_COLOR: ${{ job.status }}
SLACK_FOOTER: "Sent by GitHub CI from Metrika Agent repo"