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

Issue 259 - Create GH Actions workflow to replace AppVeyor #303

Merged
merged 18 commits into from
Aug 22, 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
114 changes: 0 additions & 114 deletions .appveyor.yml

This file was deleted.

100 changes: 100 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: 'Test and Release PyCyphal'
on: push

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

jobs:
pycyphal-test:
name: Test PyCyphal
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, 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 --ignore-missing update || true
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: bash

- name: Save logs
uses: actions/upload-artifact@v3
with:
name: PyCyphal-${{ matrix.os }}-python-${{ matrix.python }}
path: .nox/*/*/*.log
retention-days: 7

pycyphal-release:
name: Release PyCyphal
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '#release') || contains(github.ref, '/master')
needs: pycyphal-test
steps:
- name: Check out
uses: actions/checkout@v3

- name: Create distribution wheel
run: |
git submodule update --init --recursive
python -m pip install --upgrade pip setuptools wheel twine
python setup.py sdist bdist_wheel

- name: Get release version
run: |
cd pycyphal
echo "pycyphal_version=$(python -c 'from _version import __version__; print(__version__)')" >> $GITHUB_ENV

- name: Upload distribution
run: |
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_PYCYPHAL }}

- name: Push version tag
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ env.pycyphal_version }}
tag_prefix: ''

4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ def test(session):
session.run("pylint", *map(str, src_dirs), env={"PYTHONPATH": str(compiled_dir)})

# Publish coverage statistics. This also has to be run from the test session to access the coverage files.
if sys.platform.startswith("linux") and is_latest_python(session) and session.env.get("COVERALLS_REPO_TOKEN"):
if sys.platform.startswith("linux") and is_latest_python(session) and session.env.get("GITHUB_TOKEN"):
session.install("coveralls")
session.run("coveralls")
else:
session.log("Coveralls skipped")

# Submit analysis to SonarCloud. This also has to be run from the test session to access the coverage files.
sonarcloud_token = session.env.get("SONARCLOUD_TOKEN")
sonarcloud_token = session.env.get("SONAR_TOKEN")
if sys.platform.startswith("linux") and is_latest_python(session) and sonarcloud_token:
session.run("coverage", "xml", "-i", "-o", str(ROOT_DIR / ".coverage.xml"))

Expand Down
2 changes: 1 addition & 1 deletion pycyphal/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.15.2"
__version__ = "1.15.3"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,4 @@ overgeneral-exceptions=BaseException
[doc8]
ignore-path = docs/api,./.nox,./pycyphal.egg-info
max-line-length = 120
ignore = D000
ignore = D000,D002,D004