-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from ajfAfg/accelerate-github-actions-workflow
Accelerate GitHub Actions workflow
- Loading branch information
Showing
6 changed files
with
181 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Setup beam with Rebar3 cache | ||
description: Action that combines `erlef/setup-beam@v1` and `action/cache@v4` | ||
|
||
inputs: | ||
otp-version: | ||
description: Erlang/OTP version (string) | ||
required: true | ||
rebar3-version: | ||
description: Rebar3 version (string) | ||
required: true | ||
rebar-lock-path: | ||
description: Path of `rebar.lock` (string) | ||
required: true | ||
overwrite: | ||
description: Whether to overwrite the cache (bool string) | ||
required: false | ||
default: "false" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{ inputs.otp-version }} | ||
rebar3-version: ${{ inputs.rebar3-version }} | ||
|
||
- uses: actions/cache@v4 | ||
id: cache-no-overwrite | ||
if: ${{ inputs.overwrite != 'true' }} | ||
with: | ||
key: ${{ runner.os }}-otp-${{ inputs.otp-version }}-rebar3-${{ inputs.rebar3-version }}-${{ hashFiles(inputs.rebar-lock-path) }} | ||
path: | | ||
~/.cache/rebar3 | ||
_build | ||
restore-keys: | | ||
${{ runner.os }}-otp-${{ env.otp }}-rebar3-${{ env.rebar3 }}-${{ hashFiles('rebar.lock') }}- | ||
- uses: actions/cache@v4 | ||
if: ${{ inputs.overwrite == 'true' }} | ||
with: | ||
# NOTE: No duplicate key to overwrite the cache. | ||
key: ${{ runner.os }}-otp-${{ env.otp }}-rebar3-${{ env.rebar3 }}-${{ hashFiles('rebar.lock') }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
path: | | ||
~/.cache/rebar3 | ||
_build | ||
restore-keys: | | ||
${{ runner.os }}-otp-${{ env.otp }}-rebar3-${{ env.rebar3 }}-${{ hashFiles('rebar.lock') }} | ||
- name: Create cache data | ||
shell: bash | ||
if: ${{ steps.cache-no-overwrite.outputs.cache-hit != 'true' }} | ||
run: | | ||
rebar3 compile | ||
rebar3 as test compile | ||
rebar3 dialyzer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Erlang CI | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
types: ["opened", "synchronize", "reopened"] | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
otp: 26.0 | ||
rebar3: 3.22.1 | ||
|
||
jobs: | ||
#============================================================================ | ||
# Build | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
# NOTE: To check if the first build is possible, do not use the cache. | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{ env.otp }} | ||
rebar3-version: ${{ env.rebar3 }} | ||
- run: rebar3 compile | ||
|
||
#============================================================================ | ||
# Static Analysis | ||
static_analysis: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-beam-with-cache/ | ||
with: | ||
otp-version: ${{ env.otp }} | ||
rebar3-version: ${{ env.rebar3 }} | ||
rebar-lock-path: "./rebar.lock" | ||
|
||
- run: rebar3 xref | ||
- run: rebar3 dialyzer | ||
|
||
#============================================================================ | ||
# Test | ||
test: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-beam-with-cache/ | ||
with: | ||
otp-version: ${{ env.otp }} | ||
rebar3-version: ${{ env.rebar3 }} | ||
rebar-lock-path: "./rebar.lock" | ||
|
||
- name: Run sample-based-tests | ||
run: rebar3 do eunit, ct | ||
- name: Run property-based-tests | ||
run: rebar3 proper -n 500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# NOTE: | ||
# Workflow for creating a cache periodically. | ||
# Eliminating the period during which the cache is invalid | ||
# prevents the increase in execution time due to the absence of the cache. | ||
name: Create cache periodically | ||
|
||
on: | ||
schedule: | ||
# NOTE: | ||
# The validity period of the cache is virtually unlimited. | ||
# Originally, a cache is valid for 7 days | ||
# (c.f. https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy), | ||
# but if a new cache is created before the cache becomes invalid, | ||
# the validity period can be extended for another 7 days. | ||
- cron: "0 0 */6 * *" | ||
|
||
workflow_dispatch: | ||
|
||
env: | ||
otp: 26.0 | ||
rebar3: 3.22.1 | ||
|
||
jobs: | ||
overwrite-cache: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-beam-with-cache/ | ||
with: | ||
otp-version: ${{ env.otp }} | ||
rebar3-version: ${{ env.rebar3 }} | ||
rebar-lock-path: "./rebar.lock" | ||
overwrite: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters