diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml deleted file mode 100644 index 105ab0f..0000000 --- a/.github/workflows/pipeline.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: pipeline - -on: - push: - branches: - - master - - dev - - test_ci - pull_request: - -jobs: - test-job: - 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" - - env: - CONDA_FILE: environment.yml - - steps: - - uses: actions/checkout@v4 - - - name: Get Date - id: get-date - run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT - shell: bash - - - name: Setup Conda Environment - uses: conda-incubator/setup-miniconda@v3 - with: - miniforge-variant: Mambaforge - miniforge-version: latest - use-mamba: true - activate-environment: cadet-rdm - channels: conda-forge, - - - name: Cache conda - uses: actions/cache@v4 - env: - # Increase this value to reset cache if environment.yml has not changed - CACHE_NUMBER: 0 - with: - path: ${{ env.CONDA }}/envs - key: ${{ matrix.os }}-python_${{ matrix.python-version }}-${{ steps.get-date.outputs.today }}-${{ hashFiles(env.CONDA_FILE) }}-${{ env.CACHE_NUMBER }} - - - name: Update environment - run: | - mamba install "setuptools>=69" "pip>=24" - mamba install python=${{ matrix.python-version }} - echo "python=${{ matrix.python-version }}.*" > $CONDA_PREFIX/conda-meta/pinned - mamba env update -n cadet-rdm -f ${{ env.CONDA_FILE }} - if: steps.cache.outputs.cache-hit != 'true' - - - name: Install - run: | - pip install -e ./[testing] - - - name: Test - run: | - pytest tests -m "not server_api" diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml index 222a9a7..056a648 100644 --- a/.github/workflows/publish_to_pypi.yml +++ b/.github/workflows/publish_to_pypi.yml @@ -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 "you@example.com" + 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/* diff --git a/pyproject.toml b/pyproject.toml index 1badc0f..3f840b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]