From 9fb61625f609fb740732e923b0167a09f8865079 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 17 Feb 2024 12:06:44 +0100 Subject: [PATCH 1/7] chore(ci): test action on macos-14 --- .github/workflows/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 65b15a63..3ab1e4c3 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -27,6 +27,7 @@ jobs: macos-11, macos-12, macos-13, + macos-14, ] steps: - uses: actions/checkout@v4 From 71ae74dcf20f31ef683f2caf3e3801b3b3f92b4c Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 17 Feb 2024 12:14:13 +0100 Subject: [PATCH 2/7] temp: python 3.8 & 3.9 missing on macos-14 --- .github/workflows/action.yml | 11 ++++++++++- noxfile.py | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 3ab1e4c3..93757bf0 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -27,12 +27,12 @@ jobs: macos-11, macos-12, macos-13, - macos-14, ] steps: - uses: actions/checkout@v4 - uses: ./ - run: nox --non-interactive --error-on-missing-interpreter --session github_actions_default_tests + action-all-tests: runs-on: windows-latest steps: @@ -44,3 +44,12 @@ jobs: with: python-versions: "3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, pypy-2.7, pypy-3.7, pypy-3.8, pypy-3.9, pypy-3.10" - run: nox --non-interactive --error-on-missing-interpreter --session github_actions_all_tests + + action-macos14-tests: + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + - uses: ./ + with: + python-versions: "3.10, 3.11, 3.12, pypy-3.8, pypy-3.9, pypy-3.10" + - run: nox --non-interactive --error-on-missing-interpreter --session github_actions_macos_14 diff --git a/noxfile.py b/noxfile.py index a7a665c7..6b4de3ad 100644 --- a/noxfile.py +++ b/noxfile.py @@ -174,7 +174,6 @@ def github_actions_default_tests(session: nox.Session) -> None: _check_python_version(session) -# The following sessions are only to be run in CI to check the nox GHA action @nox.session( python=[ "3.7", @@ -192,3 +191,19 @@ def github_actions_default_tests(session: nox.Session) -> None: def github_actions_all_tests(session: nox.Session) -> None: """Check all versions installed by the nox GHA Action""" _check_python_version(session) + + +@nox.session( + python=[ + "3.10", + "3.11", + "3.12", + "pypy3.8", + "pypy3.9", + "pypy3.10", + ] +) +def github_actions_macos_14(session: nox.Session) -> None: + """Check default versions installed by the nox GHA Action""" + assert sys.version_info[:2] == (3, 11) + _check_python_version(session) From 5db544ad66a163546f927c16493c91b016d0bb1d Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 17 Feb 2024 12:39:55 +0100 Subject: [PATCH 3/7] temp: don't use pipx --- action.yml | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index f0392ba0..f0837713 100644 --- a/action.yml +++ b/action.yml @@ -31,5 +31,48 @@ runs: allow-prereleases: true - name: "Install nox" - run: pipx install --python "${{ steps.allpython.outputs.python-path }}" '${{ github.action_path }}' + run: | + # Install nox + "${{ steps.allpython.outputs.python-path }}" -u << "EOF" + import os + import shutil + import sys + import venv + + from pathlib import Path + from subprocess import run + + + class EnvBuilder(venv.EnvBuilder): + def __init__(self): + super().__init__() + + def setup_scripts(self, context): + pass + + def post_setup(self, context): + super().post_setup(context) + self.bin_path = Path(context.env_exe).parent + run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", r"${{ github.action_path }}"], check=True) + + + print("::group::Install nox") + nox_bin_path = Path(r"${{ runner.temp }}") / "nox" + if nox_bin_path.exists(): + shutil.rmtree(nox_bin_path) + venv_path = Path(r"${{ runner.temp }}") / "nox-venv" + if venv_path.exists(): + shutil.rmtree(venv_path) + builder = EnvBuilder() + builder.create(venv_path) + nox_path = [path for path in builder.bin_path.glob("nox*") if path.stem == "nox"][0] + nox_bin_path.mkdir() + try: + os.symlink(nox_path, nox_bin_path / nox_path.name) + except OSError: + shutil.copyfile(nox_path, nox_bin_path / nox_path.name) + with open(os.environ["GITHUB_PATH"], "at") as f: + f.write(f"{nox_bin_path}\n") + print("::endgroup::") + EOF shell: bash From dbfbcfd854e63c043764da73a8452104c5140782 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 28 Mar 2024 17:22:02 -0400 Subject: [PATCH 4/7] fix: use local python and try step shell --- action.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/action.yml b/action.yml index f0837713..6874b2c9 100644 --- a/action.yml +++ b/action.yml @@ -32,8 +32,6 @@ runs: - name: "Install nox" run: | - # Install nox - "${{ steps.allpython.outputs.python-path }}" -u << "EOF" import os import shutil import sys @@ -74,5 +72,4 @@ runs: with open(os.environ["GITHUB_PATH"], "at") as f: f.write(f"{nox_bin_path}\n") print("::endgroup::") - EOF - shell: bash + shell: "${{ steps.localpython.outputs.python-path }}" -u From edd4d82b82b02bbc7eec3c03e855fabcef8a28d3 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 28 Mar 2024 17:23:47 -0400 Subject: [PATCH 5/7] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 6874b2c9..39321e8b 100644 --- a/action.yml +++ b/action.yml @@ -72,4 +72,4 @@ runs: with open(os.environ["GITHUB_PATH"], "at") as f: f.write(f"{nox_bin_path}\n") print("::endgroup::") - shell: "${{ steps.localpython.outputs.python-path }}" -u + shell: "${{ steps.localpython.outputs.python-path }} -u" From da51d7c3358f54946493490543e8877705318652 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 28 Mar 2024 17:28:02 -0400 Subject: [PATCH 6/7] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 39321e8b..ab437f6b 100644 --- a/action.yml +++ b/action.yml @@ -72,4 +72,4 @@ runs: with open(os.environ["GITHUB_PATH"], "at") as f: f.write(f"{nox_bin_path}\n") print("::endgroup::") - shell: "${{ steps.localpython.outputs.python-path }} -u" + shell: "${{ steps.localpython.outputs.python-path }} -u {0}" From 484a0324f96de18b8e6ec07fc9bffbb24338cbf6 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 28 Mar 2024 19:22:01 -0400 Subject: [PATCH 7/7] Apply suggestions from code review --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index ab437f6b..7e16bab7 100644 --- a/action.yml +++ b/action.yml @@ -72,4 +72,4 @@ runs: with open(os.environ["GITHUB_PATH"], "at") as f: f.write(f"{nox_bin_path}\n") print("::endgroup::") - shell: "${{ steps.localpython.outputs.python-path }} -u {0}" + shell: "${{ steps.allpython.outputs.python-path }} -u {0}"