Skip to content

Commit

Permalink
Added test and release to GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasson committed Jan 7, 2024
1 parent a8e9a96 commit 1576467
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 15 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Testing

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install package
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Test with pytest
working-directory: ./pytest
run: |
pytest
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Release package

on:
push:
tags:
- "*.*.*"

permissions:
contents: write

jobs:
pypi:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine hatch hatch-vcs
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m build
python -m twine upload -r testpypi dist/*
23 changes: 8 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ description = "Python implementation of the Aperiodic-Fourier Modal Method for e
readme = "README.md"
license = { text = "MIT" }
requires-python = ">=3.10"
authors = [
{ name = "Marco Passoni", email = "[email protected]" },
]
authors = [{ name = "Marco Passoni", email = "[email protected]" }]
keywords = [
'photonics',
'simulation',
Expand All @@ -32,18 +30,15 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"matplotlib>=3.5.1",
"numpy>=1.23.1",
"pandas>=1.4.2",
"scipy>=1.8.0",
"matplotlib>=3.5.1",
"numpy>=1.23.1",
"pandas>=1.4.2",
"scipy>=1.8.0",
]
dynamic = ["version"]

[project.optional-dependencies]
dev = [
"toml>=0.10.2",
"hatch-vcs==0.3.0",
]
dev = ["toml>=0.10.2", "hatch-vcs==0.3.0", "pytest>=7.2.0"]
doc = [
"sphinx>=5.3.0",
"sphinx-rtd-theme>=1.1.1",
Expand All @@ -52,9 +47,7 @@ doc = [
]

[tool.hatch.build]
include = [
"A_FMM/*",
]
include = ["A_FMM/*"]

[tool.hatch.version]
source = "vcs"
Expand All @@ -63,4 +56,4 @@ source = "vcs"
version_scheme = "post-release"

[tool.hatch.build.hooks.vcs]
version-file = "A_FMM/_version.py"
version-file = "A_FMM/_version.py"

0 comments on commit 1576467

Please sign in to comment.