ci: add gitea ci/cd pipeline
This commit is contained in:
75
.gitea/workflows/code-quality.yml
Normal file
75
.gitea/workflows/code-quality.yml
Normal file
@@ -0,0 +1,75 @@
|
||||
name: Code Quality
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
code-quality:
|
||||
runs-on: ubuntu-latest
|
||||
name: Code Quality (Elixir ${{matrix.elixir}} OTP ${{matrix.otp}})
|
||||
strategy:
|
||||
matrix:
|
||||
otp: ['26.0']
|
||||
elixir: ['1.15']
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:15
|
||||
ports: ['5432:5432']
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Elixir
|
||||
uses: erlef/setup-beam@v1
|
||||
with:
|
||||
elixir-version: ${{matrix.elixir}}
|
||||
otp-version: ${{matrix.otp}}
|
||||
|
||||
- name: Restore dependencies cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: deps
|
||||
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
||||
restore-keys: ${{ runner.os }}-mix-
|
||||
|
||||
- name: Restore compiled code cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: _build
|
||||
key: ${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: mix deps.get
|
||||
|
||||
- name: Check for unused dependencies
|
||||
run: mix deps.unlock --check-unused
|
||||
|
||||
- name: Compile with warnings as errors
|
||||
run: mix compile --warnings-as-errors
|
||||
|
||||
- name: Check code formatting
|
||||
run: mix format --check-formatted
|
||||
|
||||
- name: Run tests
|
||||
run: mix test
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
|
||||
- name: Run precommit (should pass if all above passed)
|
||||
run: mix precommit
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
Reference in New Issue
Block a user