-
Notifications
You must be signed in to change notification settings - Fork 4
82 lines (82 loc) · 2.78 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: ci
on:
push:
branches:
- main
- feature/*
- fix/*
pull_request:
branches:
- main
jobs:
build:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify Conventional Commits
uses: amannn/action-semantic-pull-request@v5
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up NodeJS
if: github.ref == 'refs/heads/main'
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Set up Semantic Release
if: github.ref == 'refs/heads/main'
run: npm -g install @semantic-release/git semantic-release@23.0.0
- name: Semantic Release
if: github.ref == 'refs/heads/main'
run: npx semantic-release@23.0.0
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_P_A_TOKEN }}
- name: Set up Elixir
uses: erlef/setup-beam@v1.17.1
with:
version-type: strict
version-file: ".tool-versions"
- name: Restore dependencies cache
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: mix deps.get && mix deps.compile
env:
SKIP_GIT_HOOKS: 'true'
- name: Validate code formatting
run: mix format --check-formatted
- name: Code analysis
run: mix credo --strict && mix dialyzer
- name: Install as archive
run: mix do archive.build, archive.install --force
- name: Tests & Coverage (main)
if: github.ref == 'refs/heads/main'
run: mix coveralls.github
env:
CI_ENV: 'true'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tests & Coverage (pull requests)
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
run: mix coveralls.lcov
env:
CI_ENV: 'true'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup PR Report tool
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: hrishikesh-kadam/setup-lcov@v1
- name: Validate code coverage
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: zgosalvez/github-actions-report-lcov@v3
with:
coverage-files: cover/lcov.info
minimum-coverage: 70
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
update-comment: true