-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (50 loc) · 1.89 KB
/
test-build-deliver.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
name: Test, build, deliver
on:
push:
jobs:
test-build-deliver:
name: Test, build, deliver
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run DB and perfom migration
run: |
sudo systemctl start mysql.service
for f in ./.docker/mysql/docker-entrypoint-initdb.d/*.sql; do
mysql --host=127.0.0.1 --port=3306 --user=root --password=root < "$f"
done
- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.31.0
- name: Test
env:
MYSQL_DSN: root:root@(localhost:3306)/dpe_insights?parseTime=true
PLUGIN_GITHUB_OAUTH2_TOKEN: dummy-github-token
PLUGIN_GITHUB_ORGANIZATION_NAME: dummy-github-org
PLUGIN_GITHUB_OWNER_NAME: dummy-github-owner
PLUGIN_PAGER_DUTY_ACCESS_TOKEN: <Valid PD access token>
run: |
go test -v -mod=readonly -coverprofile c.out ./...
- name: Determine image tag based on the Git tag/branch
id: metadata
run: |
REF_NAME=$(echo ${GITHUB_REF#refs/*/} | sed -e 's/^v//')
TAG=$(printf $REF_NAME | tr -c '[[:alnum:]]._-' '_')
if [[ "$REF_NAME" == "main" || "$REF_NAME" == "master" ]]; then TAG=latest; fi
echo "::set-output name=tag::$TAG"
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/${{ github.repository }}/app:${{ steps.metadata.outputs.tag }}
- uses: docker/build-push-action@v2
with:
push: true
context: ./.docker/grafana
tags: ghcr.io/${{ github.repository }}/grafana:${{ steps.metadata.outputs.tag }}