Skip to content

Commit 9caeab8

Browse files
committed
github actions
1 parent f7b4138 commit 9caeab8

File tree

5 files changed

+249
-0
lines changed

5 files changed

+249
-0
lines changed

.github/workflows/compile.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Compile workflow
2+
on:
3+
workflow_call:
4+
inputs:
5+
mix-env:
6+
required: true
7+
type: string
8+
elixir-version:
9+
required: true
10+
type: string
11+
otp-version:
12+
required: true
13+
type: string
14+
secrets:
15+
token:
16+
required: false
17+
jobs:
18+
compile:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: checkout the repository
22+
uses: actions/checkout@v4
23+
24+
- name: setup deps and _build cache
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
${{ github.workspace }}/deps
29+
${{ github.workspace }}/_build
30+
key: ${{ runner.os }}-build-${{ inputs.mix-env }}-${{ hashFiles('mix.lock') }}
31+
32+
- name: setup elixir
33+
uses: ./.github/actions/elixir_setup
34+
with:
35+
elixir-version: ${{ inputs.elixir-version }}
36+
otp-version: ${{ inputs.otp-version }}
37+
38+
- name: install apt packages
39+
uses: ./.github/actions/os_setup
40+
41+
- name: fetch elixir dependencies
42+
run: MIX_ENV=${{ inputs.mix-env }} mix deps.get
43+
44+
- name: compile elixir project
45+
run: MIX_ENV=${{ inputs.mix-env }} mix compile

.github/workflows/docs.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Generate docs
2+
on:
3+
workflow_call:
4+
inputs:
5+
mix-env:
6+
required: true
7+
type: string
8+
elixir-version:
9+
required: true
10+
type: string
11+
otp-version:
12+
required: true
13+
type: string
14+
jobs:
15+
compile-docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout the repository
19+
uses: actions/checkout@v4
20+
21+
- name: setup deps and _build cache
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
${{ github.workspace }}/deps
26+
${{ github.workspace }}/_build
27+
key: ${{ runner.os }}-build-${{ inputs.mix-env }}-${{ hashFiles('mix.lock') }}
28+
29+
- name: setup elixir
30+
uses: ./.github/actions/elixir_setup
31+
with:
32+
elixir-version: ${{ inputs.elixir-version }}
33+
otp-version: ${{ inputs.otp-version }}
34+
35+
- name: install apt packages
36+
uses: ./.github/actions/os_setup
37+
38+
# - name: compile docs
39+
# shell: bash
40+
# run: make docs-release
41+
- name: generate docs
42+
run: MIX_ENV=${{ inputs.mix-env }} mix docs
43+
publish-docs:
44+
needs: compile-docs
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: checkout the repository
48+
uses: actions/checkout@v4
49+
50+
- name: setup deps and _build cache
51+
uses: actions/cache@v4
52+
with:
53+
path: |
54+
${{ github.workspace }}/deps
55+
${{ github.workspace }}/_build
56+
key: ${{ runner.os }}-build-${{ inputs.mix-env }}-${{ hashFiles('mix.lock') }}
57+
58+
- name: setup elixir
59+
uses: ./.github/actions/elixir_setup
60+
with:
61+
elixir-version: ${{ inputs.elixir-version }}
62+
otp-version: ${{ inputs.otp-version }}
63+
64+
- name: install apt packages
65+
uses: ./.github/actions/os_setup
66+
67+
# - name: compile docs
68+
# shell: bash
69+
# run: make docs-release
70+
71+
- name: generate docs
72+
run: MIX_ENV=${{ inputs.mix-env }} mix docs
73+
74+
- name: setup github pages
75+
uses: actions/configure-pages@v5
76+
77+
- name: upload docs to github pages
78+
uses: actions/upload-pages-artifact@v3
79+
with:
80+
path: "./doc"
81+
82+
- name: deploy github pages
83+
id: deployment
84+
uses: actions/deploy-pages@v4

.github/workflows/lint.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Linting workflow
2+
on:
3+
workflow_call:
4+
inputs:
5+
mix-env:
6+
required: true
7+
type: string
8+
elixir-version:
9+
required: true
10+
type: string
11+
otp-version:
12+
required: true
13+
type: string
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout the repository
19+
uses: actions/checkout@v4
20+
21+
- name: setup deps and _build cache
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
${{ github.workspace }}/deps
26+
${{ github.workspace }}/_build
27+
key: ${{ runner.os }}-build-${{ inputs.mix-env }}-${{ hashFiles('mix.lock') }}
28+
29+
- name: setup plt cache
30+
uses: actions/cache@v4
31+
with:
32+
path: ${{ github.workspace }}/plts
33+
key: ${{ runner.os }}-plt-${{ inputs.mix-env }}-${{ hashFiles('**/*.ex') }}
34+
35+
- name: setup elixir
36+
uses: ./.github/actions/elixir_setup
37+
with:
38+
elixir-version: ${{ inputs.elixir-version }}
39+
otp-version: ${{ inputs.otp-version }}
40+
41+
- name: install apt packages
42+
uses: ./.github/actions/os_setup
43+
44+
- name: mix credo
45+
shell: bash
46+
run: MIX_ENV=${{inputs.mix-env}} mix credo
47+
48+
- name: mix format
49+
shell: bash
50+
run: MIX_ENV=${{inputs.mix-env}} mix format --check-formatted
51+
52+
- name: mix dialyzer
53+
shell: bash
54+
run: MIX_ENV=${{inputs.mix-env}} mix dialyzer --format github
55+
56+
- name: trailing whitespaces
57+
shell: bash
58+
run: git diff-tree --check 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD

.github/workflows/on_push.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Push
2+
run-name: Push
3+
on: [push]
4+
5+
jobs:
6+
compile:
7+
strategy:
8+
matrix:
9+
target: [dev, test, prod]
10+
uses: ./.github/workflows/compile.yaml
11+
with:
12+
mix-env: ${{ matrix.target }}
13+
elixir-version: "1.17"
14+
otp-version: "27.1"
15+
16+
lint:
17+
needs: compile
18+
uses: ./.github/workflows/lint.yaml
19+
with:
20+
mix-env: "dev"
21+
elixir-version: "1.17"
22+
otp-version: "27.1"

.github/workflows/test.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run tests
2+
on:
3+
workflow_call:
4+
inputs:
5+
mix-env:
6+
required: true
7+
type: string
8+
elixir-version:
9+
required: true
10+
type: string
11+
otp-version:
12+
required: true
13+
type: string
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout the repository
19+
uses: actions/checkout@v4
20+
21+
- name: setup deps and _build cache
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
${{ github.workspace }}/deps
26+
${{ github.workspace }}/_build
27+
key: ${{ runner.os }}-build-${{ inputs.mix-env }}-${{ hashFiles('mix.lock') }}
28+
29+
- name: setup elixir
30+
uses: ./.github/actions/elixir_setup
31+
with:
32+
elixir-version: ${{ inputs.elixir-version }}
33+
otp-version: ${{ inputs.otp-version }}
34+
35+
- name: install apt packages
36+
uses: ./.github/actions/os_setup
37+
38+
- name: mix test
39+
shell: bash
40+
run: MIX_ENV=${{inputs.mix-env}} mix test

0 commit comments

Comments
 (0)