-
-
Notifications
You must be signed in to change notification settings - Fork 617
109 lines (98 loc) · 2.92 KB
/
build.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
name: build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-ui:
name: test-ui
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm ci
- run: make lint-ui
- run: make test-ui
test-server:
name: test-server
runs-on: ubuntu-latest
services:
minio:
image: getfider/minio:0.0.2
ports:
- 9000:9000
env:
MINIO_ACCESS_KEY: s3user
MINIO_SECRET_KEY: s3user-s3cr3t
postgres:
image: postgres:12
env:
POSTGRES_USER: fider_ci
POSTGRES_PASSWORD: fider_ci_pw
POSTGRES_DB: fider_ci
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Use Go 1.16.2
uses: actions/setup-go@v2
with:
go-version: 1.16.2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm ci # required for esbuild
- name: install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.38.0
- name: install godotenv
run: go install github.com/joho/godotenv/cmd/godotenv
- run: make lint-server
- name: make test-server
run: |
mkdir ./dist
make test-server
env:
BLOB_STORAGE_S3_ENDPOINT_URL: http://localhost:9000
DATABASE_URL: postgres://fider_ci:fider_ci_pw@localhost:5432/fider_ci?sslmode=disable
build:
name: build
runs-on: ubuntu-latest
needs: [test-server, test-ui]
steps:
- uses: actions/checkout@v2
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: getfider/fider
tag-sha: ${{ github.event.workflow_run.event == 'push' }}
- name: extract variables
run: |
echo "##[set-output name=sha7;]$(echo ${GITHUB_SHA::7})"
echo sha7=${GITHUB_SHA::7}
id: vars
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
build-args: BUILDNUMBER=${{ steps.vars.outputs.sha7 }}
platforms: linux/amd64,linux/arm/v7
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}