Skip to content

Commit

Permalink
Migrate CI to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ronald-jaepel committed Nov 15, 2024
1 parent 5ee1359 commit d0f3692
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 33 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Publish CADET-RDM to PyPI

on:
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:
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:
- name: Checkout Code
uses: actions/checkout@master

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Git LFS
if: runner.os == 'Linux' || runner.os == 'macOS'
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
${{ runner.os == 'Windows' && 'source ../testing/Scripts/activate' || '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:
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/*
31 changes: 0 additions & 31 deletions .gitlab-ci.yml

This file was deleted.

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 d0f3692

Please sign in to comment.