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

Workflow improvement #507

Merged
merged 2 commits into from
Jan 13, 2023
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
8 changes: 7 additions & 1 deletion .github/workflows/base.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@ on:
push:
branches: [ master, dev ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
&{strategy}
matrix:
&{matrix}
&{exclude}

if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/develop_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
push:
branches: [ master, dev ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false

Expand All @@ -21,6 +26,7 @@ jobs:



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
Expand All @@ -46,10 +52,12 @@ jobs:
if: startsWith(runner.os, 'macOS') == true

- name: Run Nox session for testing brevitas develop install and imports
if: ${{ (contains(fromJson('["1.5.1", "1.10.1", "1.13.0"]'), matrix.pytorch_version ) && github.event_name == 'pull_request' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'review_requested')}}
shell: bash
run: nox -v -s tests_brevitas_install_dev-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)

- name: Run Nox session for testing brevitas_examples develop install and imports
if: ${{ (contains(fromJson('["1.5.1", "1.10.1", "1.13.0"]'), matrix.pytorch_version ) && github.event_name == 'pull_request' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'review_requested')}}
shell: bash
run: nox -v -s tests_brevitas_examples_install_dev-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/end_to_end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
push:
branches: [ master, dev ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false
max-parallel: 4
Expand All @@ -25,6 +30,7 @@ jobs:



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
Expand All @@ -50,6 +56,7 @@ jobs:
if: startsWith(runner.os, 'macOS') == true

- name: Run Nox session for end-to-end flows
if: ${{ (contains(fromJson('["1.5.1", "1.10.1", "1.13.0"]'), matrix.pytorch_version ) && github.event_name == 'pull_request' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'review_requested')}}
shell: bash
run: nox -v -s tests_brevitas_end_to_end-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/examples_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
push:
branches: [ master, dev ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false

Expand All @@ -22,6 +27,7 @@ jobs:



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
Expand All @@ -47,6 +53,7 @@ jobs:
if: startsWith(runner.os, 'macOS') == true

- name: Run Nox session for brevitas_examples pytest
if: ${{ (contains(fromJson('["1.5.1", "1.10.1", "1.13.0"]'), matrix.pytorch_version ) && github.event_name == 'pull_request' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'review_requested')}}
shell: bash
run: nox -v -s tests_brevitas_examples_cpu-${{ matrix.python_version }}\(${{ matrix.jit_status }}\,\ pytorch_${{ matrix.pytorch_version }}\)

Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/finn_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
push:
branches: [ master, dev ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false

Expand All @@ -21,6 +26,7 @@ jobs:



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
Expand All @@ -46,11 +52,12 @@ jobs:
if: startsWith(runner.os, 'macOS') == true

- name: Install protobuf on Ubuntu
if: startsWith(runner.os, 'Linux') == true
shell: bash
run: sudo apt-get install protobuf-compiler libprotoc-dev
if: startsWith(runner.os, 'Linux') == true

- name: Run Nox session for Brevitas-FINN integration
if: ${{ (contains(fromJson('["1.5.1", "1.10.1", "1.13.0"]'), matrix.pytorch_version ) && github.event_name == 'pull_request' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'review_requested')}}
shell: bash
run: nox -v -s tests_brevitas_finn_integration-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)

Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/gen_github_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
NOTEBOOK_YML = 'notebook.yml'
ENDTOEND_YML = 'end_to_end.yml'

# Reduced Test for PRs, except when a review is requested
CONDITION= "${{ (contains(fromJson(\'[%PYTORCH_LIST_REDUCED]\'), matrix.pytorch_version ) && github.event_name == \'pull_request\' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != \'pull_request\') || (github.event_name == \'pull_request\' && github.event.action == \'review_requested\')}} "

# Data shared betwen Nox sessions and Github Actions, formatted as tuples
PYTHON_VERSIONS = ('3.7', '3.8')
PYTORCH_VERSIONS = ('1.5.1', '1.6.0', '1.7.1', '1.8.1', '1.9.1', '1.10.1', '1.11.0', '1.12.1', '1.13.0')
PYTORCH_LIST_REDUCED = ["1.5.1", "1.10.1", "1.13.0"]
JIT_STATUSES = ('jit_disabled',)

# Data used only by Github Actions, formatted as lists or lists of ordered dicts
Expand Down Expand Up @@ -47,6 +50,7 @@
PYTEST_STEP_LIST = [
od([
('name', 'Run Nox session for brevitas pytest'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_cpu-${{ matrix.python_version }}\(${{ matrix.jit_status }}\,\ pytorch_${{ matrix.pytorch_version }}\)')]),
Expand All @@ -55,6 +59,7 @@
EXAMPLES_PYTEST_STEP_LIST = [
od([
('name', 'Run Nox session for brevitas_examples pytest'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_examples_cpu-${{ matrix.python_version }}\(${{ matrix.jit_status }}\,\ pytorch_${{ matrix.pytorch_version }}\)')]),
Expand All @@ -63,13 +68,15 @@
FINN_INTEGRATION_STEP_LIST = [
od([
('name', 'Install protobuf on Ubuntu'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'sudo apt-get install protobuf-compiler libprotoc-dev'),
('if', "startsWith(runner.os, 'Linux') == true")
]),
od([
('name', 'Run Nox session for Brevitas-FINN integration'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_finn_integration-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)')
Expand All @@ -78,6 +85,7 @@
PYXIR_INTEGRATION_STEP_LIST = [
od([
('name', 'Run Nox session for Brevitas-PyXIR integration'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_pyxir_integration-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)')
Expand All @@ -86,6 +94,7 @@
ORT_INTEGRATION_STEP_LIST = [
od([
('name', 'Run Nox session for Brevitas-ORT integration'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_ort_integration-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)')
Expand All @@ -94,11 +103,13 @@
TEST_INSTALL_DEV_STEP_LIST = [
od([
('name', 'Run Nox session for testing brevitas develop install and imports'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_install_dev-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)')]),
od([
('name', 'Run Nox session for testing brevitas_examples develop install and imports'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_examples_install_dev-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)')
Expand All @@ -107,6 +118,7 @@
NOTEBOOK_STEP_LIST = [
od([
('name', 'Run Nox session for Notebook execution'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_notebook-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)')
Expand All @@ -115,6 +127,7 @@
ENDTOEND_STEP_LIST = [
od([
('name', 'Run Nox session for end-to-end flows'),
('if', CONDITION.replace('%PYTORCH_LIST_REDUCED', ', '.join(f'"{version}"' for version in PYTORCH_LIST_REDUCED) )),
('shell', 'bash'),
('run',
'nox -v -s tests_brevitas_end_to_end-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)')
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/notebook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
push:
branches: [ master, dev ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false

Expand All @@ -28,6 +33,7 @@ jobs:



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
Expand All @@ -53,6 +59,7 @@ jobs:
if: startsWith(runner.os, 'macOS') == true

- name: Run Nox session for Notebook execution
if: ${{ (contains(fromJson('["1.5.1", "1.10.1", "1.13.0"]'), matrix.pytorch_version ) && github.event_name == 'pull_request' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'review_requested')}}
shell: bash
run: nox -v -s tests_brevitas_notebook-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/ort_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
push:
branches: [ master, dev ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false

Expand All @@ -21,6 +26,7 @@ jobs:



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
Expand All @@ -46,6 +52,7 @@ jobs:
if: startsWith(runner.os, 'macOS') == true

- name: Run Nox session for Brevitas-ORT integration
if: ${{ (contains(fromJson('["1.5.1", "1.10.1", "1.13.0"]'), matrix.pytorch_version ) && github.event_name == 'pull_request' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'review_requested')}}
shell: bash
run: nox -v -s tests_brevitas_ort_integration-${{ matrix.python_version }}\(\pytorch_${{ matrix.pytorch_version }}\)

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
push:
branches: [ master, dev ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false

Expand All @@ -22,6 +27,7 @@ jobs:



if: ${{ !github.event.pull_request.draft }}
steps:

- name: Checkout repo
Expand All @@ -47,6 +53,7 @@ jobs:
if: startsWith(runner.os, 'macOS') == true

- name: Run Nox session for brevitas pytest
if: ${{ (contains(fromJson('["1.5.1", "1.10.1", "1.13.0"]'), matrix.pytorch_version ) && github.event_name == 'pull_request' && matrix.platform == 'ubuntu-latest' ) || (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'review_requested')}}
shell: bash
run: nox -v -s tests_brevitas_cpu-${{ matrix.python_version }}\(${{ matrix.jit_status }}\,\ pytorch_${{ matrix.pytorch_version }}\)

Expand Down