Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CI): Move CI to Github Actions #71

Merged
merged 16 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build sphinx docs

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
samoehlert marked this conversation as resolved.
Show resolved Hide resolved
branches:
- '**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -48,5 +48,7 @@ jobs:
path: 'docs/_build/html'

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v4

33 changes: 33 additions & 0 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run flake8

on:
push:
branches:
- '**'
pull_request:
branches:
- main
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
flake8:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Docker images.
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yaml') }}

- name: Install dependencies
run: |
pip install flake8

- name: Run flake8
run: |
flake8
79 changes: 79 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Run pytest

on:
push:
branches:
- '**'
pull_request:
branches:
- main
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
pytest:
name: Run Pytest
runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: scram
POSTGRES_PASSWORD: ''
POSTGRES_DB: test_scram
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U scram"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out the code
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose make

- name: Build Docker images
run: make build

- name: Migrate Database
run: make migrate

- name: Run Application
run: make run

- name: Run Pytest with Coverage
env:
POSTGRES_USER: scram
POSTGRES_DB: test_scram
run: make coverage.xml

- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
samoehlert marked this conversation as resolved.
Show resolved Hide resolved

- name: Display Coverage Metrics
uses: 5monkeys/cobertura-action@v14
with:
minimum_coverage: '50'

- name: Stop Services
if: always()
run: make stop

- name: Clean Up
if: always()
run: make clean
68 changes: 0 additions & 68 deletions .gitlab-ci.yml

This file was deleted.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ python_files = [

# ==== Coverage ====
[tool.coverage.run]
omit = ["*/migrations/*", "*/tests/*"]
include = ["scram/*", "config/*", "translator/*"]
omit = ["**/migrations/*", "scram/contrib/*", "*/tests/*"]
plugins = ["django_coverage_plugin"]



# ==== black ====
[tool.black]
line-length = 119
Expand Down
6 changes: 0 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ django_settings_module = config.settings.test
# Django migrations should not produce any errors:
ignore_errors = True

[coverage:run]
include = scram/*
omit = *migrations*, *tests*
plugins =
django_coverage_plugin

[behave]
paths = scram/route_manager/tests/acceptance
stderr_capture = no
Loading