Skip to content

Commit

Permalink
feat: Initial project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
lfvbarcus committed Feb 9, 2024
1 parent 2384de9 commit dc7f3f3
Show file tree
Hide file tree
Showing 24 changed files with 690 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "maven" # See documentation for possible values
directory: "/data/local/test_basic/layout_maven/ms-101" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build PyPI
on:
workflow_call:
workflow_dispatch:
push:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
linting:
name: Reuse linting job
uses: ./.github/workflows/lint.yml

build:
needs: linting
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
with:
fetch-depth: 0 #full history
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: pip install hatch
- name: Run unit and integrations tests
run: hatch run test:pytest --cov=reqstool-python-decorators --cov-report=xml --cov-report=html
- name: Build project
run: hatch build
# Upload artifacts for later use
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
11 changes: 11 additions & 0 deletions .github/workflows/check_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Lint (black and flake8)
on:
workflow_call:

jobs:
check-release:
runs-on: ubuntu-latest
steps:
- name: Check branch and tag
if: github.event_name == 'push' && !(github.ref == 'refs/heads/main' && startsWith(github.ref, 'refs/tags/v'))
run: exit 1
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint (black and flake8)
on:
workflow_dispatch:
workflow_call:

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pip package(s)
run: pip install hatch
- name: Run black formatter check
run: hatch run lint:black --check --verbose src tests
- name: Run flake8 linter
run: hatch run lint:flake8
47 changes: 47 additions & 0 deletions .github/workflows/publish_gh_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish to GitHub Pages
on:
workflow_dispatch:
release:
types: [created]
push:
branches:
- main

concurrency:
group: github-pages
cancel-in-progress: false
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure Pages
uses: actions/configure-pages@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Antora
run: npm i antora
- name: Install Asciidoctor Kroki extension
run: npm i asciidoctor asciidoctor-kroki
- name: Generate Site
run: npx antora docs/antora-playbook.yml
- name: Create site folders
run: mkdir -p docs/build/site
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
path: docs/build/site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
37 changes: 37 additions & 0 deletions .github/workflows/publish_pypi_prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and publish to PyPI

on:
release:
types: [created]

jobs:
check-release:
name: Reuse check release
uses: ./.github/workflows/check_release.yml
build:
name: Reuse build
uses: ./.github/workflows/build.yml


publish-to-pypi:
needs:
- check-release
- build
runs-on: ubuntu-latest
environment:
name: prod
url: https://pypi.org/p/reqstool-client
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
# Download artifacts from the build job
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish distribution 📦 to PyPI
# if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
sign-artifacts: true
32 changes: 32 additions & 0 deletions .github/workflows/publish_pypi_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and publish to Test PyPI

on:
workflow_dispatch:

jobs:
build:
name: Reuse build
uses: ./.github/workflows/build.yml

publish-to-test-pypi:
needs: build
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment:
name: test
url: https://test.pypi.org/p/reqstool-client
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
# Download artifacts from the build job
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
sign-artifacts: true
skip-existing: true
Loading

0 comments on commit dc7f3f3

Please sign in to comment.