-
Notifications
You must be signed in to change notification settings - Fork 49
171 lines (146 loc) · 5.13 KB
/
test-release.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
name: Test & Release
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: FedericoCarboni/setup-ffmpeg@v3
- uses: actions/setup-go@v5
with:
go-version: '1.23'
id: go
- name: Retrieve release details
id: release_details
run: |
echo "APP_NAME=$(git describe --tags|sed -e 's/\-v.*//')" >> $GITHUB_ENV
echo "APP_VERSION=$(git describe --tags --match '*-v*'|sed 's/.*v\([0-9.]*\).*/\1/')" >> $GITHUB_ENV
- name: Release details
run: |
echo "::group::app ${{ env.APP_NAME }}"
echo "version ${{ env.APP_VERSION }}"
echo "env ${{ github.ref }}"
echo "::endgroup::"
- name: Set up containers
run: docker compose up -d
- name: Set up containers
run: docker compose -f apps/watchman/docker-compose.yml up -d clickhouse geoipupdate
- name: Check running containers
run: docker ps -a
- name: Prepare for tests
run: make prepare_test
- name: Wait for wallet init
run: scripts/wait_for_wallet.sh
- name: Test
env:
OAUTH_TEST_CLIENT_SECRET: ${{ secrets.OAUTH_TEST_CLIENT_SECRET }}
OAUTH_TEST_USERNAME: ${{ secrets.OAUTH_TEST_USERNAME }}
OAUTH_TEST_PASSWORD: ${{ secrets.OAUTH_TEST_PASSWORD }}
REAL_WALLET_PRIVATE_KEY: ${{ secrets.REAL_WALLET_PRIVATE_KEY }}
REAL_WALLET_PUBLIC_KEY: ${{ secrets.REAL_WALLET_PUBLIC_KEY }}
BUYER_WALLET_PRIVATE_KEY: ${{ secrets.BUYER_WALLET_PRIVATE_KEY }}
BUYER_WALLET_PUBLIC_KEY: ${{ secrets.BUYER_WALLET_PUBLIC_KEY }}
REFLECTOR_UPLINK: ${{ secrets.REFLECTOR_UPLINK }}
run: |
go install github.com/jandelgado/gcov2lcov@latest
go test -short -covermode=count -coverprofile=coverage.out ./... && gcov2lcov -infile=coverage.out -outfile=coverage.lcov
- uses: coverallsapp/github-action@v2
with:
file: coverage.lcov
github-token: ${{ secrets.GITHUB_TOKEN }}
release:
name: release
needs: test
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.23'
id: go
- run: git branch
- name: Retrieve release details
id: release
run: |
echo "APP_NAME=$(git describe --tags|sed -e 's/\-v.*//')" >> $GITHUB_ENV
echo "APP_VERSION=$(git describe --tags --match '*-v*'|sed 's/.*v\([0-9.]*\).*/\1/')" >> $GITHUB_ENV
- name: Release details
run: |
echo "::group::${{ env.APP_NAME }}"
echo "version ${{ env.APP_VERSION }}"
echo "env ${{ github.ref }}"
echo "::endgroup::"
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# odysee-api deployment
- name: Build odysee-api
if: env.APP_NAME == 'api'
run: make oapi
- name: Build and push odysee-api docker image
if: env.APP_NAME == 'api'
uses: docker/build-push-action@v2
with:
push: true
context: .
tags: |
odyseeteam/odysee-${{ env.APP_NAME }}:latest
odyseeteam/odysee-${{ env.APP_NAME }}:${{ env.APP_VERSION }}
- name: Deploy odysee-api
if: env.APP_NAME == 'api'
uses: octokit/[email protected]
id: deploy-odysee-api
env:
GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_REPO_TOKEN }}
with:
route: POST /repos/:repository/dispatches
repository: odyseeteam/misc-deployment
event_type: deploy-odysee
client_payload: |
tag: ${{ env.APP_VERSION }}
ref: ${{ github.ref }}
service: odysee-api
# Watchman deployment
- name: Build watchman
if: env.APP_NAME == 'watchman'
run: make watchman
- name: Build watchman docker image
if: env.APP_NAME == 'watchman'
uses: docker/build-push-action@v2
with:
push: true
context: apps/${{ env.APP_NAME }}/
tags: |
odyseeteam/${{ env.APP_NAME }}:latest
odyseeteam/${{ env.APP_NAME }}:${{ env.APP_VERSION }}
file: apps/${{ env.APP_NAME }}/Dockerfile
- name: Deploy watchman
if: env.APP_NAME == 'watchman'
uses: octokit/[email protected]
id: deploy-watchman
env:
GITHUB_TOKEN: ${{ secrets.DEPLOYMENT_REPO_TOKEN }}
with:
route: POST /repos/:repository/dispatches
repository: OdyseeTeam/misc-deployment
event_type: deploy-odysee
client_payload: |
tag: ${{ env.APP_VERSION }}
ref: ${{ github.ref }}
service: ${{ env.APP_NAME }}