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 3684ba0
Show file tree
Hide file tree
Showing 23 changed files with 471 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
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Description

This documentation provides information on how to use the Reqstool Hatch Plugin. The plugin is designed to be used with the Hatch build tool and facilitates the integration of the Reqstool Decorators in your project.

## Installation

To use the Reqstool Hatch Plugin, follow these steps:

- Update your project dependencies in the `pyproject.toml` file and
ensure that the Reqstool Decorators' dependency is listed as follows;
```
dependencies = ["reqstool-decorators == <version>"]
```

When you declare this in the pyproject.toml file, you are specifying the required versions for the dependency of the Reqstool Decorators. This ensures that the correct version of the dependencies are used when installing and running your project.



## Usage



### Configuration

The plugin can be configured through the `pyproject.toml` file. Configure plugin in `pyproject.toml`as follows;

```
[tool.hatch.build.targets.wheel.hooks.decorators]
dependencies = ["reqstool-hatch-plugin == <version>"]
path = ["src","tests"]
```
It specifies that the reqstool-hatch-plugin is a dependency for the build process, and it should be of a specific version.

Further it defines the paths where the plugin should be applied. In this case, it specifies that the plugin should be applied to files in the src and tests directories.
23 changes: 23 additions & 0 deletions docs/antora-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/asciidoctor/asciidoctor-intellij-plugin/main/src/main/resources/jsonSchemas/antoraPlaybookSchema.json

site:
title: Reqstool Python Hatch Plugin Documentation
url: https://github.com/luftfartsverket/reqstool-python-hatch-plugin
start_page: reqstool-python-hatch-plugin::index.adoc

content:
sources:
- url: ~+
branches: HEAD
start_path: docs
ui:
bundle:
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable
snapshot: true
asciidoc:
attributes:
kroki-server-url: https://kroki.io
kroki-fetch-diagram: true
extensions:
- asciidoctor-kroki

7 changes: 7 additions & 0 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/asciidoctor/asciidoctor-intellij-plugin/main/src/main/resources/jsonSchemas/antoraComponentSchema.json

name: reqstool-python-hatch-plugin
title: Reqstool Python Hatch Plugin
version: 0.0.1
nav:
- modules/ROOT/nav.adoc
2 changes: 2 additions & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* xref:index.adoc[Start]
* xref:usage.adoc[Usage]
3 changes: 3 additions & 0 deletions docs/modules/ROOT/pages/description.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
== Description

This documentation provides information on how to use the Reqstool Python Hatch Plugin. The plugin is designed to be used with the Hatch build tool and facilitates the integration of the Reqstool Python Decorators in your project.
7 changes: 7 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
= Reqstool Python Hatch Plugin

include::description.adoc[]

include::installation.adoc[]

include::license.adoc[]
20 changes: 20 additions & 0 deletions docs/modules/ROOT/pages/installation.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
== Installation

To use the Reqstool Python Hatch Plugin, follow these steps:

- Update your project dependencies in the `pyproject.toml` file and
ensure that the Reqstool Decorators' dependency is listed as follows;
```
dependencies = ["reqstool-python-decorators == <version>"]
```
When you declare this in the pyproject.toml file, you are specifying the required versions for the dependency of the Reqstool Decorators. This ensures that the correct version of the dependencies are used when installing and running your project.









3 changes: 3 additions & 0 deletions docs/modules/ROOT/pages/license.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
== License

This project is licensed under the MIT License - see the LICENSE.md file for details.
16 changes: 16 additions & 0 deletions docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
== Usage


=== Configuration

The plugin can be configured through the `pyproject.toml` file. Configure plugin in `pyproject.toml`as follows;

```
[tool.hatch.build.targets.wheel.hooks.decorators]
dependencies = ["reqstool-python-hatch-plugin == <version>"]
path = ["src","tests"]

```
It specifies that the reqstool-hatch-plugin is a dependency for the build process, and it should be of a specific version.

Further it defines the paths where the plugin should be applied. In this case, it specifies that the plugin should be applied to files in the src and tests directories.
Loading

0 comments on commit 3684ba0

Please sign in to comment.