From 86878a45a7873fb0092fc371a84b33c492c50810 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Sat, 3 Jun 2023 14:53:48 +0300 Subject: [PATCH 01/18] Added GHA workflow to replace AppVeyor (#259) --- .github/workflows/make-release.yml | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/make-release.yml diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml new file mode 100644 index 00000000..d706a2e5 --- /dev/null +++ b/.github/workflows/make-release.yml @@ -0,0 +1,50 @@ +name: 'PyCyphal application builder' + +# Builds OpenCyphal PyCyphal release + +on: + push: + branches: + - main + - issue-259 + +# 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 + if: startsWith(github.ref, 'refs/heads/') + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + python: ['3.7', '3.8', '3.9', '3.10'] + runs-on: ${{ matrix.os }} + steps: + - name: Checking out + uses: actions/checkout@v3 + + - name: Installing Python3 + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Installing dependencies + run: | + sudo apt-get install -y linux-*-extra-$(uname -r) graphviz ncat + git submodule update --init --recursive + python -m pip install --upgrade pip setuptools nox + + - name: Run nox tests + run: | + nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} + nox --non-interactive --session demo check_style docs + + - name: Diagnostics aid + run: ip link show From 51fbd94f09e86114357b4e0742d7eef21fdd6549 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Mon, 5 Jun 2023 13:10:47 +0300 Subject: [PATCH 02/18] Added Windows 2019 runner with npcap, graphviz installed --- .github/workflows/make-release.yml | 40 ++++++++++++++++++++++++------ setup.cfg | 2 +- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index d706a2e5..dba58e42 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -23,28 +23,54 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04] + os: [ubuntu-20.04, windows-2019-npcap] python: ['3.7', '3.8', '3.9', '3.10'] + exclude: + - os: windows-2019-npcap + python: '3.8' + - os: windows-2019-npcap + python: '3.9' runs-on: ${{ matrix.os }} steps: - - name: Checking out + # Checkout code from GitHub + - name: Check out uses: actions/checkout@v3 - - name: Installing Python3 + # Install Python version needed for test + - name: Install Python3 uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - - name: Installing dependencies + # Log Python version + - name: Log Python version + run: python --version + + # Install test dependencies + - name: Install dependencies run: | - sudo apt-get install -y linux-*-extra-$(uname -r) graphviz ncat + 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 test suite - name: Run nox tests run: | nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} nox --non-interactive --session demo check_style docs - - name: Diagnostics aid - run: ip link show diff --git a/setup.cfg b/setup.cfg index 82857360..0e616160 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 From fe5d0bc71f3c32cadeaf1473e1517ea34898ba3a Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Wed, 7 Jun 2023 17:47:56 +0300 Subject: [PATCH 03/18] Added Windows PyCyphal test jobs --- .github/workflows/make-release.yml | 48 ++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index dba58e42..fe0c7619 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -25,11 +25,6 @@ jobs: matrix: os: [ubuntu-20.04, windows-2019-npcap] python: ['3.7', '3.8', '3.9', '3.10'] - exclude: - - os: windows-2019-npcap - python: '3.8' - - os: windows-2019-npcap - python: '3.9' runs-on: ${{ matrix.os }} steps: # Checkout code from GitHub @@ -74,3 +69,46 @@ jobs: nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} nox --non-interactive --session demo check_style docs + # Save test 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: startsWith(github.ref, 'refs/heads/') + needs: pycyphal-test + runs-on: ubuntu-latest + 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 + + # Upload distribution to pypi.org + - name: Upload distribution + run: | + # python -m twin upload dist/* + ls -l dist/* + + # Tag release + # - name: Push version tag + # id: tag_version + # uses: mathieudutour/github-tag-action@v6.1 + # with: + # github_token: ${{ secrets.OPENCYPHAL_TOKEN }} + # custom_tag: ${{ inputs.version }} + # tag_prefix: '' + From ec00efe0000d0c63321b91c8c0accaa5e884fad5 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Thu, 8 Jun 2023 16:41:34 +0300 Subject: [PATCH 04/18] Push release tag to GitHub --- .github/workflows/make-release.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index fe0c7619..eb2064ac 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -6,7 +6,6 @@ on: push: branches: - main - - issue-259 # Ensures that only one workflow is running at a time concurrency: @@ -97,18 +96,20 @@ jobs: 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 twin upload dist/* - ls -l dist/* + run: python -m twin upload dist/* # Tag release - # - name: Push version tag - # id: tag_version - # uses: mathieudutour/github-tag-action@v6.1 - # with: - # github_token: ${{ secrets.OPENCYPHAL_TOKEN }} - # custom_tag: ${{ inputs.version }} - # tag_prefix: '' - + - name: Push version tag + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{ env.pycyphal_version }} + tag_prefix: '' From 6c4e4df6b6a7414c557baec3a0ed50ccb5d92d54 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Sat, 10 Jun 2023 23:29:58 +0300 Subject: [PATCH 05/18] Corrected branch name and typo --- .github/workflows/make-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index eb2064ac..7f2401d1 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -5,7 +5,7 @@ name: 'PyCyphal application builder' on: push: branches: - - main + - master # Ensures that only one workflow is running at a time concurrency: @@ -104,7 +104,7 @@ jobs: # Upload distribution to pypi.org - name: Upload distribution - run: python -m twin upload dist/* + run: python -m twine upload dist/* # Tag release - name: Push version tag From a3ef9e02d074bfc7a0503da37363dbd64bb4001f Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Sat, 10 Jun 2023 23:44:20 +0300 Subject: [PATCH 06/18] Test twine distribution --- .github/workflows/make-release.yml | 16 ++++++++++++---- pycyphal/_version.py | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index 7f2401d1..89a501e3 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -6,6 +6,7 @@ on: push: branches: - master + - issue-259 # Ensures that only one workflow is running at a time concurrency: @@ -62,13 +63,14 @@ jobs: route print ipconfig /all - # Run test suite - - name: Run nox tests + # Run build and test suite + - name: Run build and test + if: false run: | nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} nox --non-interactive --session demo check_style docs - # Save test logs + # Save logs - name: Save logs uses: actions/upload-artifact@v3 with: @@ -104,7 +106,12 @@ jobs: # Upload distribution to pypi.org - name: Upload distribution - run: python -m twine upload dist/* + run: | + python -m twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN_GLOBAL }} + TWINE_REPOSITORY: testpypi # Tag release - name: Push version tag @@ -113,3 +120,4 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} custom_tag: ${{ env.pycyphal_version }} tag_prefix: '' + dry_run: true diff --git a/pycyphal/_version.py b/pycyphal/_version.py index ed6661ee..8b0c9156 100644 --- a/pycyphal/_version.py +++ b/pycyphal/_version.py @@ -1 +1 @@ -__version__ = "1.15.2" +__version__ = "1.15.1" From ffbca004af9b39c984e095061516391da165fcf0 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Sun, 11 Jun 2023 00:37:57 +0300 Subject: [PATCH 07/18] Added twine upload credentials --- .github/workflows/make-release.yml | 7 ++----- pycyphal/_version.py | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index 89a501e3..593422c1 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -6,7 +6,6 @@ on: push: branches: - master - - issue-259 # Ensures that only one workflow is running at a time concurrency: @@ -65,7 +64,6 @@ jobs: # Run build and test suite - name: Run build and test - if: false run: | nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} nox --non-interactive --session demo check_style docs @@ -110,8 +108,7 @@ jobs: python -m twine upload dist/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN_GLOBAL }} - TWINE_REPOSITORY: testpypi + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_GLOBAL }} # Tag release - name: Push version tag @@ -120,4 +117,4 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} custom_tag: ${{ env.pycyphal_version }} tag_prefix: '' - dry_run: true + dry_run: false diff --git a/pycyphal/_version.py b/pycyphal/_version.py index 8b0c9156..ed6661ee 100644 --- a/pycyphal/_version.py +++ b/pycyphal/_version.py @@ -1 +1 @@ -__version__ = "1.15.1" +__version__ = "1.15.2" From 086e9d80a7a879e859d92a2398b7c13b99acd3a8 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Mon, 12 Jun 2023 03:02:18 +0300 Subject: [PATCH 08/18] Added pull request event to workflow --- .github/workflows/make-release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index 593422c1..f15f2814 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -1,11 +1,13 @@ name: 'PyCyphal application builder' # Builds OpenCyphal PyCyphal release - on: push: branches: - master + pull_request: + branches: + - master # Ensures that only one workflow is running at a time concurrency: @@ -18,7 +20,6 @@ jobs: # pycyphal-test: name: Test PyCyphal - if: startsWith(github.ref, 'refs/heads/') strategy: fail-fast: false matrix: @@ -81,7 +82,7 @@ jobs: # pycyphal-release: name: Release PyCyphal - if: startsWith(github.ref, 'refs/heads/') + if: github.event_name == 'push' needs: pycyphal-test runs-on: ubuntu-latest steps: @@ -108,7 +109,7 @@ jobs: python -m twine upload dist/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_GLOBAL }} + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_PYCYPHAL }} # Tag release - name: Push version tag @@ -117,4 +118,3 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} custom_tag: ${{ env.pycyphal_version }} tag_prefix: '' - dry_run: false From 4e7d224b48b128921f84441d6fc28eb31adc6a89 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Mon, 12 Jun 2023 03:59:12 +0300 Subject: [PATCH 09/18] Removed appveyor file --- .appveyor.yml | 114 ----------------------------- .github/workflows/make-release.yml | 4 +- 2 files changed, 2 insertions(+), 116 deletions(-) delete mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 37b99367..00000000 --- a/.appveyor.yml +++ /dev/null @@ -1,114 +0,0 @@ -environment: - matrix: - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PYTHON: 'C:\Python310-x64' # YAML treats '\\' and "\\" differently. - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.10' - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.9' - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.8' - - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.7' - - - job_name: deploy - job_depends_on: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - PYTHON: '3.10' - - GIT_TOKEN: - secure: +jQhxLpePj6hdDryfET/XpLo7VL9fhDXVHlwLOPp/nRDYe97TJAfd0XCTuPz1qkT - TWINE_USERNAME: __token__ - TWINE_PASSWORD: - secure: +ZVhECKV0ESBrvUGXVd9wnMU9JR2gXSrDCIE1G7ZrW1DuWWzPDmIVMh4LtZafGQEddc0yR7X5q947f+nmPNLg/XSMwd4CKM8xRN+47RgaIpUMD5QIJzIxgk678w+hb4ZmS9J8aAodu0kMn7cz53iFeliGCYwGY37D/JRTs9i6P8Q+xf06KFHiNcLLqoqMLlLcWrLx7hBPlFwVpv2NiEtSmNSM/Z6iizcbYh08wcUK0w= - SONARCLOUD_TOKEN: - secure: WhIOqdzyx8VkpAsNjwy4O+OiAQ4FzUu8d1sFcQ7xz8DlFABiNajhPv0lhc1Dpz7G - COVERALLS_REPO_TOKEN: - secure: m5OF/cgvFDa+BwWDJVJ/xcMoqkQoyNIhWU1+Ckc8Vr0r6L/V3S8FUTO7fFgMeLQC - -stack: python %PYTHON% -build: off -skip_tags: true - -for: - - # WINDOWS TEST - matrix: - only: - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - install: - - 'systeminfo' - # Configure Npcap. This is for testing the packet capture functionality in the Cyphal/UDP transport. - - '.test_deps\npcap-0.96.exe /loopback_support=yes /winpcap_mode=yes /S' - # Installation of the NDIS filter driver from Npcap may have disrupted network connectivity, as explained in - # https://github.com/nmap/npcap/issues/215. Also, a restart appears to be necessary to enable the NPF service. - # Therefore, we restart the VM as suggested in https://github.com/appveyor/ci/issues/3491. - - 'shutdown /r /f /t 5' - - 'timeout 30' # Boot-up delay. This should be sufficient for the VM to get ready. Increase if not. - - 'route print & ipconfig /all' - # Due to the reboot, all volatile configuration like environment variables is lost here. We need to set it up now. - - 'set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%' - - 'echo %PATH%' - - 'git submodule update --init --recursive' - - 'python -m pip install --upgrade pip setuptools nox' - test_script: - # FIXME on Windows we only test against the OLDEST and the NEWEST version of Python because we run out of time. - # FIXME restructure the workflow or migrate to GitHub Actions. - - 'nox --forcecolor --non-interactive --error-on-missing-interpreters --pythons 3.7 3.10 --session test pristine' - - - # GNU/LINUX TEST - matrix: - only: - - job_group: tests - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - install: - - 'export extras_pkg="linux-*-extra-$(uname -r)"' - # Graphviz is needed for the docs, ncat is needed for testing the Cyphal/serial transport. - - 'sudo apt-get install -y $extras_pkg graphviz ncat' - - 'git submodule update --init --recursive' - - 'python -m pip install --upgrade pip setuptools nox' - # Sonar scanner unconditionally fails on PR builds with a NullPointerException, so don't run it there. - - '[[ -z "$APPVEYOR_PULL_REQUEST_HEAD_COMMIT" ]] || unset SONARCLOUD_TOKEN' - test_script: - - 'nox --non-interactive --error-on-missing-interpreters --session test pristine --python $PYTHON' - - 'nox --non-interactive --session demo check_style docs' - on_finish: - - 'ip link show' # Diagnostics aid - - - # DEPLOYMENT - matrix: - only: - - job_name: deploy - branches: - only: - - master - install: - - git submodule update --init --recursive - - python -m pip install --upgrade pip setuptools wheel twine - deploy_script: - # Ensure we deploy only from master, not from PR builds. - - '[[ "$APPVEYOR_REPO_BRANCH" == "master" ]] && [[ -z "$APPVEYOR_PULL_REQUEST_HEAD_COMMIT" ]] || exit' - # Configure git credentials. - - echo "https://${GIT_TOKEN}:x-oauth-basic@github.com" > ~/.git-credentials - - git config --global credential.helper store - - git config --global user.email "hedgehoginthefog@opencyphal.org" - - git config --global user.name "Release Automation" - # Tag and publish this release. Push the tag after the release is out in case it could not be published. - - | - git tag "$(PYTHONPATH=pycyphal python -c 'from _version import __version__; print(__version__)')" - python setup.py sdist bdist_wheel - python -m twine upload dist/* - git push --tags - -artifacts: - - path: '.nox/*/*/*.log' diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index f15f2814..d7c97a74 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -27,7 +27,7 @@ jobs: python: ['3.7', '3.8', '3.9', '3.10'] runs-on: ${{ matrix.os }} steps: - # Checkout code from GitHub + # Checkout pycyphal repository - name: Check out uses: actions/checkout@v3 @@ -82,7 +82,7 @@ jobs: # pycyphal-release: name: Release PyCyphal - if: github.event_name == 'push' + if: (github.event_name == 'push') && (github.ref == 'refs/heads/master') needs: pycyphal-test runs-on: ubuntu-latest steps: From 059e2f01c22e520c2b144d977f9734407a753704 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Tue, 8 Aug 2023 14:35:25 +0000 Subject: [PATCH 10/18] Changed os to ubuntu-latest --- .github/workflows/make-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index d7c97a74..57c20df6 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - issue-259 pull_request: branches: - master @@ -23,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2019-npcap] + os: [ubuntu-latest, windows-2019-npcap] python: ['3.7', '3.8', '3.9', '3.10'] runs-on: ${{ matrix.os }} steps: From 1f67440c000848ec2f8d10a31a789a94e822ad79 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Wed, 9 Aug 2023 01:47:11 +0000 Subject: [PATCH 11/18] Separated test and make workflows --- .github/workflows/make-release.yml | 89 +++--------------------------- .github/workflows/test-release.yml | 66 ++++++++++++++++++++++ 2 files changed, 74 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/test-release.yml diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index 57c20df6..e1d80484 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -1,14 +1,12 @@ -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: @@ -16,95 +14,25 @@ concurrency: 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/* @@ -112,7 +40,6 @@ jobs: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_PYCYPHAL }} - # Tag release - name: Push version tag uses: mathieudutour/github-tag-action@v6.1 with: diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml new file mode 100644 index 00000000..e22b6ae5 --- /dev/null +++ b/.github/workflows/test-release.yml @@ -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 + From 7bdd1c906db16d4b577b4b2c62582fe289cf2f0b Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Wed, 9 Aug 2023 08:16:19 +0000 Subject: [PATCH 12/18] Added make-release workflow conditions --- .github/workflows/make-release.yml | 37 +++++++++++++++++------------- .github/workflows/test-release.yml | 15 ++++-------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index e1d80484..16599103 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -1,12 +1,8 @@ -name: 'Build PyCyphal' +name: 'Release PyCyphal Workflow' on: push: - tags: [ '#release' ] - workflow_run: - workflows: [ 'Test PyCyphal' ] - branches: [ master ] - types: [ completed ] - + branch: [ master, issue-259 ] + tag: [ '#release' ] # Ensures that only one workflow is running at a time concurrency: @@ -17,12 +13,20 @@ jobs: pycyphal-release: name: Release PyCyphal runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Check out uses: actions/checkout@v3 - - name: Install dependencies + - name: Wait for test job to complete + uses: lewagon/wait-on-check-action@v1.3.1 + with: + ref: ${{ github.sha }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + running-workflow-name: 'Release PyCyphal' + allowed-conclusions: success,skipped,cancelled + + - name: Create distribution wheel run: | git submodule update --init --recursive python -m pip install --upgrade pip setuptools wheel twine @@ -35,14 +39,15 @@ jobs: - name: Upload distribution run: | - python -m twine upload dist/* + echo '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: '' +# - name: Push version tag +# uses: mathieudutour/github-tag-action@v6.1 +# with: +# github_token: ${{ secrets.GITHUB_TOKEN }} +# custom_tag: ${{ env.pycyphal_version }} +# tag_prefix: '' + diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml index e22b6ae5..e574d5c5 100644 --- a/.github/workflows/test-release.yml +++ b/.github/workflows/test-release.yml @@ -1,14 +1,9 @@ -name: 'Test PyCyphal' +name: 'Test PyCyphal Workflow' +on: [ push, pull_request ] -# Test OpenCyphal PyCyphal release -on: push -# pull_request: -# branches: -# - master - -# Ensures that only one workflow is running at a time +# Ensures that only one workflow is running at a time - required for duplicate pushes and repushing a PR concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }} cancel-in-progress: true jobs: @@ -54,7 +49,7 @@ jobs: - name: Run build and test run: | - nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} + #nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} nox --non-interactive --session demo check_style docs - name: Save logs From 039212681d427ed0c0a6cbc92f23d4980f689d21 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Wed, 9 Aug 2023 23:50:07 +0000 Subject: [PATCH 13/18] Test run deployment --- .github/workflows/make-release.yml | 18 +++++++++--------- .github/workflows/test-release.yml | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index 16599103..db2e1d97 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -1,8 +1,8 @@ name: 'Release PyCyphal Workflow' on: push: - branch: [ master, issue-259 ] - tag: [ '#release' ] + branches: [ master ] + tags: [ '#release' ] # Ensures that only one workflow is running at a time concurrency: @@ -39,15 +39,15 @@ jobs: - name: Upload distribution run: | - echo 'python -m twine upload dist/*' + 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: '' + - name: Push version tag + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + custom_tag: ${{ env.pycyphal_version }} + tag_prefix: '' diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml index e574d5c5..a777704b 100644 --- a/.github/workflows/test-release.yml +++ b/.github/workflows/test-release.yml @@ -49,7 +49,7 @@ jobs: - name: Run build and test run: | - #nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} + nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }} nox --non-interactive --session demo check_style docs - name: Save logs From 41a588daaada534da902937b4bb33653f2d29ad4 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Thu, 10 Aug 2023 04:03:16 +0000 Subject: [PATCH 14/18] Recombined workflows and added release filter --- .github/workflows/make-release.yml | 53 ------------------- ...{test-release.yml => test-and-release.yml} | 36 ++++++++++++- 2 files changed, 35 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/make-release.yml rename .github/workflows/{test-release.yml => test-and-release.yml} (60%) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml deleted file mode 100644 index db2e1d97..00000000 --- a/.github/workflows/make-release.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: 'Release PyCyphal Workflow' -on: - push: - branches: [ master ] - tags: [ '#release' ] - -# Ensures that only one workflow is running at a time -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - pycyphal-release: - name: Release PyCyphal - runs-on: ubuntu-latest - steps: - - name: Check out - uses: actions/checkout@v3 - - - name: Wait for test job to complete - uses: lewagon/wait-on-check-action@v1.3.1 - with: - ref: ${{ github.sha }} - repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 10 - running-workflow-name: 'Release PyCyphal' - allowed-conclusions: success,skipped,cancelled - - - 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: '' - diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-and-release.yml similarity index 60% rename from .github/workflows/test-release.yml rename to .github/workflows/test-and-release.yml index a777704b..8a9f584e 100644 --- a/.github/workflows/test-release.yml +++ b/.github/workflows/test-and-release.yml @@ -1,4 +1,4 @@ -name: 'Test PyCyphal Workflow' +name: 'Test and Release PyCyphal' on: [ push, pull_request ] # Ensures that only one workflow is running at a time - required for duplicate pushes and repushing a PR @@ -59,3 +59,37 @@ jobs: 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: '' + From 0f3ae51e37646bae94360dbdc9f0ad18a19c3c14 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Sun, 13 Aug 2023 21:21:35 +0000 Subject: [PATCH 15/18] Removed pull_request trigger and changed concurrency rule --- .github/workflows/test-and-release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 8a9f584e..22b69005 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -1,9 +1,9 @@ name: 'Test and Release PyCyphal' -on: [ push, pull_request ] +on: push -# Ensures that only one workflow is running at a time - required for duplicate pushes and repushing a PR +# Ensures that only one workflow is running at a time concurrency: - group: ${{ github.workflow }} + group: ${{ github.workflow_sha }} cancel-in-progress: true jobs: @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-2019-npcap] + os: [ubuntu-20.04, windows-2019-npcap] python: ['3.7', '3.8', '3.9', '3.10'] runs-on: ${{ matrix.os }} steps: @@ -30,6 +30,7 @@ jobs: - 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 From 7b36beb2a668bfe54c8fb935a097dc3f6286cd6c Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Thu, 17 Aug 2023 23:59:55 +0000 Subject: [PATCH 16/18] Added SONAR and COVERALLS tokens to environment for nox job --- .github/workflows/test-and-release.yml | 7 +++++-- noxfile.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 22b69005..bd4695de 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -12,8 +12,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2019-npcap] - python: ['3.7', '3.8', '3.9', '3.10'] + os: [ ubuntu-20.04, windows-2019-npcap ] + python: [ '3.7', '3.8', '3.9', '3.10' ] runs-on: ${{ matrix.os }} steps: - name: Check out @@ -52,6 +52,9 @@ jobs: 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 }} - name: Save logs uses: actions/upload-artifact@v3 diff --git a/noxfile.py b/noxfile.py index 6c8dd888..883a97bc 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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")) From 11b64853bebe0c1ad2a77856d5f62719a3f076ae Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Mon, 21 Aug 2023 12:56:21 +0300 Subject: [PATCH 17/18] Update _version.py --- pycyphal/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pycyphal/_version.py b/pycyphal/_version.py index ed6661ee..be5724a8 100644 --- a/pycyphal/_version.py +++ b/pycyphal/_version.py @@ -1 +1 @@ -__version__ = "1.15.2" +__version__ = "1.15.3" From c56d1488d476ee5909a4b159f1affcef5caf5c27 Mon Sep 17 00:00:00 2001 From: Clyde Johnston Date: Mon, 21 Aug 2023 10:48:50 +0000 Subject: [PATCH 18/18] Recognise nox exit codes for Windows jobs --- .github/workflows/test-and-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index bd4695de..2b30e38e 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -55,6 +55,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + shell: bash - name: Save logs uses: actions/upload-artifact@v3