From 9a2e34ceb1cc7402439a9a77b20ac2f3a018d63e Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Mon, 7 Aug 2023 21:14:41 +0100 Subject: [PATCH 1/2] Make for faster CI by caching _build and ~/.cache/rebar3 --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb33086..ec3bc9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -54,5 +90,4 @@ jobs: - name: check our example run: | cd example - rm -rf _checkouts # Prevent long running analysis rebar3 test From 8fa1d46059ecff81e087f3945fbf00d229a1f274 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Mon, 7 Aug 2023 21:35:49 +0100 Subject: [PATCH 2/2] Let the example format itself It's already verified in CI in any case Otherwise the base rebar.config kicks in and tries to verify the format for _build (which is part of its pattern) --- rebar.config | 7 ++----- src/trails.app.src | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/rebar.config b/rebar.config index dc1a843..57de771 100644 --- a/rebar.config +++ b/rebar.config @@ -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 == diff --git a/src/trails.app.src b/src/trails.app.src index 31e91fe..82d7e9c 100644 --- a/src/trails.app.src +++ b/src/trails.app.src @@ -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"]}]}.