Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow #2

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: publish

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

jobs:
build_and_publish_pypi:
if: github.repository_owner == 'statnett'
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: install poetry
run: |
python -m pip install --upgrade pip wheel pipx
python -m pipx install poetry
- name: Install dependencies
run: |
poetry install
poetry self add "poetry-dynamic-versioning[plugin]"
- name: Run tests and linting
run: |
poetry run pytest
poetry run ruff check
poetry run ruff format
- name: Build package
run: |
poetry build
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: tests

on: [push, pull_request]
jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest]
python: ['3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: install poetry
run: |
python -m pip install --upgrade pip wheel pipx
python -m pipx install poetry
- name: install dependencies
run: poetry install
- name: run tests
run: poetry run pytest
- name: run linter
run: |
poetry run ruff check
poetry run ruff format
Loading
Loading