Skip to content

Commit

Permalink
Update GitHub CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ronald-jaepel committed Nov 15, 2024
1 parent e7f79a0 commit fd40a18
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 99 deletions.
72 changes: 0 additions & 72 deletions .github/workflows/pipeline.yml

This file was deleted.

115 changes: 90 additions & 25 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,99 @@
name: Publish CADET-RDM to PyPI

on:
release:
types: [published]
push:
branches:
- master
- dev
- test_ci
tags:
- 'v*.*.*' # Trigger build stage only on version tags
pull_request:
branches:
- '**' # Trigger test stage on pull requests to any branch

jobs:
build-and-publish:
name: Build and publish CADET-RDM to PyPI
runs-on: ubuntu-latest
test-stage:
runs-on: ${{ matrix.os }}

defaults:
run:
shell: bash -l {0}

strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
include:
- os: windows-latest
python-version: "3.12"
- os: macos-12
python-version: "3.12"

steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
- name: Checkout Code
uses: actions/checkout@master

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution PyPI
uses: pypa/gh-action-pypi-publish@release/v1
python-version: ${{ matrix.python-version }}

- name: Install Git LFS
run: |
sudo apt-get update
sudo apt-get install -y git-lfs
git lfs install
- name: Configure Git # This is required for the test suite, which checks git credentials
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: Set up Virtual Environment
run: |
python -m venv testing
source testing/bin/activate
- name: Install Dependencies
run: |
pip install -U pytest setuptools
pip install .[testing]
- name: Verify Installation
run: |
pip list
ls -l
- name: Run Tests
run: |
pytest tests -m "not server_api"
build-release:
name: Build and Upload Release
runs-on: ubuntu-latest
needs: test-stage # Ensure this job runs only after test-stage succeeds
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
password: ${{ secrets.PYPI_API_TOKEN }}
python-version: 3.12

- name: Install Build Tools
run: |
pip install -U build twine
- name: Build the Package
run: |
python -m build
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
run: |
python -m twine upload dist/*
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ rdm = "cadetrdm.cli_integration:cli"


[project.urls]
homepage = "https://jugit.fz-juelich.de/IBG-1/ModSim/cadet/CADET-RDM"
homepage = "https://github.com/cadet/CADET-RDM"
documentation = "https://cadet-rdm.readthedocs.io/en/latest/index.html"
"Bug Tracker" = "https://jugit.fz-juelich.de/IBG-1/ModSim/cadet/CADET-RDM/Issues"
"Bug Tracker" = "https://github.com/cadet/CADET-RDM/issues"


[project.optional-dependencies]
Expand Down

0 comments on commit fd40a18

Please sign in to comment.