Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: GitHub Action can now be used on ubuntu-18.04 runner #606

Merged
merged 2 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Action
on:
push:
branches:
- 'main'
- '**action**'
pull_request:
paths:
- '.github/workflows/action.yml'
- 'action.yml'
env:
FORCE_COLOR: "1"
jobs:
action-default-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022, macos-10.15, macos-11, macos-12]
steps:
- uses: actions/checkout@v3
- uses: ./
- run: nox --non-interactive --error-on-missing-interpreter --session github_actions_default_tests
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ runs:
python-version: "3.10"

- name: "Install nox"
run: pipx install '${{ github.action_path }}'
# --python "$(which python)" => always use the last setup-python version to install nox.
run: pipx install --python "$(which python)" '${{ github.action_path }}'
shell: bash
28 changes: 28 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,31 @@ def docs(session: nox.Session) -> None:
sphinx_args.insert(0, "--open-browser")

session.run(sphinx_cmd, *sphinx_args)


# The following sessions are only to be run in CI to check the nox GHA action
def _check_python_version(session: nox.Session) -> None:
if session.python.startswith("pypy"):
python_version = session.python[4:]
implementation = "pypy"
else:
python_version = session.python
implementation = "cpython"
session.run(
"python",
"-c",
"import sys; assert '.'.join(str(v) for v in sys.version_info[:2]) =="
f" '{python_version}'",
)
if python_version[:2] != "2.":
session.run(
"python",
"-c",
f"import sys; assert sys.implementation.name == '{implementation}'",
)


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy3.7", "pypy3.8", "pypy3.9"])
def github_actions_default_tests(session: nox.Session) -> None:
"""Check default versions installed by the nox GHA Action"""
_check_python_version(session)