-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (115 loc) · 5.04 KB
/
build-integration-test.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: CI - Build and Integration Test
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
- dev
jobs:
build:
name: Build and Integration Test
timeout-minutes: 30
runs-on: ubuntu-latest
env:
CONFIG_URL: ${{ secrets.CONFIG_URL }}
CONFIG_URL_RAYS: ${{ secrets.CONFIG_URL_RAYS }}
BORROW_DB_READ_CONNECTION_STRING: ${{ secrets.BORROW_DB_READ_CONNECTION_STRING }}
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
CONTENTFUL_PREVIEW_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_PREVIEW_ACCESS_TOKEN }}
CONTENTFUL_SPACE_ID: ${{ secrets.CONTENTFUL_SPACE_ID }}
MIXPANEL_KEY: ${{ secrets.MIXPANEL_KEY }}
NEXT_PUBLIC_MIXPANEL_KEY: ${{ secrets.NEXT_PUBLIC_MIXPANEL_KEY }}
SUBGRAPH_BASE: ${{ secrets.SUBGRAPH_BASE }}
SDK_API_URL: ${{ secrets.SDK_API_URL }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up turbo cache
uses: rharkor/[email protected]
- uses: pnpm/[email protected]
with:
version: 8.14.1
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- name: Setup Earn Protocol App Next.js Cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/apps/earn-protocol/.next/cache
key:
${{ runner.os }}-earn-protocol-app-${{ hashFiles('pnpm-lock.yaml') }}-${{
hashFiles('apps/earn-protocol/**/*.ts', 'apps/earn-protocol/**/*.tsx') }}
restore-keys: ${{ runner.os }}-earn-protocol-app-${{ hashFiles('pnpm-lock.yaml') }}-
- name: Setup Earn Protocol LP App Next.js Cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/apps/earn-protocol-landing-page/.next/cache
key:
${{ runner.os }}-earn-protocol-landing-page-app-${{ hashFiles('pnpm-lock.yaml') }}-${{
hashFiles('apps/earn-protocol-landing-page/**/*.ts',
'apps/earn-protocol-landing-page/**/*.tsx') }}
restore-keys:
${{ runner.os }}-earn-protocol-landing-page-app-${{ hashFiles('pnpm-lock.yaml') }}-
- name: Setup Rays Dashboard App Next.js Cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/apps/rays-dashboard/.next/cache
key:
${{ runner.os }}-rays-dashboard-app-${{ hashFiles('pnpm-lock.yaml') }}-${{
hashFiles('apps/rays-dashboard/**/*.ts', 'apps/rays-dashboard/**/*.tsx') }}
restore-keys: ${{ runner.os }}-rays-dashboard-app-${{ hashFiles('pnpm-lock.yaml') }}-
- name: Establish VPN connection
run: |
sudo apt update
sudo apt install -y openvpn openvpn-systemd-resolved
echo 'Configuring the VPN...'
echo "${{ secrets.VPN_CONFIG }}" > vpn-config.ovpn
echo "${{ secrets.VPN_USERNAME }}" > vpn-credentials.txt
echo "${{ secrets.VPN_PASSWORD }}" >> vpn-credentials.txt
echo 'Connecting to the VPN...'
sudo openvpn --config vpn-config.ovpn --auth-user-pass vpn-credentials.txt --daemon
sleep 10
- name: Check VPN connection
env:
BORROW_DB_READ_DB: ${{ secrets.BORROW_DB_READ_DB }}
BORROW_DB_READ_HOST: ${{ secrets.BORROW_DB_READ_HOST }}
BORROW_DB_READ_USER: ${{ secrets.BORROW_DB_READ_USER }}
BORROW_DB_READ_PASSWORD: ${{ secrets.BORROW_DB_READ_PASSWORD }}
PGCONNECT_TIMEOUT: 10
run: |
echo 'Checking the VPN connection...'
sudo systemctl start postgresql.service
PGPASSWORD=$BORROW_DB_READ_PASSWORD /usr/bin/psql -d $BORROW_DB_READ_DB -U $BORROW_DB_READ_USER -h $BORROW_DB_READ_HOST -c 'SELECT 1;' > /dev/null
STATUS_CODE=$?
if ! [[ "$STATUS_CODE" = 0 ]]; then
echo 'VPN connection failed'
exit 1
fi
echo 'VPN connected!'
- name: Install dependencies
run: pnpm install
# there was build and prebuild step here, but it was removed
# because integration tests are dependent on the build step
- name: Test
run: pnpm test:integration
env:
ONE_INCH_API_KEY: ${{ secrets.ONE_INCH_API_KEY }}
ONE_INCH_API_VERSION: ${{ secrets.ONE_INCH_API_VERSION }}
ONE_INCH_API_URL: ${{ secrets.ONE_INCH_API_URL }}
ONE_INCH_API_SPOT_KEY: ${{ secrets.ONE_INCH_API_SPOT_KEY }}
ONE_INCH_API_SPOT_VERSION: ${{ secrets.ONE_INCH_API_SPOT_VERSION }}
ONE_INCH_API_SPOT_URL: ${{ secrets.ONE_INCH_API_SPOT_URL }}
ONE_INCH_ALLOWED_SWAP_PROTOCOLS: ${{ secrets.ONE_INCH_ALLOWED_SWAP_PROTOCOLS }}
ONE_INCH_SWAP_CHAIN_IDS: ${{ secrets.ONE_INCH_SWAP_CHAIN_IDS }}
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
- name: Coverage
run: pnpm coverage:total
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}