-
Notifications
You must be signed in to change notification settings - Fork 97
117 lines (101 loc) · 3.42 KB
/
ci.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
110
111
112
113
114
115
116
117
name: CI
on: push
jobs:
test:
runs-on: ubuntu-22.04
services:
db:
image: postgres:10
env:
POSTGRES_DB: accent_test
POSTGRES_PASSWORD: password
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
MIX_ENV: test
DATABASE_URL: postgres://postgres:password@localhost/accent_test
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: erlef/setup-beam@v1
id: setup-beam
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@v3
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-mix-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles(format('{0}/mix.lock', github.workspace)) }}
- uses: actions/setup-node@v4
with:
node-version-file: .tool-versions
cache: npm
cache-dependency-path: |
package-lock.json
cli/package-lock.json
jipt/package-lock.json
webapp/package-lock.json
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc libyaml-dev
- name: Install Elixir Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
- name: Install NodeJS Dependencies
run: |
npm set fund false
npm set audit false
npm set color false
npm ci
npm ci --prefix webapp
npm ci --prefix cli
npm ci --prefix jipt
- name: Build webapp production
run: npm run build-production-inline --prefix webapp
- name: Run Tests
run: |
mix ecto.setup
./priv/scripts/ci-check.sh
- name: Build CLI
run: npm --prefix cli run build
- name: Build JIPT
run: npm --prefix jipt run build-production-inline
- name: Coverage report
run: mix coveralls.post --token ${{ secrets.COVERALLS_REPO_TOKEN }} --name 'github-actions' --branch ${{ github.ref }} --committer ${{ github.actor }} --sha ${{ github.sha }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.MIREGO_GITHUB_PACKAGES_ACCESS_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
mirego/accent
ghcr.io/mirego/accent
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{raw}}
- uses: docker/build-push-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
push: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}