Merge pull request #211 from dxe/alex/chaptercolor #507
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |