Skip to content

Commit

Permalink
feat: squash changes from git.kvd.studio/r/primerdriver
Browse files Browse the repository at this point in the history
  • Loading branch information
kvdomingo committed Nov 8, 2024
1 parent e6c2898 commit f3162d3
Show file tree
Hide file tree
Showing 156 changed files with 62,538 additions and 10,232 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PYTHON_ENV=development
FLASK_DEBUG=True
FLASK_APP=primerx.app
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and push Docker image

on:
push:
branches: [ main ]

concurrency:
group: build
cancel-in-progress: true

jobs:
build-and-push:
name: Build and push
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout code repo
uses: actions/checkout@v4

- name: Docker login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Extract image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push
id: build
uses: docker/build-push-action@v6
with:
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:latest
labels: ${{ steps.meta.outputs.labels }}
file: web.Dockerfile

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository }}-web
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
26 changes: 0 additions & 26 deletions .github/workflows/make-docs.yml

This file was deleted.

41 changes: 17 additions & 24 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
name: Publish docs to GitHub Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
branches: [ main ]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
contents: write

# Allow one concurrent deployment
concurrency:
group: "pages"
group: pages
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
url: https://${{ github.repository_owner }}.github.io/primerdriver
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install "poetry==1.8.3"
poetry install --no-root --with dev
- name: Publish docs
run: poetry run mkdocs gh-deploy --force
59 changes: 26 additions & 33 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Upload to PyPI

on:
release:
types:
- published
types: [ published ]

permissions:
contents: read
id-token: write

jobs:
deploy:

runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/primerdriver
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "poetry==1.3.2"
poetry export --without-hashes --without dev -f requirements.txt | pip install -r /dev/stdin
pip install build
- name: Build package
run: python -m build

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'

- name: Install dependencies
run: |
pip install "poetry==1.8.3"
poetry export --without dev --format requirements.txt | pip install --no-cache-dir -r /dev/stdin
pip install build
- name: Build package
run: python -m build

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
18 changes: 11 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
name: Run tests

on:
pull_request:
on: pull_request

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: [ '3.9', '3.10' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install "poetry==1.3.2"
poetry install
python -m pip install "poetry==1.8.3"
poetry install --no-root --with dev
- name: Run tests
run: poetry run coverage run -m pytest

- name: Update code coverage badge
run: poetry run coverage-badge -o coverage.svg -f
if: ${{ matrix.python-version == 3.10 }}

- uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ matrix.python-version == 3.10 }}
with:
Expand Down
Loading

0 comments on commit f3162d3

Please sign in to comment.