-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
103 additions
and
0 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,103 @@ | ||
name: "build channel-sender" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- feature/* | ||
- fix/* | ||
pull_request: | ||
paths: | ||
- 'channel-sender/**' | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
name: Build and test | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./channel-sender | ||
|
||
steps: | ||
- name: Generate a token of Github APP | ||
id: generate_token | ||
if: github.ref == 'refs/heads/main' | ||
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | ||
with: | ||
app_id: ${{ secrets.APP_ID_ADMIN_GITHUB }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY_ADMIN_GITHUB }} | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
if: github.ref == 'refs/heads/main' | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
if: github.ref != 'refs/heads/main' | ||
|
||
- name: Verify Conventional Commits | ||
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3 | ||
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@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | ||
with: | ||
node-version-file: './channel-sender/.nvmrc' | ||
- name: Set up Semantic Release | ||
if: github.ref == 'refs/heads/main' | ||
run: npm -g install @semantic-release/git [email protected] | ||
- name: Semantic Release | ||
if: github.ref == 'refs/heads/main' | ||
run: npx [email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
|
||
- name: Set up Elixir | ||
uses: erlef/[email protected] | ||
with: | ||
version-type: strict | ||
version-file: "./channel-sender/.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 | ||
env: | ||
SKIP_GIT_HOOKS: 'true' | ||
- name: Code analysis | ||
run: mix credo --strict && mix dialyzer | ||
- name: Test generated code | ||
run: mix test | ||
- name: Tests & Coverage (main) | ||
if: github.ref == 'refs/heads/main' | ||
run: mix coveralls.github --umbrella | ||
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 --umbrella | ||
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: ./channel-sender/cover/lcov.info | ||
minimum-coverage: 70 | ||
artifact-name: code-coverage-report | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
update-comment: true |