forked from danhper/opencov
-
Notifications
You must be signed in to change notification settings - Fork 1
209 lines (202 loc) · 6.23 KB
/
tests.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Tests
on: push
jobs:
assets_dependencies:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- uses: actions/setup-node@v2
id: node-install
with:
node-version: lts/*
cache: yarn
- name: Install dependencies
if: steps.node-install.outputs.cache-hit != 'true'
run: |
yarn install --frozen-lockfile
linters:
needs: assets_dependencies
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- uses: actions/setup-node@v2
id: node-install
with:
node-version: lts/*
cache: yarn
- name: Install dependencies
run: |
yarn install --frozen-lockfile
- run: yarn eslint .
dependencies:
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
elixir: ["1.13"]
otp: ["24.1"]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- name: Sets up an Erlang/OTP environment
uses: erlef/setup-beam@v1
id: beam
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve cached dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('mix.lock') }}-v2
- name: Install dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
mix dialyzer --plt
mix compile
static-code-analysis:
needs: dependencies
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
elixir: ["1.13"]
otp: ["24.1"]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- name: Sets up an Erlang/OTP environment
uses: erlef/setup-beam@v1
id: beam
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve cached dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('mix.lock') }}-v2
- run: mix format --check-formatted
- run: mix credo
- run: mix dialyzer --no-check --ignore-exit-status
mix-test:
runs-on: ubuntu-latest
needs: dependencies
env:
MIX_ENV: test
strategy:
matrix:
elixir: ["1.13"]
otp: ["24.1"]
services:
db:
image: postgres:13-alpine
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14.x
- uses: c-hive/gha-yarn-cache@v2
- name: Sets up an Erlang/OTP environment
uses: erlef/setup-beam@v1
id: beam
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve cached dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('mix.lock') }}-v2
- name: Install NPM Packages (Global)
run: yarn install
- name: Seed
run: |
MIX_ENV=test mix ecto.setup
- run: mix coveralls.json --trace --slowest 10
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: cover/excoveralls.json
fail_ci_if_error: true
- name: LibreCov
env:
SHA: ${{github.sha}}
BRANCH: ${{ steps.branch-name.outputs.current_branch }}
TOKEN: ${{ secrets.OPENCOV_TOKEN }}
COVERALLS_ENDPOINT: ${{ secrets.OPENCOV_ENDPOINT }}
run: |
MIX_ENV=test mix coveralls.post \
--name github \
--build "$GITHUB_RUN_ID" \
--sha "$SHA" \
--committer "$(git log -1 $SHA --pretty=format:'%cN')" \
--message "$(git log -1 $SHA --pretty=format:'%s')" \
--branch "$BRANCH" \
--token "$TOKEN"
- name: LibreCov Staging
continue-on-error: true
env:
SHA: ${{github.sha}}
BRANCH: ${{ steps.branch-name.outputs.current_branch }}
TOKEN: ${{ secrets.OPENCOV_TOKEN }}
COVERALLS_ENDPOINT: https://librecov-staging.herokuapp.com
run: |
MIX_ENV=test mix coveralls.post \
--name github \
--build "$GITHUB_RUN_ID" \
--sha "$SHA" \
--committer "$(git log -1 $SHA --pretty=format:'%cN')" \
--message "$(git log -1 $SHA --pretty=format:'%s')" \
--branch "$BRANCH" \
--token "$TOKEN"