Skip to content

make nox-session reusable workflow #791

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

Merged
merged 3 commits into from
Jul 18, 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
48 changes: 48 additions & 0 deletions .github/workflows/.nox-session.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Nox Session

on:
workflow_call:
inputs:
session-name:
required: true
type: string
session-arguments:
required: false
type: string
runs-on-array:
required: false
type: string
default: '["ubuntu-latest"]'
python-version-array:
required: false
type: string
default: '["3.x"]'
job-name:
required: false
type: string
default: python-{0} {1}

jobs:
nox-session:
name: ${{ format(inputs.job-name, matrix.python-version, matrix.runs-on) }}
strategy:
matrix:
runs-on: ${{fromJson(inputs.runs-on-array)}}
python-version: ${{fromJson(inputs.python-version-array)}}
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install Specific NPM Version
run: npm install -g [email protected]
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python Dependencies
run: pip install -r requirements/nox-deps.txt
- name: Run Tests
env: { "CI": "true" }
run: nox -s ${{ inputs.session-name }} --stop-on-first-error -- ${{ inputs.session-arguments }}
97 changes: 24 additions & 73 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: test

on:
push:
Expand All @@ -11,75 +11,26 @@ on:
- cron: "0 0 * * *"

jobs:
test-python-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install Specific NPM Version
run: npm install -g [email protected]
- name: Use Latest Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install Python Dependencies
run: pip install -r requirements/nox-deps.txt
- name: Run Tests
env: { "CI": "true" }
run: nox -s test_python_suite -- --maxfail=3
test-python-environments:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install Specific NPM Version
run: npm install -g [email protected]
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python Dependencies
run: pip install -r requirements/nox-deps.txt
- name: Run Tests
env: { "CI": "true" }
run: nox -s test_python --stop-on-first-error -- --maxfail=3 --no-cov
test-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install Specific NPM Version
run: npm install -g [email protected]
- name: Use Latest Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install Python Dependencies
run: pip install -r requirements/nox-deps.txt
- name: Run Tests
env: { "CI": "true" }
run: nox -s test_docs
test-javascript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install Specific NPM Version
run: npm install -g [email protected]
- name: Install Python Dependencies
run: pip install -r requirements/nox-deps.txt
- name: Run Tests
env: { "CI": "true" }
run: nox -s test_javascript
python-coverage:
uses: ./.github/workflows/.nox-session.yml
with:
job-name: "python-{0}"
session-name: test_python_suite
session-arguments: --maxfail=3
python-environments:
uses: ./.github/workflows/.nox-session.yml
with:
session-name: test_python_suite
session-arguments: --maxfail=3 --no-cov
runs-on-array: '["ubuntu-latest", "macos-latest", "windows-latest"]'
python-version-array: '["3.7", "3.8", "3.9", "3.10"]'
docs:
uses: ./.github/workflows/.nox-session.yml
with:
job-name: "python-{0}"
session-name: test_docs
javascript:
uses: ./.github/workflows/.nox-session.yml
with:
job-name: "{1}"
session-name: test_javascript
2 changes: 1 addition & 1 deletion docs/source/_custom_js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements/build-docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx ==4.1.2
sphinx ==4.2.0
sphinx-autodoc-typehints ==1.7.0
furo ==2021.10.09
setuptools_scm
Expand Down