diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 0000000..105ab0f --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,72 @@ +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 new file mode 100644 index 0000000..222a9a7 --- /dev/null +++ b/.github/workflows/publish_to_pypi.yml @@ -0,0 +1,34 @@ +name: Publish CADET-RDM to PyPI + +on: + release: + types: [published] + +jobs: + build-and-publish: + name: Build and publish CADET-RDM to PyPI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Set up Python 3.10 + 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 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 10bb407..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -image: python:3.12 - -stages: - - test - - build - -test-stage: - stage: test - script: - - apt-get update - - apt-get install git-lfs - - git config --global user.email "you@example.com" - - git config --global user.name "Your Name" - - cd .. - - python -m venv testing - - source testing/bin/activate - - cd CADET-RDM - - pip install -U pytest setuptools - - pip install .[testing] - - pip list - - ls -l - - pytest tests -m "not server_api" - -build-release: - rules: - - if: $CI_COMMIT_TAG =~ /^v?\d+\.\d+\.\d+.*/ - stage: build - script: - - pip install -U build twine - - python -m build - - python -m twine upload dist/*