-
-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (166 loc) · 6.71 KB
/
part_test.yml
File metadata and controls
197 lines (166 loc) · 6.71 KB
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
on:
workflow_call: {}
name: "Test"
permissions:
contents: read
jobs:
detectToolVersions:
name: "Detect Tool Versions"
runs-on: ubuntu-latest
outputs:
otpVersion: "${{ steps.toolVersions.outputs.OTP_VERSION }}"
elixirVersion: "${{ steps.toolVersions.outputs.ELIXIR_VERSION }}"
steps:
- name: Harden Runner
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: "Read .tool-versions"
id: toolVersions
run: |
OTP_VERSION="$(cat .tool-versions | grep erlang | cut -d' ' -f2-)"
echo OTP: $OTP_VERSION
echo "OTP_VERSION=${OTP_VERSION}" >> $GITHUB_OUTPUT
ELIXIR_VERSION="$(cat .tool-versions | grep elixir | cut -d' ' -f2-)"
echo Rebar: $ELIXIR_VERSION
echo "ELIXIR_VERSION=${ELIXIR_VERSION}" >> $GITHUB_OUTPUT
mix_format:
name: mix format
runs-on: ubuntu-latest
env:
MIX_ENV: dev
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
id: setupBEAM
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |-
deps
_build/${{ env.MIX_ENV }}
key: mix-${{ runner.os }}-${{ env.MIX_ENV }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ hashFiles('mix.lock') }}
restore-keys: |
mix-${{ runner.os }}-${{ env.MIX_ENV }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ steps.setupBEAM.outputs.otp-version }}-
- run: mix deps.get
- run: mix deps.compile
- run: mix compile --warning-as-errors
- run: mix format --check-formatted
mix_test:
name: mix test (${{ matrix.elixir }})
needs: ["detectToolVersions"]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- otp: '${{ needs.detectToolVersions.outputs.otpVersion }}'
elixir: '1.18.0'
runs-on: ubuntu-latest
- otp: '${{ needs.detectToolVersions.outputs.otpVersion }}'
elixir: '${{ needs.detectToolVersions.outputs.elixirVersion }}'
runs-on: ubuntu-latest
enable_coverage_export: 'true'
env:
MIX_ENV: test
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
submodules: 'true'
- uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
id: setupBEAM
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |-
deps
_build/${{ env.MIX_ENV }}
key: mix-${{ runner.os }}-${{ env.MIX_ENV }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ hashFiles('mix.lock') }}
restore-keys: |
mix-${{ runner.os }}-${{ env.MIX_ENV }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ steps.setupBEAM.outputs.otp-version }}-
- run: mix deps.get
- run: mix deps.compile
- run: mix compile --warning-as-errors
- run: mix coveralls.github
if: ${{ matrix.enable_coverage_export == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: mix test
if: ${{ !matrix.enable_coverage_export }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
credo:
name: mix credo
runs-on: ubuntu-latest
env:
MIX_ENV: dev
permissions:
contents: read
security-events: write
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
id: setupBEAM
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |-
deps
_build/${{ env.MIX_ENV }}
key: mix-${{ runner.os }}-${{ env.MIX_ENV }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ hashFiles('mix.lock') }}
restore-keys: |
mix-${{ runner.os }}-${{ env.MIX_ENV }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ steps.setupBEAM.outputs.otp-version }}-
- run: mix deps.get
- run: mix deps.compile
- run: mix compile --warning-as-errors
- run: mix credo --strict --format sarif > results.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
with:
sarif_file: results.sarif
category: credo
dialyxir:
name: mix dialyzer
runs-on: ubuntu-latest
env:
MIX_ENV: dev
steps:
- name: Harden Runner
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
id: setupBEAM
with:
version-file: .tool-versions
version-type: strict
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |-
deps
_build/${{ env.MIX_ENV }}
key: mix-${{ runner.os }}-${{ env.MIX_ENV }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ hashFiles('mix.lock') }}
restore-keys: |
mix-${{ runner.os }}-${{ env.MIX_ENV }}-${{ steps.setupBEAM.outputs.elixir-version }}-${{ steps.setupBEAM.outputs.otp-version }}-
- run: mix deps.get
- run: mix dialyzer