From 782aee39cbc8f7e661dc3e3002bf43edec448d51 Mon Sep 17 00:00:00 2001 From: diviloper Date: Sun, 1 Dec 2024 02:08:50 +0100 Subject: [PATCH 1/3] Add prefix to macos-14 when building MEOS --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fc95eb68..1a08b028 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,8 +23,9 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] - os: [ ubuntu-latest, macos-13, macos-14 ] + python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] +# os: [ ubuntu-latest, macos-13, macos-14 ] + os: [ ubuntu-latest, macos-14 ] include: - ld_path: "/usr/local/lib" - os: macos-14 @@ -66,7 +67,7 @@ jobs: run: | mkdir MobilityDB/build cd MobilityDB/build - cmake .. -DMEOS=on + cmake .. -DMEOS=on -DCMAKE_INSTALL_PREFIX=${{ matrix.ld_prefix }} make -j sudo make install From 483243dd4c718375fcd69714e27c3aebea7b6154 Mon Sep 17 00:00:00 2001 From: diviloper Date: Sun, 1 Dec 2024 02:09:08 +0100 Subject: [PATCH 2/3] Add release workflow --- .github/workflows/release_and_publish.yml | 157 ++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 .github/workflows/release_and_publish.yml diff --git a/.github/workflows/release_and_publish.yml b/.github/workflows/release_and_publish.yml new file mode 100644 index 00000000..7c5b8858 --- /dev/null +++ b/.github/workflows/release_and_publish.yml @@ -0,0 +1,157 @@ +name: Release and Publish PyMEOS + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" + +jobs: + checks: + name: Make checks + runs-on: ubuntu-latest + + outputs: + is_alpha: ${{ steps.check_alpha.outputs.is_alpha }} + is_beta: ${{ steps.check_beta.outputs.is_beta }} + is_rc: ${{ steps.check_rc.outputs.is_rc }} + is_prerelease: ${{ steps.check_prerelease.outputs.is_prerelease }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check if publishing an alpha version + id: check_alpha + run: | + VERSION=${GITHUB_REF#refs/tags/} + + if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-alpha ]]; then + echo "Releasing an alpha version." + echo "is_alpha=true" >> "$GITHUB_OUTPUT" + else + echo "is_alpha=false" >> "$GITHUB_OUTPUT" + fi + + - name: Check if publishing a beta version + id: check_beta + run: | + VERSION=${GITHUB_REF#refs/tags/} + + if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-beta ]]; then + echo "Releasing a beta version." + echo "is_beta=true" >> "$GITHUB_OUTPUT" + else + echo "is_beta=false" >> "$GITHUB_OUTPUT" + fi + + - name: Check if publishing a release candidate version + id: check_rc + run: | + VERSION=${GITHUB_REF#refs/tags/} + + if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then + echo "Releasing an rc version." + echo "is_rc=true" >> "$GITHUB_OUTPUT" + else + echo "is_rc=false" >> "$GITHUB_OUTPUT" + fi + + - name: Check if publishing a prerelease version + id: check_prerelease + run: | + is_alpha=${{ steps.check_alpha.outputs.is_alpha }} + is_beta=${{ steps.check_beta.outputs.is_beta }} + is_rc=${{ steps.check_rc.outputs.is_rc }} + + if [ "$is_alpha" == "true" ] || [ "$is_beta" == "true" ] || [ "$is_rc" == "true" ]; then + echo "Releasing an prerelease version." + echo "is_prerelease=true" >> "$GITHUB_OUTPUT" + else + echo "is_prerelease=false" >> "$GITHUB_OUTPUT" + fi + + - name: Check package version matches tag + run: | + tag_version=${GITHUB_REF#refs/tags/v} + python_version=$(grep -oP '__version__ = "\K[^"]+' pymeos/__init__.py) + + if [[ "$tag_version" != "$python_version" ]]; then + echo "Tag Version ($tag_version) doesn't match Code Version ($python_version)" + echo "::error title=Version mismatch::Tag Version ($tag_version) doesn't match Code Version ($python_version)" + exit 1 + fi + + + build: + name: Build PyMEOS + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: 3.8 + cache: "pip" + + - name: Setup pip + run: | + python -m pip install --upgrade pip + python -m pip install build + + - name: Build package + run: python -m build + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + path: | + ./dist/pymeos-*.tar.gz + ./dist/pymeos-*.whl + + release: + name: Create GitHub Release + runs-on: ubuntu-latest + needs: [ checks, build ] + + permissions: + contents: write + + steps: + - name: Get artifacts + uses: actions/download-artifact@v4 + with: + path: ./dist + merge-multiple: true + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: ./dist/* + prerelease: ${{ needs.checks.outputs.is_prerelease }} + generate_release_notes: true + + publish: + name: Upload to PyPI + needs: [ build ] + runs-on: ubuntu-latest + + if: github.repository == 'MobilityDB/PyMEOS' + environment: + name: pypi + url: https://pypi.org/p/pymeos + permissions: + id-token: write + + steps: + - name: Get artifacts + uses: actions/download-artifact@v4 + with: + path: ./dist + merge-multiple: true + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + From 3d07c1afd312cb47ae50257b3163836fd9033c81 Mon Sep 17 00:00:00 2001 From: diviloper Date: Sun, 1 Dec 2024 02:13:36 +0100 Subject: [PATCH 3/3] Fix test workflow --- .github/workflows/test.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a08b028..8a1327df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,12 +24,11 @@ jobs: fail-fast: false matrix: python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] -# os: [ ubuntu-latest, macos-13, macos-14 ] - os: [ ubuntu-latest, macos-14 ] + os: [ ubuntu-latest, macos-13, macos-14 ] include: - - ld_path: "/usr/local/lib" + - ld_prefix: "/usr/local" - os: macos-14 - ld_path: "/opt/homebrew/lib" + ld_prefix: "/opt/homebrew" steps: - name: Checkout @@ -98,6 +97,6 @@ jobs: - name: Test PyMEOS with pytest run: | - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_path }} - export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_path }} + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib + export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib pytest