Skip to content

Commit

Permalink
Merge pull request #108 from paulo-ferraz-oliveira/feature/actions-cache
Browse files Browse the repository at this point in the history
Make for faster CI by caching _build and ~/.cache/rebar3
  • Loading branch information
elbrujohalcon committed Aug 8, 2023
2 parents 3b223f2 + 8fa1d46 commit 4f8b1e0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,29 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: setup-beam
with:
otp-version: ${{matrix.otp_vsn}}
rebar3-version: ${{matrix.rebar3_vsn}}
- run: |
rm -rf example/_checkouts # Prevent long running analysis
rebar3 test
- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: "_build-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- run: rebar3 test
example:
name: Makes sure our example run over ${{matrix.otp_vsn}}
runs-on: ubuntu-22.04
Expand All @@ -28,9 +45,28 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: setup-beam-example
with:
otp-version: ${{matrix.otp_vsn}}
rebar3-version: ${{matrix.rebar3_vsn}}
- name: Restore _build
uses: actions/cache@v3
with:
path: example/_build
key: "_build-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam-example.outputs.otp-version}}\
-rebar3-${{steps.setup-beam-example.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam-example.outputs.otp-version}}\
-rebar3-${{steps.setup-beam-example.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: test our example
run: |
cd example
Expand All @@ -54,5 +90,4 @@ jobs:
- name: check our example
run: |
cd example
rm -rf _checkouts # Prevent long running analysis
rebar3 test
7 changes: 2 additions & 5 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,13 @@

%% == Documentation ==

{ex_doc,
[{source_url, <<"https://github.com/inaka/cowboy-trails">>}
]}.
{ex_doc, [{source_url, <<"https://github.com/inaka/cowboy-trails">>}]}.

{hex, [{doc, #{provider => ex_doc}}]}.

%% == Format ==

{format,
[{files, ["*.config", "src/*", "test/*", "example/{rel,src,.}/*{.config,.erl,.src}"]}]}.
{format, [{files, ["*.config", "src/*", "test/*"]}]}.

%% == Hank ==

Expand Down
3 changes: 2 additions & 1 deletion src/trails.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{licenses, ["Apache 2.0"]},
{links,
[{"GitHub", "https://github.com/inaka/cowboy-trails"},
{"Blog", "https://web.archive.org/web/20160422045517/http://inaka.net/blog/2015/07/20/cowboy-trails/"},
{"Blog",
"https://web.archive.org/web/20160422045517/http://inaka.net/blog/2015/07/20/cowboy-trails/"},
{"Example", "https://github.com/inaka/cowboy-trails/tree/master/example"}]},
{build_tools, ["rebar3"]}]}.

0 comments on commit 4f8b1e0

Please sign in to comment.