-
-
Notifications
You must be signed in to change notification settings - Fork 11
109 lines (94 loc) · 3.26 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
name: StellarBase 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: ['23.3']
elixir: ['1.11', '1.12']
env:
MIX_ENV: test
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
coveralls.io:443
github.com:443
repo.hex.pm:443
builds.hex.pm:443
- name: Checkout Github repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Sets up an Erlang/OTP environment
uses: erlef/setup-elixir@5304e04ea2b355f03681464e683d92e3b2f18451 # v1.18.2
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Set mix file hash
id: set_vars
run: |
mix_hash="${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}"
echo "::set-output name=mix_hash::$mix_hash"
- name: Cache dependecies
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: deps
key: ${{ runner.os }}-mix-${{ steps.set_vars.outputs.mix_hash }}
restore-keys: |
${{ runner.os }}-mix-
- name: Cache PLT files
id: plt-cache
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
_build
priv/plts
key: plt-cache-${{ steps.set_vars.outputs.mix_hash }}
restore-keys: |
plt-cache-
- name: Install dependencies
run: mix deps.get
- name: Check formatting
run: mix format --check-formatted
- name: Run credo
run: mix credo --strict
- name: Run dialyzer
run: mix dialyzer --no-check --ignore-exit-status
- name: Run tests and 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-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
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"