From 713bbc53d2b2bcacb63ef1eb928ae2625ec3821f Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 5 Aug 2021 14:11:14 -0700 Subject: [PATCH 1/6] Remove test suite for "siteversion" script This script is now developed and maintained in a dedicated repository for such reusable project assets. This means that there is no need for its test code to be checked in to this repository. I did this by accident after having failed to follow the installation instructions carefully and am now correcting my mistake. --- docs/siteversion/tests/__init__.py | 12 ----------- docs/siteversion/tests/pytest.ini | 10 --------- docs/siteversion/tests/test_all.py | 33 ------------------------------ 3 files changed, 55 deletions(-) delete mode 100644 docs/siteversion/tests/__init__.py delete mode 100644 docs/siteversion/tests/pytest.ini delete mode 100644 docs/siteversion/tests/test_all.py diff --git a/docs/siteversion/tests/__init__.py b/docs/siteversion/tests/__init__.py deleted file mode 100644 index b353c4a01..000000000 --- a/docs/siteversion/tests/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-python/__init__.py -# Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -# -# This software is released under the GNU General Public License version 3, -# The terms of this license can be found at: -# https: // www.gnu.org/licenses/gpl-3.0.en.html -# -# You can be released from the requirements of the above licenses by purchasing -# a commercial license. Buying such a license is mandatory if you want to -# modify or otherwise use the software for commercial activities involving the -# Arduino software without disclosing the source code of your own applications. -# To purchase a commercial license, send an email to license@arduino.cc. diff --git a/docs/siteversion/tests/pytest.ini b/docs/siteversion/tests/pytest.ini deleted file mode 100644 index b8beed3fa..000000000 --- a/docs/siteversion/tests/pytest.ini +++ /dev/null @@ -1,10 +0,0 @@ -# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-python/pytest.ini -[pytest] -filterwarnings = - error - ignore::DeprecationWarning - ignore::ResourceWarning - -# --capture=no - disable per-test capture -# --tb=long sets the length of the traceback in case of failures -addopts = --capture=no --tb=long --verbose diff --git a/docs/siteversion/tests/test_all.py b/docs/siteversion/tests/test_all.py deleted file mode 100644 index eb66ea7e2..000000000 --- a/docs/siteversion/tests/test_all.py +++ /dev/null @@ -1,33 +0,0 @@ -# Source: -# https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-mkdocs-versioned/siteversion/test/test_all.py - -# Copyright 2020 ARDUINO SA (http://www.arduino.cc/) - -# This software is released under the GNU General Public License version 3 -# The terms of this license can be found at: -# https://www.gnu.org/licenses/gpl-3.0.en.html - -# You can be released from the requirements of the above licenses by purchasing -# a commercial license. Buying such a license is mandatory if you want to -# modify or otherwise use the software for commercial activities involving the -# Arduino software without disclosing the source code of your own applications. -# To purchase a commercial license, send an email to license@arduino.cc. -import siteversion - - -def test_get_docs_version(): - data = siteversion.get_docs_version("main", []) - assert data["version"] == "dev" - assert data["alias"] == "" - - release_names = ["1.4.x", "0.13.x"] - data = siteversion.get_docs_version("0.13.x", release_names) - assert data["version"] == "0.13" - assert data["alias"] == "" - data = siteversion.get_docs_version("1.4.x", release_names) - assert data["version"] == "1.4" - assert data["alias"] == "latest" - - data = siteversion.get_docs_version("0.1.x", []) - assert data["version"] is None - assert data["alias"] is None From 110e473d6fdc5d34ad1b9a5193301bf6ecf8b351 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 5 Aug 2021 14:14:52 -0700 Subject: [PATCH 2/6] Add manual events to testing workflow triggers The `workflow_dispatch` event allows triggering the workflow via the GitHub web interface. This makes it easy to trigger an immediate workflow run after some relevant external change. The `repository_dispatch` event allows triggering workflows via the GitHub API. This might be useful for triggering an immediate check in multiple relevant repositories after an external change, or some automated process. Although we don't have any specific need for this event at the moment, the event has no impact on the workflow, so there is no reason against having it. It is the sort of thing that can end up being useful if it is already in consistently in place, but not worth setting up on demand, since the effort to set it up is greater than the effort to trigger all the workflows manually. --- .github/workflows/test-go-integration-task.yml | 3 +++ .github/workflows/test-go-task.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/test-go-integration-task.yml b/.github/workflows/test-go-integration-task.yml index f7b98b3bd..b0c199a03 100644 --- a/.github/workflows/test-go-integration-task.yml +++ b/.github/workflows/test-go-integration-task.yml @@ -7,6 +7,7 @@ env: # See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python PYTHON_VERSION: "3.9" +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: push: paths: @@ -28,6 +29,8 @@ on: - "poetry.lock" - "pyproject.toml" - "tests/**" + workflow_dispatch: + repository_dispatch: jobs: test: diff --git a/.github/workflows/test-go-task.yml b/.github/workflows/test-go-task.yml index 6937c9bd4..0531f2eac 100644 --- a/.github/workflows/test-go-task.yml +++ b/.github/workflows/test-go-task.yml @@ -5,6 +5,7 @@ env: # See: https://github.com/actions/setup-go/tree/v2#readme GO_VERSION: "1.16" +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: push: paths: @@ -22,6 +23,8 @@ on: - "go.sum" - "**/*.go" - "**/testdata/**" + workflow_dispatch: + repository_dispatch: jobs: test: From 0caab50d80668a469b15af1ee336ea4e39cc5956 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 5 Aug 2021 14:30:42 -0700 Subject: [PATCH 3/6] Use correct identifier for macOS runner in test workflows The official GitHub Actions documentation specifies the hosted macOS runner names use the `macos` prefix. Although the non-compliant case previously in use clearly does work, there is no guarantee it will continue to do so, so it's safest to follow the documentation exactly. --- .github/workflows/test-go-integration-task.yml | 2 +- .github/workflows/test-go-task.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-go-integration-task.yml b/.github/workflows/test-go-integration-task.yml index b0c199a03..bce0e36b0 100644 --- a/.github/workflows/test-go-integration-task.yml +++ b/.github/workflows/test-go-integration-task.yml @@ -39,7 +39,7 @@ jobs: operating-system: - ubuntu-latest - windows-latest - - macOS-latest + - macos-latest runs-on: ${{ matrix.operating-system }} diff --git a/.github/workflows/test-go-task.yml b/.github/workflows/test-go-task.yml index 0531f2eac..1ccab312c 100644 --- a/.github/workflows/test-go-task.yml +++ b/.github/workflows/test-go-task.yml @@ -33,7 +33,7 @@ jobs: operating-system: - ubuntu-latest - windows-latest - - macOS-latest + - macos-latest runs-on: ${{ matrix.operating-system }} From a2570ca815d3a9ec7bfed657a88c94dce2390cea Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 5 Aug 2021 14:33:39 -0700 Subject: [PATCH 4/6] Use standard workflow step order from template No functional change, and neither is necessarily superior, but this is how it is in the "template", and so it must be here as well. --- .github/workflows/test-go-integration-task.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-go-integration-task.yml b/.github/workflows/test-go-integration-task.yml index bce0e36b0..91e042882 100644 --- a/.github/workflows/test-go-integration-task.yml +++ b/.github/workflows/test-go-integration-task.yml @@ -52,12 +52,6 @@ jobs: with: go-version: ${{ env.GO_VERSION }} - - name: Install Task - uses: arduino/setup-task@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - version: 3.x - - name: Install Python uses: actions/setup-python@v2 with: @@ -66,5 +60,11 @@ jobs: - name: Install Poetry run: pip install poetry + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + - name: Run integration tests run: task go:test-integration From 21c8fe846d1ac96ca84117ae16bc09d806aafd80 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 5 Aug 2021 14:37:18 -0700 Subject: [PATCH 5/6] Use standard paths filter syntax for global recursive extension match Although the other works as well, this is the style specified in the official GitHub Actions reference and used in the "template" workflow. --- .github/workflows/check-code-generation-task.yml | 4 ++-- .github/workflows/test-go-task.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-code-generation-task.yml b/.github/workflows/check-code-generation-task.yml index 97584ee27..ad8b16864 100644 --- a/.github/workflows/check-code-generation-task.yml +++ b/.github/workflows/check-code-generation-task.yml @@ -11,7 +11,7 @@ on: - "Taskfile.yml" - "go.mod" - "go.sum" - - "**/*.go" + - "**.go" - "etc/schemas/**/*.json" pull_request: paths: @@ -19,7 +19,7 @@ on: - "Taskfile.yml" - "go.mod" - "go.sum" - - "**/*.go" + - "**.go" - "etc/schemas/**/*.json" jobs: diff --git a/.github/workflows/test-go-task.yml b/.github/workflows/test-go-task.yml index 1ccab312c..183970751 100644 --- a/.github/workflows/test-go-task.yml +++ b/.github/workflows/test-go-task.yml @@ -13,7 +13,7 @@ on: - "Taskfile.yml" - "go.mod" - "go.sum" - - "**/*.go" + - "**.go" - "**/testdata/**" pull_request: paths: @@ -21,7 +21,7 @@ on: - "Taskfile.yml" - "go.mod" - "go.sum" - - "**/*.go" + - "**.go" - "**/testdata/**" workflow_dispatch: repository_dispatch: From 9c34e7a5f1ca71b19f3617cd41651631809ea6d0 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 5 Aug 2021 14:40:06 -0700 Subject: [PATCH 6/6] Make workflow path filters handle either YAML file extension There are two file extensions in common use for YAML files: `.yaml` and `.yml`. Although this project uses `.yml` exclusively for YAML files, standardized "template" workflows which might be applied to projects that have established the use of the other extension. It will be most flexible if it supports both. --- .github/workflows/check-code-generation-task.yml | 4 ++-- .github/workflows/test-go-task.yml | 4 ++-- .github/workflows/test-install.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-code-generation-task.yml b/.github/workflows/check-code-generation-task.yml index ad8b16864..f3b95d72a 100644 --- a/.github/workflows/check-code-generation-task.yml +++ b/.github/workflows/check-code-generation-task.yml @@ -8,7 +8,7 @@ on: push: paths: - ".github/workflows/check-code-generation-task.ya?ml" - - "Taskfile.yml" + - "Taskfile.ya?ml" - "go.mod" - "go.sum" - "**.go" @@ -16,7 +16,7 @@ on: pull_request: paths: - ".github/workflows/check-code-generation-task.ya?ml" - - "Taskfile.yml" + - "Taskfile.ya?ml" - "go.mod" - "go.sum" - "**.go" diff --git a/.github/workflows/test-go-task.yml b/.github/workflows/test-go-task.yml index 183970751..dee99669f 100644 --- a/.github/workflows/test-go-task.yml +++ b/.github/workflows/test-go-task.yml @@ -10,17 +10,17 @@ on: push: paths: - ".github/workflows/test-go-task.ya?ml" - - "Taskfile.yml" - "go.mod" - "go.sum" + - "Taskfile.ya?ml" - "**.go" - "**/testdata/**" pull_request: paths: - ".github/workflows/test-go-task.ya?ml" - - "Taskfile.yml" - "go.mod" - "go.sum" + - "Taskfile.ya?ml" - "**.go" - "**/testdata/**" workflow_dispatch: diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index 640bb9fee..25f89d32a 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -3,11 +3,11 @@ name: Test install script on: push: paths: - - ".github/workflows/test-install.yml" + - ".github/workflows/test-install.ya?ml" - "etc/install.sh" pull_request: paths: - - ".github/workflows/test-install.yml" + - ".github/workflows/test-install.ya?ml" - "etc/install.sh" schedule: # Run every day at 03:00 UTC to catch breakage caused by external events