11name : Setup Elixir Project
22description : Checks out the code, configures Elixir, fetches dependencies, and manages build caching.
33inputs :
4- # Required inputs
54 otp-version :
65 required : true
7- type : string
86 description : OTP version to set up
97 elixir-version :
108 required : true
11- type : string
129 description : Elixir version to set up
13- # Optional inputs
1410 build-deps :
1511 required : false
16- type : boolean
17- default : true
12+ default : ' true'
1813 description : True if we should compile dependencies
1914 build-app :
2015 required : false
21- type : boolean
22- default : true
16+ default : ' true'
2317 description : True if we should compile the application itself
2418 build-flags :
2519 required : false
26- type : string
2720 default : ' --all-warnings'
2821 description : Flags to pass to mix compile
2922 install-rebar :
3023 required : false
31- type : boolean
32- default : true
24+ default : ' true'
3325 description : By default, we will install Rebar (mix local.rebar --force).
3426 install-hex :
3527 required : false
36- type : boolean
37- default : true
28+ default : ' true'
3829 description : By default, we will install Hex (mix local.hex --force).
3930 cache-key :
4031 required : false
41- type : string
4232 default : ' v1'
4333 description : If you need to reset the cache for some reason, you can change this key.
4434runs :
5848 key : ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '**/mix.lock')) }}
5949 restore-keys : |
6050 ${{ runner.os }}-mix-
61-
51+
6252 - name : Get build cache
6353 uses : actions/cache@v3
6454 id : build-cache
6757 key : build-${{ inputs.cache-key }}-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ env.MIX_ENV }}-${{ hashFiles('**/mix.lock') }}
6858 restore-keys : |
6959 build-${{ inputs.cache-key }}-${{ runner.os }}-${{ inputs.otp-version }}-${{ inputs.elixir-version }}-${{ env.MIX_ENV }}-
70- # In my experience, I have issues with incremental builds maybe 1 in 100
71- # times that are fixed by doing a full recompile.
72- # In order to not waste dev time on such trivial issues (while also reaping
73- # the time savings of incremental builds for *most* day-to-day development),
74- # I force a full recompile only on builds that we retry.
60+
7561 - name : Clean to rule out incremental build as a source of flakiness
7662 if : github.run_attempt != '1'
7763 run : |
10187 - name : Compile Application
10288 run : mix compile ${{ inputs.build-flags }}
10389 shell : sh
104- if : inputs.build-app == 'true'
90+ if : inputs.build-app == 'true'
0 commit comments