-
Notifications
You must be signed in to change notification settings - Fork 5
53 lines (51 loc) · 1.7 KB
/
main.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
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/setup-go@v3
with:
go-version: ^1.15.0
- name: Version check
run: |
node --version
npm --version
go version
- name: Install deps
run: |
cd ./frontend
npm ci --legacy-peer-deps
cd ../server/src
go mod download
- name: Start database
run: |
sudo /etc/init.d/mysql start
mysql -h127.0.0.1 -P3306 -uroot -proot -e "CREATE USER adb_user@localhost IDENTIFIED BY 'adbpassword';"
mysql -h127.0.0.1 -P3306 -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* to adb_user@localhost;"
mysql -h127.0.0.1 -P3306 -uroot -proot -e "CREATE DATABASE adb_db CHARACTER SET utf8 COLLATE utf8_general_ci;"
mysql -h127.0.0.1 -P3306 -uroot -proot -e "CREATE DATABASE adb_test_db CHARACTER SET utf8 COLLATE utf8_general_ci;"
- name: Run tests
run: |
./hooks/pre-commit
cd ./server/src
go test github.com/dxe/adb/...
- name: Deploy image to ECR
if: ${{ github.event_name == 'push' }} # don't deploy branches
uses: kciter/aws-ecr-action@master
with:
access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
account_id: ${{ secrets.AWS_ACCOUNT_ID }}
repo: dxe/adb
region: us-west-2
tags: latest,${{ github.sha }}