-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
170 lines (156 loc) · 4.91 KB
/
action.yml
File metadata and controls
170 lines (156 loc) · 4.91 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
name: 'Elixir CI'
description: 'Runs Elixir compile, test, dialyzer commands'
inputs:
mix-env:
description: 'MIX_ENV variable'
required: false
default: "test"
mix-env-test:
description: 'MIX_ENV variable for tests'
required: false
default: "test"
run-tests:
description: 'Wether to run mix test or not'
required: false
default: 'True'
tests-flags:
description: 'Flags to append to the mix test command (e.g. --only tag or --no-start, etc.)'
required: false
default: ''
working-directory:
description: 'Working directory'
required: false
default: '.'
release:
description: "Wether to run mix release and upload artifact or not"
required: false
default: 'False'
release-name:
description: "The name of the uploaded release"
required: false
default: "release"
release-upload:
description: "Wether to upload the artifact or not"
required: false
default: 'False'
build-cache-key-suffix:
description: "Suffix to add to the build cache key"
required: false
default: ""
plt-cache-key-suffix:
description: "Suffix to add to the plt cache key"
required: false
default: ""
plt-restore-cache:
description: "If false it won't retrieve cache from other restore keys"
required: false
default: "True"
compile-options:
description: "Specify the compile option parameter"
required: false
default: "--warnings-as-errors"
runs:
using: 'composite'
steps:
- name: Restore build and dependencies cache
id: mix-build-dep-cache
uses: actions/cache@v2
with:
path: |
${{inputs.working-directory}}/deps
${{inputs.working-directory}}/_build
key: ${{ runner.os }}-mix-build-dep-${{ inputs.mix-env }}-${{ hashFiles(env.HASH_FILES_PATH) }}${{ inputs.build-cache-key-suffix }}
env:
HASH_FILES_PATH: "${{inputs.working-directory}}/mix.lock"
- name: Restore plt cache
if: inputs.plt-restore-cache != 'False'
id: mix-plt-cache
uses: actions/cache@v2
with:
path: |
${{inputs.working-directory}}/priv/plts
key: ${{ runner.os }}-mix-plt-${{ inputs.mix-env }}-${{ hashFiles(env.HASH_FILES_PATH) }}${{ inputs.plt-cache-key-suffix }}
restore-keys: |
${{ runner.os }}-mix-plt-${{ inputs.mix-env }}
${{ runner.os }}-mix-plt
env:
HASH_FILES_PATH: "${{inputs.working-directory}}/mix.lock"
- name: Restore plt cache
if: inputs.plt-restore-cache == 'False'
id: mix-plt-cache-no-restore
uses: actions/cache@v2
with:
path: |
${{inputs.working-directory}}/priv/plts
key: ${{ runner.os }}-mix-plt-${{ inputs.mix-env }}-${{ hashFiles(env.HASH_FILES_PATH) }}${{ inputs.plt-cache-key-suffix }}
env:
HASH_FILES_PATH: "${{inputs.working-directory}}/mix.lock"
- name: Destroy cache on retry
if: github.run_attempt != '1'
working-directory: ${{ inputs.working-directory }}
run: |
mix deps.clean --all
mix clean
rm -rf ${{inputs.working-directory}}/priv/plts
mix deps.get
shell: sh
env:
MIX_ENV: ${{ inputs.mix-env }}
- name: Install dependencies
if: steps.mix-build-dep-cache.outputs.cache-hit != 'true'
run: mix deps.get
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
MIX_ENV: ${{ inputs.mix-env }}
- name: Compile prod with ${{ inputs.compile-options }}
run: mix compile ${{ inputs.compile-options }}
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
MIX_ENV: ${{ inputs.mix-env }}
- name: Check formatting
run: mix format --check-formatted
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
MIX_ENV: ${{ inputs.mix-env }}
- name: Check dependencies
run: mix deps.unlock --check-unused
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
MIX_ENV: ${{ inputs.mix-env }}
- name: Credo
run: mix credo
if: ${{ inputs.mix-env != 'prod' }}
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
MIX_ENV: ${{ inputs.mix-env }}
- name: Dialyzer
run: mix dialyzer
if: ${{ inputs.mix-env != 'prod' }}
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
MIX_ENV: ${{ inputs.mix-env }}
- name: Tests
if: ${{ inputs.run-tests == 'True' }}
run: mix test ${{ inputs.tests-flags }}
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
MIX_ENV: ${{ inputs.mix-env-test }}
- name: Release
if: ${{ inputs.release == 'True' }}
run: mix release --overwrite
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
MIX_ENV: ${{ inputs.mix-env }}
- uses: actions/upload-artifact@v2
if: ${{ inputs.release-upload == 'True' }}
with:
name: ${{ inputs.release-name }}
path: ${{ inputs.working-directory }}/_build/${{ inputs.mix-env }}/rel