From dad46df87b653ec23c7c8aa5196f135e8270596b Mon Sep 17 00:00:00 2001 From: Till Hoffmann Date: Fri, 15 Nov 2024 11:35:47 -0500 Subject: [PATCH 1/4] Update action versions and remove password for pypi. --- .github/workflows/main.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dba698c..62778c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: CI +name: gptools on: push: @@ -23,11 +23,11 @@ jobs: name: Package tests and linting runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v2" - - uses: "actions/setup-python@v2" + - uses: "actions/checkout@v4" + - uses: "actions/setup-python@v5" with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ${{ env.pythonLocation }} @@ -51,14 +51,12 @@ jobs: - name: Upload the package to test pypi uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} packages_dir: ${{ matrix.module }}/dist repository_url: https://test.pypi.org/legacy/ skip_existing: true - name: Upload the package to pypi on `main` only - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'onnela-lab' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'onnela-lab' && matrix.python-version == '3.10' uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.PYPI_API_TOKEN }} packages_dir: ${{ matrix.module }}/dist skip_existing: true From 065a193115a818273b83574d3d62b32e9fc2f10c Mon Sep 17 00:00:00 2001 From: Till Hoffmann Date: Fri, 15 Nov 2024 11:39:39 -0500 Subject: [PATCH 2/4] Add trusted publisher permissions. --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 62778c9..85a9500 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,10 @@ on: branches: ["main"] workflow_dispatch: +# Needed for pypi using trusted publisher setup. +permissions: + id-token: write + env: # Our tests may contain a number of stochastic elements. Setting a seed will make sure they are # not flaky (but also hide potential issues). From 48bd85e34ad7e305230507a6807ca7691724bb1c Mon Sep 17 00:00:00 2001 From: Till Hoffmann Date: Fri, 15 Nov 2024 11:41:23 -0500 Subject: [PATCH 3/4] Use recommended kebab-case for pypi action. --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85a9500..c2016f4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,12 +55,12 @@ jobs: - name: Upload the package to test pypi uses: pypa/gh-action-pypi-publish@release/v1 with: - packages_dir: ${{ matrix.module }}/dist - repository_url: https://test.pypi.org/legacy/ - skip_existing: true + packages-dir: ${{ matrix.module }}/dist + repository-url: https://test.pypi.org/legacy/ + skip-existing: true - name: Upload the package to pypi on `main` only if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'onnela-lab' && matrix.python-version == '3.10' uses: pypa/gh-action-pypi-publish@release/v1 with: - packages_dir: ${{ matrix.module }}/dist - skip_existing: true + packages-dir: ${{ matrix.module }}/dist + skip-existing: true From 794f9ebb5be6be7e3aae34fe315546c6b5d69160 Mon Sep 17 00:00:00 2001 From: Till Hoffmann Date: Fri, 15 Nov 2024 11:57:51 -0500 Subject: [PATCH 4/4] Fix unpacking of results in tests. --- stan/tests/test_stan_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stan/tests/test_stan_functions.py b/stan/tests/test_stan_functions.py index 2243d3c..b0182c2 100644 --- a/stan/tests/test_stan_functions.py +++ b/stan/tests/test_stan_functions.py @@ -91,7 +91,7 @@ def assert_stan_function_allclose( return # Verify against expected value. We only check one because we have already verified that they # are the same. - result, = fit.stan_variable("result") + result = fit.stan_variable("result")[0] if not isinstance(desired, list): desired = [desired] try: