From 78f026d01c431c15bfc41c2f0f9e961ce7d760a4 Mon Sep 17 00:00:00 2001 From: Rory Barnes Date: Fri, 6 Sep 2024 11:11:59 -0700 Subject: [PATCH] Updated pip-install to upload macOS artifacts to PyPi. Changed bFloatComparison to fbFloatComparison. --- .github/workflows/pip-install.yml | 30 +++++++++++++++++++++--------- .github/workflows/tests-linux.yml | 1 - Makefile | 5 ++++- src/evolve.c | 4 ++-- src/verify.c | 2 +- src/verify.h | 2 +- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pip-install.yml b/.github/workflows/pip-install.yml index 173b8a31f..934affb73 100644 --- a/.github/workflows/pip-install.yml +++ b/.github/workflows/pip-install.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] exclude: - os: ubuntu-22.04 python-version: '3.6' @@ -60,7 +60,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] exclude: - os: ubuntu-22.04 python-version: '3.6' @@ -96,7 +96,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] exclude: - os: ubuntu-22.04 python-version: '3.6' @@ -105,7 +105,7 @@ jobs: - os: macos-14 python-version: '3.7' fail-fast: false - + steps: - uses: actions/download-artifact@v4 with: @@ -117,9 +117,21 @@ jobs: name: sdist-${{ matrix.os }}-${{ matrix.python-version }} path: dist + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install twine + + - name: Upload to PyPI + if: github.repository == 'VirtualPlanetaryLaboratory/vplanet' + run: python -m twine upload dist/* wheelhouse/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.pypi_password }} + # Only push to PyPI if we're on the public repo! - - uses: pypa/gh-action-pypi-publish@release/v1 - if: (!github.event.release.prerelease) && github.event_name == 'release' && github.event.action == 'published' && github.repository == 'VirtualPlanetaryLaboratory/vplanet' - with: - user: __token__ - password: ${{ secrets.pypi_password }} + # - uses: pypa/gh-action-pypi-publish@release/v1 + # if: (!github.event.release.prerelease) && github.event_name == 'release' && github.event.action == 'published' && github.repository == 'VirtualPlanetaryLaboratory/vplanet' + # with: + # user: __token__ + # password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/tests-linux.yml b/.github/workflows/tests-linux.yml index 559d47615..9ea95a810 100644 --- a/.github/workflows/tests-linux.yml +++ b/.github/workflows/tests-linux.yml @@ -50,7 +50,6 @@ jobs: - name: Check test output created id: check_test_file - if: ${{ matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9' }} uses: andstor/file-existence-action@v3 with: files: "${{ github.workspace }}/junit/test-results.xml" diff --git a/Makefile b/Makefile index 938bfb5a1..8e36d81f8 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ legacy: @echo "==========================================================================================================" debug: - -gcc -g -D DEBUG -o bin/vplanet src/*.c -lm -DGITVERSION=\"$(GITVERSION)\" + -gcc -g -D DEBUG -Wunused-but-set-variable -Wunused-variable -Wfloat-equal -o bin/vplanet src/*.c -lm -DGITVERSION=\"$(GITVERSION)\" debug_no_AE: -gcc -g -o bin/vplanet src/*.c -lm -DGITVERSION=\"$(GITVERSION)\" @@ -51,6 +51,9 @@ opt: cpp: g++ -o bin/vplanet src/*.c -lm -O3 -fopenmp -fpermissive -w -DGITVERSION=\"$(GITVERSION)\" +warnings: + clang -Weverything src/*.c -lm -O3 -DGITVERSION=\"$(GITVERSION)\" + parallel: gcc -o bin/vplanet src/*.c -lm -O3 -fopenmp -DGITVERSION=\"$(GITVERSION)\" diff --git a/src/evolve.c b/src/evolve.c index d9ef4a245..832eb495c 100644 --- a/src/evolve.c +++ b/src/evolve.c @@ -307,9 +307,9 @@ double fdGetTimeStep(BODY *body, CONTROL *control, SYSTEM *system, update[iBody].daDerivProc[iVar][iEqn] = fnUpdate[iBody][iVar][iEqn]( body, system, update[iBody].iaBody[iVar][iEqn]); - if (!bFloatComparison(update[iBody].daDerivProc[iVar][iEqn], + if (!fbFloatComparison(update[iBody].daDerivProc[iVar][iEqn], 0.0) && - !bFloatComparison(*(update[iBody].pdVar[iVar]), 0.0)) { + !fbFloatComparison(*(update[iBody].pdVar[iVar]), 0.0)) { dMinNow = fabs((*(update[iBody].pdVar[iVar])) / update[iBody].daDerivProc[iVar][iEqn]); if (dMinNow < dMin) { diff --git a/src/verify.c b/src/verify.c index c0ec8eb4e..d480dbb1d 100644 --- a/src/verify.c +++ b/src/verify.c @@ -12,7 +12,7 @@ */ /*! Check to see if two decimals numbers are equal (1) or not (0) */ -int bFloatComparison(double x, double y) { +int fbFloatComparison(double x, double y) { double dBigger; double dRel_Tol; if (fabs(x) > fabs(y)) { diff --git a/src/verify.h b/src/verify.h index 585b3bfbc..c96654114 100644 --- a/src/verify.h +++ b/src/verify.h @@ -13,7 +13,7 @@ void VerifyTripleExit(char[], char[], char[], int, int, int, char[], int); void VerifyOptions(BODY *, CONTROL *, FILES *, MODULE *, OPTIONS *, OUTPUT *, SYSTEM *, UPDATE *, fnIntegrate *, fnUpdateVariable ****); void VerifyDynEllip(BODY *, CONTROL *, OPTIONS *, char[], int, int); -int bFloatComparison(double, double); +int fbFloatComparison(double, double); void fnNullDerivatives(BODY *, EVOLVE *, MODULE *, UPDATE *, fnUpdateVariable ***);