Skip to content

Commit

Permalink
Update PR build automation.
Browse files Browse the repository at this point in the history
  • Loading branch information
n8mellis committed Aug 24, 2023
1 parent 169af04 commit 330b9ff
Showing 1 changed file with 73 additions and 68 deletions.
141 changes: 73 additions & 68 deletions .github/workflows/CI_PR.yml
Original file line number Diff line number Diff line change
@@ -1,96 +1,101 @@
# This is a basic workflow to help you get started with Actions

name: CI_PR

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
# push:
# branches: [ main ]
# tags: v*

pull_request:

# Allows you to run this workflow manually from the Actions tab
pull_request:
branches:
- main
- release-v*

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

lint:
name: Run Python lint and type checks
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Setup Repo
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
submodules: recursive
# Semantic version range syntax or exact version of a Python version
python-version: 3.9
cache: pip
cache-dependency-path: |
packages/chassisml/pyproject.toml
- name: Setup Environment Variable
- name: Install dependencies
run: |
export CHASSIS_URL=${{secrets.CHASSIS_URL}}
export DOCKER_USER=${{secrets.DOCKER_USER}}
export DOCKER_PASS=${{secrets.DOCKER_PASS}}
export MODZY_BASE_URL=${{secrets.MODZY_BASE_URL}}
export MODZY_API_KEY=${{secrets.MODZY_API_KEY}}
- name: Set up Python 3.8
uses: actions/setup-python@v2
python -m pip install --upgrade pip
pip install ./packages/chassisml[test]
- name: Lint
run: tox -e lint

# - name: Verify Types
# run: tox -e type

tests:
name: Run tests for ${{ matrix.os }}/${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- python-version: "3.8"
tox-name: py38
- python-version: "3.9"
tox-name: py39
- python-version: "3.10"
tox-name: py310
- python-version: "3.11"
tox-name: py311
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: 3.8
python-version: "${{ matrix.python-version }}"
cache: pip
cache-dependency-path: |
packages/chassisml/pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
pip install ./packages/chassisml[test]
- name: Run tests
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --extend-ignore E303,E501,E712,E111,F821,E225 --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
tests:
tox -e ${{ matrix.tox-name }}
pip:
name: Build and publish SDK to PyPI
needs: [lint, tests]
runs-on: ubuntu-latest
if: true
env:
CHASSIS_URL: ${{secrets.CHASSIS_URL}}
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASS: ${{secrets.DOCKER_PASS}}
MODZY_BASE_URL: ${{secrets.MODZY_BASE_URL}}
MODZY_API_KEY: ${{secrets.MODZY_API_KEY}}

steps:
# new
- uses: actions/checkout@v2
with:
submodules: recursive
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.8'
python-version: 3.9
cache: pip
cache-dependency-path: |
packages/chassisml/pyproject.toml
- name: Upgrade pip
- name: Install pypa/build
run: |
# install pip=>20.1 to use "pip cache dir"
python3 -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: python3 -m pip install -r ./tests/requirements.txt
pip install build
- name: Test with Chassis specific testing scheme
- name: Build distribution
run: |
python -m tests.test --ci True
python3 -m build --sdist --wheel --outdir dist/ packages/chassisml

0 comments on commit 330b9ff

Please sign in to comment.