Skip to content

Commit

Permalink
Merge branch 'feature/uv' into develop
Browse files Browse the repository at this point in the history
* feature/uv: (27 commits)
  removes unused file
  lint
  rebase
  uv package manager
  updates CI
  updates pre-commit config
  add docs CI
  move from pdm to uv
  updates template footer
  updates footer
  updates deps
  updates nginx conf
  updates CI
  updates deps
  updates CI
  updates CI
  updates pre-commit config
  updates pre-commit config
  updates pre-commit config
  add docs CI
  ...
  • Loading branch information
saxix committed Dec 2, 2024
2 parents 55a86c8 + bd518d4 commit 0b57504
Show file tree
Hide file tree
Showing 101 changed files with 4,020 additions and 1,828 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ node_modules
src/*.egg-info
src/aurora/staticfiles/
Makefile
README.md
manage.py
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ STATIC_ROOT=/var/static/
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=db
POSTGRES_HOST=db
31 changes: 31 additions & 0 deletions .github/actions/last_commit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Get Last commit'
description: ''


outputs:
last_commit_sha:
description: 'last_commit_sha'
value: ${{ steps.result.outputs.last_commit_sha }}
last_commit_short_sha:
description: 'last_commit_short_sha'
value: ${{ steps.result.outputs.last_commit_short_sha }}

runs:
using: "composite"
steps:
- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "LAST_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- name: Setup Environment (Push)
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
echo "LAST_COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
- id: result
shell: bash
run: |
raw=${{env.LAST_COMMIT_SHA}}
echo "last_commit_sha=$raw" >> $GITHUB_OUTPUT
echo "last_commit_short_sha=${raw::8}" >> $GITHUB_OUTPUT
45 changes: 45 additions & 0 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This is used by the action https://github.com/dorny/paths-filter
docker: &docker
- added|modified: './docker/**/*'
- added|modified: './docker/*'

dependencies: &dependencies
- 'pdm.lock'
- 'pyproject.toml'

actions: &actions
- added|modified: './.github/**/*'

python: &python
- added|modified: 'src/**'
- added|modified: 'tests/**'
- 'manage.py'

changelog:
- added|modified: 'changes/**'
- 'CHANGELOG.md'

mypy:
- *python
- 'mypy.ini'

run_tests:
- *actions
- *python
- *docker
- *dependencies
- 'pytest.ini'

migrations:
- added|modified: 'src/**/migrations/*'

lint:
- *python
- '.flake8'
- 'pyproject.toml'

docs:
- added|modified: './docs/**/*'
- modified: './src/aurora/config/__init__.py'
- modified: './github/workflows/docs.yml'
- modified: './github/file-filters.yml'
83 changes: 83 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: "Documentation"

on:
push:
branches:
- develop
- master
schedule:
- cron: '37 23 * * 2'

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 1
defaults:
run:
shell: bash
outputs:
docs: ${{ steps.changed_files.outputs.docs }}
steps:
- name: Checkout code
uses: actions/[email protected]
- id: changed_files
name: Check for file changes
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
generate:
name: Generate
if: needs.changes.outputs.docs == 'true'
needs: changes
runs-on: ubuntu-latest
env:
PYTHONPATH: src/
steps:
- uses: actions/checkout@v4
- uses: yezz123/setup-uv@v4

- uses: actions/cache/restore@v4
id: restore-cache
with:
path: .venv
key: ${{ runner.os }}-${{ hashFiles('**/uv.lock') }}

- name: Install dependencies
run: uv sync --extra docs

- name: Build Doc
run: .venv/bin/mkdocs build -d ./docs-output

- uses: actions/cache/save@v4
id: cache
if: always() && steps.restore-cache.outputs.cache-hit != 'true'
with:
path: .venv
key: ${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs-output

# Deployment job
deploy:
needs: generate
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
88 changes: 88 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Lint
on:
push:
branches:
- develop
- master
- staging
- release/*
- feature/*
- bugfix/*
- hotfix/*
# pull_request:
# branches: [develop, master]
# types: [synchronize, opened, reopened, ready_for_review]

defaults:
run:
shell: bash


concurrency:
group: "${{ github.workflow }}-${{ github.ref }}-lint"
cancel-in-progress: true


permissions:
contents: read

jobs:
# changes:
## if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
# name: check files
# runs-on: ubuntu-latest
# timeout-minutes: 3
# outputs:
# lint: ${{ steps.changes.outputs.lint }}
# docker: ${{ steps.changes.outputs.docker_base }}
# steps:
# - run: git config --global --add safe.directory $(realpath .)
# - uses: actions/checkout@v4
# - id: changes
# name: Check for backend file changes
# uses: dorny/paths-filter@v3 # v3.0.0
# with:
# base: ${{ github.ref }}
# token: ${{ github.token }}
# filters: .github/file-filters.yml

flake8:
# needs: changes
# if: github.event.pull_request.draft == false && needs.changes.outputs.lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12.6'
- name: Install requirements
run: pip install flake8 pycodestyle
- name: Check syntax
# Stop the build if there are Python syntax errors or undefined names
run: flake8 src/
isort:
# needs: changes
# if: github.event.pull_request.draft == false && needs.changes.outputs.lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12.6'
- name: Install requirements
run: pip install isort
- name: iSort
run: isort src/ --check-only
black:
# needs: changes
# if: github.event.pull_request.draft == false && needs.changes.outputs.lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12.6'
- name: Install requirements
run: pip install "black==22.12.0"
- name: Black
run: black src/ --check --config pyproject.toml
77 changes: 77 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Security
on:
push:
branches:
- develop
- master
- staging
- release/*
- feature/*
- bugfix/*
- hotfix/*
# pull_request:
# branches: [develop, master]
# types: [synchronize, opened, reopened, ready_for_review]

defaults:
run:
shell: bash


concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true


permissions:
contents: read

jobs:
changes:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: check files
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
lint: ${{ steps.changes.outputs.lint }}
docker: ${{ steps.changes.outputs.docker_base }}
steps:
- run: git config --global --add safe.directory $(realpath .)
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- id: changes
name: Check for backend file changes
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml

bandit:
needs: changes
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && needs.changes.outputs.lint
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- uses: actions/checkout@v4
- name: Bandit Scan
uses: shundor/python-bandit-scan@9cc5aa4a006482b8a7f91134412df6772dbda22c
with: # optional arguments
# exit with 0, even with results found
exit_zero: true # optional, default is DEFAULT
# Github token of the repository (automatically created by Github)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information.
# File or directory to run bandit on
path: src # optional, default is .
# Report only issues of a given severity level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
# level: # optional, default is UNDEFINED
# Report only issues of a given confidence level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
# confidence: # optional, default is UNDEFINED
# comma-separated list of paths (glob patterns supported) to exclude from scan (note that these are in addition to the excluded paths provided in the config file) (default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)
# excluded_paths: # optional, default is DEFAULT
# comma-separated list of test IDs to skip
# skips: # optional, default is DEFAULT
# path to a .bandit file that supplies command line arguments
# ini_path: # optional, default is DEFAULT
Loading

0 comments on commit 0b57504

Please sign in to comment.