Skip to content

Commit 317efa8

Browse files
committed
Fix Erlang/OTP version usage in CI
This commit reproduces the changes in [appsignal-elixir#718][pr] for the Plug repository, making it so that the intended Erlang and Elixir versions are used, by selecting the Erlang version before the Elixir one, compiling the desired Elixir version against the selected Erlang version, caching the compiled Elixir version, and removing OTP 20 checks from CI. [pr]: appsignal/appsignal-elixir#718
1 parent eae10b1 commit 317efa8

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

.semaphore/semaphore.yml

-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ blocks:
8585
commands:
8686
- ERLANG_VERSION=21.3 ELIXIR_VERSION=1.9.4 . bin/setup
8787
- mix test
88-
- name: Elixir 1.9.4, OTP 20
89-
commands:
90-
- ERLANG_VERSION=20.3 ELIXIR_VERSION=1.9.4 . bin/setup
91-
- mix test
9288
env_vars:
9389
- name: MIX_ENV
9490
value: test

bin/setup

+27-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
1-
if [[ $ELIXIR_VERSION == "master" ]]; then
2-
kiex install $ELIXIR_VERSION
3-
fi
1+
#!/bin/bash
2+
3+
set -e
4+
5+
elixirs_key="elixir-$ELIXIR_VERSION-erlang-$ERLANG_VERSION-elixirs"
6+
archives_key="elixir-$ELIXIR_VERSION-erlang-$ERLANG_VERSION-archives"
7+
8+
elixirs_path=~/".kiex/elixirs"
9+
archives_path=~/".kiex/mix/archives"
10+
11+
rm -rf "$elixirs_path"/*
12+
rm -rf "$archives_path"/*
413

514
sem-version erlang $ERLANG_VERSION
615
erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell
7-
sem-version elixir $ELIXIR_VERSION
16+
17+
if [ $ELIXIR_VERSION != "main" ] && \
18+
cache has_key "$elixirs_key" && \
19+
cache has_key "$archives_key"
20+
then
21+
cache restore "$elixirs_key"
22+
cache restore "$archives_key"
23+
else
24+
kiex install $ELIXIR_VERSION
25+
cache store "$elixirs_key" "$elixirs_path"
26+
cache store "$archives_key" "$archives_path"
27+
fi
28+
29+
kiex use $ELIXIR_VERSION
830
elixir -v
9-
checkout
31+
1032
mix local.rebar --force
1133
mix local.hex --force
1234
mix deps.get

0 commit comments

Comments
 (0)