-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GH Actions workflow to replaced AppVeyor script
- Loading branch information
1 parent
f564e42
commit d73d191
Showing
1 changed file
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: 'PyDSDL application builder' | ||
|
||
# Builds OpenCyphal PyDSDL release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- issue-87 | ||
|
||
# Ensures that only one workflow is running at a time | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# | ||
# PyDSDL test | ||
# | ||
pydsdl-test: | ||
name: Test PyDSDL | ||
if: startsWith(github.ref, 'refs/heads/') | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-20.04] | ||
python: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11'] | ||
include: | ||
- os: windows-2019 | ||
python: '3.10' | ||
- os: macos-latest | ||
python: '3.9' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
# Checkout code from GitHub | ||
- name: Check out pydsdl | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check out public_regulated_data_types | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: OpenCyphal/public_regulated_data_types | ||
path: .dsdl-test | ||
|
||
# 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 | ||
fi | ||
python -m pip install --upgrade pip setuptools nox typed_ast | ||
shell: bash | ||
|
||
# Run build and test suite | ||
- name: Run build and test | ||
run: | | ||
if [ "$RUNNER_OS" == "Linux" ]; then | ||
nox --non-interactive --error-on-missing-interpreters --session test test_eol pristine lint --python ${{ matrix.python }} | ||
nox --non-interactive --session docs | ||
elif [ "$RUNNER_OS" == "Windows" ]; then | ||
echo "Hello World" | ||
# nox --forcecolor --non-interactive --error-on-missing-interpreters --session test test_eol pristine lint | ||
elif [ "$RUNNER_OS" == "macOS" ]; then | ||
nox --non-interactive --error-on-missing-interpreters --session test test_eol pristine lint --python ${{ matrix.python }} | ||
else | ||
echo "${{ runner.os }} not supported" | ||
exit 1 | ||
fi | ||
python -c "import pydsdl; pydsdl.read_namespace('.dsdl-test/uavcan', [])" | ||
shell: bash | ||
|
||
# | ||
# Create release | ||
# | ||
pydsdl-release: | ||
name: Release PyDSDL | ||
if: startsWith(github.ref, 'refs/heads/') | ||
needs: pydsdl-test | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout code from GitHub | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
|
||
# Build distribution from source | ||
- name: Build distribution | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel twine | ||
python setup.py sdist bdist_wheel | ||
# Obtain release version number | ||
- name: Get release version | ||
run: echo "pydsdl_version=$(python3 -c 'import pydsdl; print(pydsdl.__version__)')" >> $GITHUB_ENV | ||
|
||
# Upload distribution to pypi.org | ||
- name: Upload distribution | ||
if: false | ||
run: | | ||
python -m twine upload dist/* | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_PYDSDL }} | ||
|
||
# Tag release | ||
- name: Push version tag | ||
uses: mathieudutour/github-tag-action@v6.1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
custom_tag: ${{ env.pydsdl_version }} | ||
tag_prefix: '' | ||
dry_run: true |