-
-
Notifications
You must be signed in to change notification settings - Fork 7
83 lines (77 loc) · 2.61 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
name: ElixirXDR CI
on:
push:
branches:
- main
- 'v*.[0-9]'
pull_request:
permissions:
contents: read
jobs:
tests:
name: Run tests
runs-on: ubuntu-20.04
strategy:
matrix:
otp: ['22.3']
elixir: ['1.10', '1.11']
env:
MIX_ENV: test
steps:
- name: Harden Runner
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
coveralls.io:443
github.com:443
repo.hex.pm:443
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: erlef/setup-elixir@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-mix-
- name: Install Dependencies
run: |
rm -rf deps _build
mix deps.get
- name: Check Formatting
run: mix format --check-formatted
- name: Run Tests
run: mix test
- name: Run credo
run: mix credo --strict
- name: Run Excoveralls
run: mix coveralls.github --parallel --flagname otp-${{ matrix.otp }}-elixir-${{ matrix.elixir }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
finish:
needs: tests
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
coveralls.io:443
- name: Set BUILD_NUMBER for Pull Request event
if: github.event_name == 'pull_request'
run: echo "BUILD_NUMBER=${{ github.event.pull_request.head.sha }}-PR-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
- name: Set BUILD_NUMBER for Push event
if: github.event_name == 'push'
run: echo "BUILD_NUMBER=${{ github.sha }}" >> $GITHUB_ENV
- name: Publish Coverage Report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
run: |
curl -k "https://coveralls.io/webhook" -d "repo_token=$GITHUB_TOKEN&repo_name=$GITHUB_REPOSITORY&payload[build_num]=$BUILD_NUMBER&payload[status]=done"