Skip to content

Commit

Permalink
Separated test and make workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
clyde-johnston committed Aug 9, 2023
1 parent 059e2f0 commit 1f67440
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 81 deletions.
89 changes: 8 additions & 81 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
@@ -1,118 +1,45 @@
name: 'PyCyphal application builder'

# Builds OpenCyphal PyCyphal release
name: 'Build PyCyphal'
on:
push:
branches:
- master
- issue-259
pull_request:
branches:
- master
tags: [ '#release' ]
workflow_run:
workflows: [ 'Test PyCyphal' ]
branches: [ master ]
types: [ completed ]


# Ensures that only one workflow is running at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
#
# PyCyphal test
#
pycyphal-test:
name: Test PyCyphal
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2019-npcap]
python: ['3.7', '3.8', '3.9', '3.10']
runs-on: ${{ matrix.os }}
steps:
# Checkout pycyphal repository
- name: Check out
uses: actions/checkout@v3

# Install Python version needed for test
- name: Install Python3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

# Log Python version
- name: Log Python version
run: python --version

# Install test dependencies
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install -y linux-*-extra-$(uname -r) graphviz ncat
fi
git submodule update --init --recursive
python -m pip install --upgrade pip setuptools nox
shell: bash

# Log system and network configurations
- name: Collect Linux diagnostic data
if: ${{ runner.os == 'Linux' }}
run: ip link show

- name: Collect Windows diagnostic data
if: ${{ runner.os == 'Windows' }}
run: |
systeminfo
route print
ipconfig /all
# Run build and test suite
- name: Run build and test
run: |
nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }}
nox --non-interactive --session demo check_style docs
# Save logs
- name: Save logs
uses: actions/upload-artifact@v3
with:
name: PyCyphal-${{ matrix.os }}-python-${{ matrix.python }}
path: .nox/*/*/*.log
retention-days: 7

#
# Create release
#
pycyphal-release:
name: Release PyCyphal
if: (github.event_name == 'push') && (github.ref == 'refs/heads/master')
needs: pycyphal-test
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
# Checkout code from GitHub
- name: Check out
uses: actions/checkout@v3

# Build distribution from source
- name: Install dependencies
run: |
git submodule update --init --recursive
python -m pip install --upgrade pip setuptools wheel twine
python setup.py sdist bdist_wheel
# Obtain release version number
- name: Get release version
run: |
cd pycyphal
echo "pycyphal_version=$(python -c 'from _version import __version__; print(__version__)')" >> $GITHUB_ENV
# Upload distribution to pypi.org
- name: Upload distribution
run: |
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_PYCYPHAL }}

# Tag release
- name: Push version tag
uses: mathieudutour/[email protected]
with:
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: 'Test PyCyphal'

# Test OpenCyphal PyCyphal release
on: push
# pull_request:
# branches:
# - master

# Ensures that only one workflow is running at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pycyphal-test:
name: Test PyCyphal
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2019-npcap]
python: ['3.7', '3.8', '3.9', '3.10']
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v3

- name: Install Python3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Log Python version
run: python --version

- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install -y linux-*-extra-$(uname -r) graphviz ncat
fi
git submodule update --init --recursive
python -m pip install --upgrade pip setuptools nox
shell: bash

- name: Collect Linux diagnostic data
if: ${{ runner.os == 'Linux' }}
run: ip link show

- name: Collect Windows diagnostic data
if: ${{ runner.os == 'Windows' }}
run: |
systeminfo
route print
ipconfig /all
- name: Run build and test
run: |
nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }}
nox --non-interactive --session demo check_style docs
- name: Save logs
uses: actions/upload-artifact@v3
with:
name: PyCyphal-${{ matrix.os }}-python-${{ matrix.python }}
path: .nox/*/*/*.log
retention-days: 7

0 comments on commit 1f67440

Please sign in to comment.