From fe4ee1f743c0cef8b03392b57be5422be8dbe115 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Fri, 15 Mar 2024 14:20:21 +0900 Subject: [PATCH 01/33] docs(changelog): Fix typo in 2.0.0 description --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c20d78d..3465954 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec ### Changed - **Breaking change**: Use `gautamkrishnar/keepalive-workflow@v2` to avoid dummy commit. This change requires - modifying permission from `content: write` to `actions: write` in the main workflow. + modifying permission from `contents: write` to `actions: write` in the main workflow. --- From 2c0f0b27d97636e443b8e1a8677c885f77497dff Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Fri, 15 Mar 2024 14:34:23 +0900 Subject: [PATCH 02/33] docs(readme): Update keepalive_time_elapsed description --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a27a9da..9ccd3ce 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ Default: `true`. - `keepalive_time_elapsed` (_String_) -Time elapsed from the previous commit to trigger a new automated commit (in days). +Time elapsed from the previous commit to keep the repository active using GitHub API (in days). Will be used as the `time_elapsed` key of the [keepalive-workflow action](https://github.com/gautamkrishnar/keepalive-workflow). From ff3a9d1b649ef8e99802d90cc80f4694867cbbd0 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Thu, 9 May 2024 14:05:15 +0900 Subject: [PATCH 03/33] ci(keepalive): Fix wrong permission --- .github/workflows/keepalive.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml index 87ea4a9..3fef166 100644 --- a/.github/workflows/keepalive.yml +++ b/.github/workflows/keepalive.yml @@ -4,7 +4,7 @@ on: - cron: "0 3 * * 4" permissions: - contents: write + actions: write jobs: keep-alive: From ebc98d8a5f0aaa9e82586dee0334967a7297298a Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 15 May 2024 16:59:43 +0900 Subject: [PATCH 04/33] ci(keep alive): Specify workflows to keep alive [skip ci] --- .github/workflows/keepalive.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml index 3fef166..b5891d9 100644 --- a/.github/workflows/keepalive.yml +++ b/.github/workflows/keepalive.yml @@ -18,4 +18,5 @@ jobs: # keepalive-workflow keeps GitHub from turning off tests after 60 days - uses: gautamkrishnar/keepalive-workflow@v2 with: - time_elapsed: 50 + time_elapsed: 30 + workflow_files: "add-ons-test.yml,add-on-disable-checkout-test.yml" From ca4409b8f2e30efcb2376c2b3859613d6411c69a Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Tue, 21 May 2024 19:20:02 -0600 Subject: [PATCH 05/33] fix(keep alive): Shorten the time before API call (#31) * fix: Shorten the time before API call The current 55 day timeout before we hit the API seems to be a little long, as GitHub warns before 55 days. We can shorten it, here to 45. But I'm not sure why we don't just use `1` here instead, not sure it would do any harm to hit the API daily. * default: "0" --- action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index 4473e66..6a167f3 100644 --- a/action.yaml +++ b/action.yaml @@ -33,9 +33,9 @@ inputs: default: true keepalive_time_elapsed: - description: 'Time elapsed from the previous commit to trigger a new automated commit (in days)' + description: 'Time elapsed from the most recent commit to hit API and prevent expiration (in days)' required: false - default: 55 + default: "0" debug_enabled: type: boolean From 6fe79b053c82f7e0150323bb4a689ebe3588028c Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 22 May 2024 10:33:09 +0900 Subject: [PATCH 06/33] chore(*): Prepare release 2.0.1 --- CHANGELOG.md | 10 ++++++++++ README.md | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3465954..6da82b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec --- +## [v2.0.1](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.0.1) - 2024-05-22 + +[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.0.0...v2.0.1) + +### Fixed + +- Shorten the default `keepalive_time_elapsed` value to `"0"` day ([PR #31](https://github.com/ddev/github-action-add-on-test/pull/31)) + +--- + ## [v2.0.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.0.0) - 2024-03-15 [_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v1.2.0...v2.0.0) diff --git a/README.md b/README.md index 9ccd3ce..15f64ab 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ Will be used as the `time_elapsed` key of the [keepalive-workflow action](https Not required. -Default: `55`. +Default: `"0"`. --- From a82e5bb50ad27c91ab3be60a9969e375cde0f488 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Sat, 25 May 2024 10:43:45 +0900 Subject: [PATCH 07/33] fix(keepalive): Run keepalive step only for scheduled run (#33) --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 6a167f3..33b6e99 100644 --- a/action.yaml +++ b/action.yaml @@ -108,7 +108,7 @@ runs: # keepalive-workflow keeps GitHub from turning off tests after 60 days - uses: gautamkrishnar/keepalive-workflow@v2 - if: always() && matrix.ddev_version == 'stable' && inputs.keepalive == 'true' + if: always() && matrix.ddev_version == 'stable' && inputs.keepalive == 'true' && github.event_name == 'schedule' with: time_elapsed: ${{ inputs.keepalive_time_elapsed }} From abdb628ee06c0bf1e348dec304ebdaae31b333b7 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Sat, 25 May 2024 10:45:58 +0900 Subject: [PATCH 08/33] chore(*): Prepare release 2.0.2 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6da82b7..c3325ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec --- +## [v2.0.2](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.0.2) - 2024-05-25 + +[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.0.1...v2.0.2) + +### Fixed + +- Run keepalive step only for scheduled run ([PR #33](https://github.com/ddev/github-action-add-on-test/pull/33)) + +--- + ## [v2.0.1](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.0.1) - 2024-05-22 [_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.0.0...v2.0.1) From cfd43cb02330333e343a414f8f757603945cefee Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 2 Oct 2024 08:43:58 +0900 Subject: [PATCH 09/33] feat(*): Add test_command input and exclude release tagged tests for pull request (#34) * feat(test command): Add input for test command and filter by default for pull request * docs(README): Add test_command input description * feat(test): Disable history expansion at the top of the step --- README.md | 58 +++++++++++++++++++++++++++++------------------------ action.yaml | 43 +++++++++++++++++++++++++++------------ 2 files changed, 62 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 15f64ab..1420a67 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ # DDEV add-on test action --- + > A GitHub action to run tests on a DDEV add-on. + --- [![Version](https://img.shields.io/github/v/release/ddev/github-action-add-on-test)](https://github.com/ddev/github-action-add-on-test/releases) ![project is maintained](https://img.shields.io/maintenance/yes/2024.svg) [![tests](https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml/badge.svg)](https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml) - + **Table of Contents** - [Quick start](#quick-start) @@ -44,12 +46,12 @@ This step will install the latest stable version of DDEV and run `bats tests` co ## Inputs - ### Available keys The following keys are available as `step.with` keys: --- + - `ddev_version` (_String_) DDEV version that will be installed before your tests. @@ -74,14 +76,13 @@ Example: `${{ secrets.GITHUB_TOKEN }}`. - `addon_repository`(_String_) -GitHub repository of the tested addon (`{owner}/{repo}`). Will be used as the `repository` key during a [checkout +GitHub repository of the tested addon (`{owner}/{repo}`). Will be used as the `repository` key during a [checkout action](https://github.com/actions/checkout#usage) Required. Example: `${{ env.GITHUB_REPOSITORY }}`. - --- - `addon_ref`(_String_) @@ -96,7 +97,7 @@ Example: `${{ env.GITHUB_REF }}`. - `addon_path`(_String_) -Path (relative to `$GITHUB_WORKSPACE` ) where the addon will be cloned by a checkout action. Will be used as the `path` +Path (relative to `$GITHUB_WORKSPACE` ) where the addon will be cloned by a checkout action. Will be used as the `path` key of the [checkout action](https://github.com/actions/checkout#usage) Not required. @@ -107,7 +108,7 @@ Default: `./` - `keepalive` (_Boolean_) -Keeps GitHub from turning off tests after 60 days. +Keeps GitHub from turning off tests after 60 days. If enabled, action will use [keepalive-workflow action](https://github.com/gautamkrishnar/keepalive-workflow) when `ddev_version` has been set to `stable`. @@ -124,12 +125,11 @@ Default: `true`. --- - - `keepalive_time_elapsed` (_String_) Time elapsed from the previous commit to keep the repository active using GitHub API (in days). -Will be used as the `time_elapsed` key of the [keepalive-workflow action](https://github.com/gautamkrishnar/keepalive-workflow). +Will be used as the `time_elapsed` key of the [keepalive-workflow action](https://github.com/gautamkrishnar/keepalive-workflow). Not required. @@ -137,7 +137,6 @@ Default: `"0"`. --- - - `debug_enabled` (_Boolean_) If `true`, a tmate session will be accessible before the tests step. See [action-tmate](https://github.com/mxschmitt/action-tmate) for more details. @@ -158,27 +157,38 @@ Default: `false`. --- +- `test_command` (_String_) + +If you want to run a customized test command, you can use this input. + +If it's empty, the test command will be `bats tests --filter-tags !release` during a pull request workflow and `bats tests` otherwise. + +Not required. + +Default: `""`. + +--- + ## Usage ### Test your DDEV add-on -If your add-on is based on the [DDEV add-on template repository](https://github.com/ddev/ddev-addon-template), you +If your add-on is based on the [DDEV add-on template repository](https://github.com/ddev/ddev-addon-template), you should have a tests folder containing a `test.bats` file. -Using this GitHub action, a `.github/workflows/tests.yml` file could have the following content: - +Using this GitHub action, a `.github/workflows/tests.yml` file could have the following content: ```yaml name: tests on: pull_request: push: - branches: [ main ] + branches: [main] paths-ignore: - - '**.md' + - "**.md" schedule: - - cron: '25 08 * * *' + - cron: "25 08 * * *" workflow_dispatch: inputs: @@ -192,7 +202,6 @@ permissions: jobs: tests: - strategy: matrix: ddev_version: [stable, HEAD] @@ -201,17 +210,15 @@ jobs: runs-on: ubuntu-latest steps: - - - uses: ddev/github-action-add-on-test@v2 - with: - ddev_version: ${{ matrix.ddev_version }} - token: ${{ secrets.GITHUB_TOKEN }} - debug_enabled: ${{ github.event.inputs.debug_enabled }} - addon_repository: ${{ env.GITHUB_REPOSITORY }} - addon_ref: ${{ env.GITHUB_REF }} + - uses: ddev/github-action-add-on-test@v2 + with: + ddev_version: ${{ matrix.ddev_version }} + token: ${{ secrets.GITHUB_TOKEN }} + debug_enabled: ${{ github.event.inputs.debug_enabled }} + addon_repository: ${{ env.GITHUB_REPOSITORY }} + addon_ref: ${{ env.GITHUB_REF }} ``` - ## License [Apache](LICENSE) @@ -220,5 +227,4 @@ jobs: Anyone is welcome to submit a pull request to this repository. - **Contributed and maintained by [julienloizelet](https://github.com/julienloizelet)** diff --git a/action.yaml b/action.yaml index 33b6e99..0aa08ff 100644 --- a/action.yaml +++ b/action.yaml @@ -3,7 +3,6 @@ author: "Julien Loizelet" description: "A Github Action to run DDEV add-on tests" inputs: - ddev_version: type: choice required: false @@ -14,49 +13,53 @@ inputs: - "HEAD" addon_repository: - description: 'Repository of the tested addon' + description: "Repository of the tested addon" required: true addon_ref: - description: 'Repository ref of the tested addon' + description: "Repository ref of the tested addon" required: true addon_path: - description: 'Path to clone the addon' + description: "Path to clone the addon" required: false - default: './' + default: "./" keepalive: type: boolean - description: 'Keeps GitHub from turning off tests after 60 days' + description: "Keeps GitHub from turning off tests after 60 days" required: false default: true keepalive_time_elapsed: - description: 'Time elapsed from the most recent commit to hit API and prevent expiration (in days)' + description: "Time elapsed from the most recent commit to hit API and prevent expiration (in days)" required: false default: "0" debug_enabled: type: boolean - description: Debug with tmate + description: "Debug with tmate" required: false default: false disable_checkout_action: type: boolean - description: Disable addon checkout action + description: "Disable addon checkout action" required: false default: false token: - description: 'A Github PAT' + description: "A Github PAT" required: true + test_command: + description: "Test command to run" + required: false + default: "" + runs: using: "composite" steps: - - uses: Homebrew/actions/setup-homebrew@master - name: Environment setup @@ -102,9 +105,23 @@ runs: DDEV_NONINTERACTIVE: "true" # Don't send telemetry to amplitude DDEV_NO_INSTRUMENTATION: "true" - + # Use test_command input if provided + TEST_COMMAND_INPUT: ${{ inputs.test_command }} + # Use the addon path + ADDON_PATH: ${{ inputs.addon_path }} shell: bash - run: cd ${{ inputs.addon_path }} && bats tests + # Use of "set +H" to ensure that bash history expansion is disabled so that ! can be used in test command + run: | + set +H + if [ -n "$TEST_COMMAND_INPUT" ]; then + TEST_COMMAND="$TEST_COMMAND_INPUT" + elif [ "${{ github.event_name }}" == "pull_request" ]; then + TEST_COMMAND="bats tests --filter-tags !release" + else + TEST_COMMAND="bats tests" + fi + echo "Running: $TEST_COMMAND in $ADDON_PATH" + cd $ADDON_PATH && $TEST_COMMAND # keepalive-workflow keeps GitHub from turning off tests after 60 days - uses: gautamkrishnar/keepalive-workflow@v2 From ae83aba803238d9efc35a11bb7831b47690bf86f Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 2 Oct 2024 09:04:19 +0900 Subject: [PATCH 10/33] chore(*): Prepare release v2.1.0 --- CHANGELOG.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3325ca..ee71d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,20 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec --- +## [v2.1.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.1.0) - 2024-10-02 + +[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.0.2...v2.1.0) + +### Changed + +- Exclude "release" tagged tests for pull request workflow ([PR #34](https://github.com/ddev/github-action-add-on-test/pull/34)) + +### Added + +- Add `test_command` input ([PR #34](https://github.com/ddev/github-action-add-on-test/pull/34)) + +--- + ## [v2.0.2](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.0.2) - 2024-05-25 [_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.0.1...v2.0.2) @@ -37,7 +51,7 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec ### Changed -- **Breaking change**: Use `gautamkrishnar/keepalive-workflow@v2` to avoid dummy commit. This change requires +- **Breaking change**: Use `gautamkrishnar/keepalive-workflow@v2` to avoid dummy commit. This change requires modifying permission from `contents: write` to `actions: write` in the main workflow. --- From 910323788fd6c996df09d0c835fec1a1fdd713cb Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 2 Oct 2024 09:37:33 +0900 Subject: [PATCH 11/33] ci(*): Clean ci [skip ci] --- .githooks/commit-msg | 22 ----------------- .../add-on-disable-checkout-test.yml | 2 -- .../workflows/{markdown.yml => doc-links.yml} | 24 +++++++++---------- .github/workflows/keepalive.yml | 2 +- .github/workflows/release.yml | 2 +- 5 files changed, 14 insertions(+), 38 deletions(-) delete mode 100644 .githooks/commit-msg rename .github/workflows/{markdown.yml => doc-links.yml} (66%) diff --git a/.githooks/commit-msg b/.githooks/commit-msg deleted file mode 100644 index b3cca0c..0000000 --- a/.githooks/commit-msg +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -if [ -z "$1" ]; then - echo "Missing argument (commit message). Did you try to run this manually?" - exit 1 -fi - -commitTitle="$(head -n 1 < "$1")" - -# ignore merge -if echo "$commitTitle" | grep -qE "^Merge"; then - echo "Commit hook: ignoring merge" - exit 0 -fi - -# check commit message -REGEX='^(feat|fix|docs|style|refactor|ci|test|chore|comment)\(.*\)\:.*' -if ! echo "$commitTitle" | grep -qE "${REGEX}"; then - echo "Your commit title '$commitTitle' did not follow conventional commit message rules:" - echo "Please comply with the regex ${REGEX}" - exit 1 -fi diff --git a/.github/workflows/add-on-disable-checkout-test.yml b/.github/workflows/add-on-disable-checkout-test.yml index 783739a..1ab8922 100644 --- a/.github/workflows/add-on-disable-checkout-test.yml +++ b/.github/workflows/add-on-disable-checkout-test.yml @@ -8,8 +8,6 @@ on: pull_request: paths-ignore: - "**.md" - schedule: - - cron: "25 08 * * THU" workflow_dispatch: permissions: diff --git a/.github/workflows/markdown.yml b/.github/workflows/doc-links.yml similarity index 66% rename from .github/workflows/markdown.yml rename to .github/workflows/doc-links.yml index 588e572..e09ab28 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/doc-links.yml @@ -1,13 +1,20 @@ +name: Documentation links + on: workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main -name: Markdown files test and update permissions: - contents: write - pull-requests: write + contents: read + jobs: - markdown-test-and-update: - name: Markdown files test and update + markdown-test-links: + name: Markdown test links runs-on: ubuntu-latest steps: - name: Clone sources @@ -30,10 +37,3 @@ jobs: gem install awesome_bot cd sources awesome_bot README.md --skip-save-results --allow-dupe --base-url http://localhost:8080/ --white-list ddev.site - - - uses: technote-space/toc-generator@v4 - with: - MAX_HEADER_LEVEL: 3 - TARGET_PATHS: "README.md" - CHECK_ONLY_DEFAULT_BRANCH: true - CREATE_PR: true diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml index b5891d9..a43294a 100644 --- a/.github/workflows/keepalive.yml +++ b/.github/workflows/keepalive.yml @@ -19,4 +19,4 @@ jobs: - uses: gautamkrishnar/keepalive-workflow@v2 with: time_elapsed: 30 - workflow_files: "add-ons-test.yml,add-on-disable-checkout-test.yml" + workflow_files: "add-ons-test.yml" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d66bed..13e010a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -118,7 +118,7 @@ jobs: echo "$VERSION_RELEASE_NOTES" >> CHANGELOG.txt - name: Create release ${{ env.VERSION_NUMBER }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: body_path: CHANGELOG.txt name: ${{ env.VERSION_NUMBER }} From 666fc63892f08e00907a41cac65df154ea25ddc5 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 2 Oct 2024 09:43:32 +0900 Subject: [PATCH 12/33] ci(tests): Remove ddev-sqlsrv add-on as it requires a diifferent runner (ubuntu-20.04) --- .github/workflows/add-ons-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/add-ons-test.yml b/.github/workflows/add-ons-test.yml index 95f09d2..72691e7 100644 --- a/.github/workflows/add-ons-test.yml +++ b/.github/workflows/add-ons-test.yml @@ -27,7 +27,6 @@ jobs: - ddev/ddev-adminer - ddev/ddev-redis - ddev/ddev-solr - - ddev/ddev-sqlsrv - ddev/ddev-pdfreactor - ddev/ddev-memcached - ddev/ddev-cron From 11f38518e8edfd1d996559f0a79d137789b5c5ae Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 2 Oct 2024 13:36:54 +0900 Subject: [PATCH 13/33] ci(release): Refactor action [skip ci] --- .github/workflows/release.yml | 74 +++++++++++++++-------------------- 1 file changed, 32 insertions(+), 42 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13e010a..9467fe9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,17 +2,11 @@ name: Create Release # example: gh workflow run release.yml -f tag_name=v1.1.4 on: workflow_dispatch: - branches: - - main inputs: tag_name: description: Tag name type: string required: true - first-release: - type: boolean - description: First release - default: false jobs: create-release: @@ -22,36 +16,41 @@ jobs: contents: write outputs: - version_number: ${{ steps.set-outputs.outputs.version_number }} - major_tag: ${{ steps.set-outputs.outputs.major_tag }} + version_number: ${{ steps.set-version-number.outputs.version_number }} + major_tag: ${{ steps.set-major-tag.outputs.major_tag }} + + env: + TAG_NAME: ${{ github.event.inputs.tag_name }} steps: - name: Check naming convention run: | - VERIF=$(echo ${{ github.event.inputs.tag_name }} | grep -E "^v([0-9]{1,}\.)([0-9]{1,}\.)([0-9]{1,})(-(alpha|beta)\.[0-9]{1,})?$") + VERIF=$(echo ${{ env.TAG_NAME }} | grep -E "^v([0-9]{1,}\.)([0-9]{1,}\.)([0-9]{1,})(-(alpha|beta)\.[0-9]{1,})?$") if [ ! ${VERIF} ] then - echo "Tag name '${{ github.event.inputs.tag_name }}' does not comply with naming convention vX.Y.Z" + echo "Tag name '${{ env.TAG_NAME }}' does not comply with naming convention vX.Y.Z" exit 1 fi - name: Set version number with v + id: set-version-number run: | - echo "VERSION_NUMBER=$(echo ${{ github.event.inputs.tag_name }})" >> $GITHUB_ENV + echo "version_number=$(echo ${{ env.TAG_NAME }})" >> $GITHUB_OUTPUT - name: Set major tag with v + id: set-major-tag run: | - echo "MAJOR_TAG=$(echo ${{ env.VERSION_NUMBER }} | cut -d. -f1)" >> $GITHUB_ENV + echo "major_tag=$(echo ${{ steps.set-version-number.outputs.version_number }} | cut -d. -f1)" >> $GITHUB_OUTPUT - name: Clone sources uses: actions/checkout@v4 - - name: Check version ${{ env.VERSION_NUMBER }} consistency in CHANGELOG and README + - name: Check version consistency in CHANGELOG and README run: | # Check top ## [VERSION_NUMBER](GITHUB_URL/releases/tag/VERSION_NUMBER) - yyyy-mm-dd in CHANGELOG.md CURRENT_DATE=$(date +'%Y-%m-%d') CHANGELOG_VERSION=$(grep -o -E "## \[(.*)\].* - $CURRENT_DATE" CHANGELOG.md | head -1 | sed 's/ //g') - if [[ $CHANGELOG_VERSION == "##[${{ env.VERSION_NUMBER }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{ env.VERSION_NUMBER }})-$CURRENT_DATE" ]] + if [[ $CHANGELOG_VERSION == "##[${{ steps.set-version-number.outputs.version_number }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{ steps.set-version-number.outputs.version_number }})-$CURRENT_DATE" ]] then echo "CHANGELOG VERSION OK" else @@ -60,26 +59,23 @@ jobs: fi # Check top [_Compare with previous release_](GITHUB_URL/compare/vLAST_TAG...VERSION_NUMBER) in CHANGELOG.md - if [[ ${{ github.event.inputs.first-release }} != "true" ]] + COMPARISON=$(grep -oP "\/compare\/\K(.*)$" CHANGELOG.md | head -1) + LAST_TAG=$(curl -Ls -o /dev/null -w %{url_effective} $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/latest | grep -oP "\/tag\/\K(.*)$") + if [[ $COMPARISON == "$LAST_TAG...${{ steps.set-version-number.outputs.version_number }})" ]] then - COMPARISON=$(grep -oP "\/compare\/\K(.*)$" CHANGELOG.md | head -1) - LAST_TAG=$(curl -Ls -o /dev/null -w %{url_effective} $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/latest | grep -oP "\/tag\/\K(.*)$") - if [[ $COMPARISON == "$LAST_TAG...${{ env.VERSION_NUMBER }})" ]] - then - echo "VERSION COMPARISON OK" - else - echo "VERSION COMPARISON KO" - echo $COMPARISON - echo "$LAST_TAG...${{ env.VERSION_NUMBER }})" - exit 1 - fi + echo "VERSION COMPARISON OK" + else + echo "VERSION COMPARISON KO" + echo $COMPARISON + echo "$LAST_TAG...${{ steps.set-version-number.outputs.version_number }})" + exit 1 fi # Check first major tag uses in README README_VERSION=$(grep -E "$GITHUB_REPOSITORY@v(.*)" README.md | sed 's/ //g' | head -1) echo $README_VERSION - echo "-uses:$GITHUB_REPOSITORY@v${{ env.MAJOR_TAG }}" - if [[ $README_VERSION == "-uses:$GITHUB_REPOSITORY@${{ env.MAJOR_TAG }}" ]] + echo "-uses:$GITHUB_REPOSITORY@v${{ steps.set-major-tag.outputs.major_tag }}" + if [[ $README_VERSION == "-uses:$GITHUB_REPOSITORY@${{ steps.set-major-tag.outputs.major_tag }}" ]] then echo "Major tag in README.md: OK" else @@ -90,8 +86,8 @@ jobs: # Check second major tags uses in README README_VERSION=$(grep -E "$GITHUB_REPOSITORY@v(.*)" README.md | sed 's/ //g' | tail -1) echo $README_VERSION - echo "-uses:$GITHUB_REPOSITORY@v${{ env.MAJOR_TAG }}" - if [[ $README_VERSION == "-uses:$GITHUB_REPOSITORY@${{ env.MAJOR_TAG }}" ]] + echo "-uses:$GITHUB_REPOSITORY@v${{ steps.set-major-tag.outputs.major_tag }}" + if [[ $README_VERSION == "-uses:$GITHUB_REPOSITORY@${{ steps.set-major-tag.outputs.major_tag }}" ]] then echo "Major tag in README.md: OK" else @@ -99,7 +95,7 @@ jobs: exit 1 fi - - name: Create Tag ${{ github.event.inputs.tag_name }} + - name: Create Tag uses: actions/github-script@v7 with: github-token: ${{ github.token }} @@ -107,31 +103,25 @@ jobs: github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, - ref: "refs/tags/${{ github.event.inputs.tag_name }}", + ref: "refs/tags/${{ env.TAG_NAME }}", sha: context.sha }) - name: Prepare release notes run: | # Retrieve release body and remove --- - VERSION_RELEASE_NOTES=$(awk -v ver="[${{ env.VERSION_NUMBER }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{ env.VERSION_NUMBER }})" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next} } p && NF' CHANGELOG.md | sed ':a;N;$!ba;s/\n---/ /g') + VERSION_RELEASE_NOTES=$(awk -v ver="[${{ steps.set-version-number.outputs.version_number }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{ steps.set-version-number.outputs.version_number }})" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next} } p && NF' CHANGELOG.md | sed ':a;N;$!ba;s/\n---/ /g') echo "$VERSION_RELEASE_NOTES" >> CHANGELOG.txt - - name: Create release ${{ env.VERSION_NUMBER }} + - name: Create release ${{ steps.set-version-number.outputs.version_number }} uses: softprops/action-gh-release@v2 with: body_path: CHANGELOG.txt - name: ${{ env.VERSION_NUMBER }} - tag_name: ${{ github.event.inputs.tag_name }} + name: ${{ steps.set-version-number.outputs.version_number }} + tag_name: ${{ env.TAG_NAME }} draft: false prerelease: false - - name: Set outputs - id: set-outputs - run: | - echo "version_number=${{ env.VERSION_NUMBER }}" >> $GITHUB_OUTPUT - echo "major_tag=${{ env.MAJOR_TAG }}" >> $GITHUB_OUTPUT - update-major-tag: name: Update major tag runs-on: ubuntu-latest From fd7b925a73df15a558ab34e4c27740cfcee74293 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 2 Oct 2024 14:06:41 +0900 Subject: [PATCH 14/33] docs(*): Add developer guide [skip ci] --- .github/workflows/doc-links.yml | 1 + README.md | 6 ++- docs/DEVELOPER.md | 90 +++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 docs/DEVELOPER.md diff --git a/.github/workflows/doc-links.yml b/.github/workflows/doc-links.yml index e09ab28..49254c8 100644 --- a/.github/workflows/doc-links.yml +++ b/.github/workflows/doc-links.yml @@ -37,3 +37,4 @@ jobs: gem install awesome_bot cd sources awesome_bot README.md --skip-save-results --allow-dupe --base-url http://localhost:8080/ --white-list ddev.site + awesome_bot docs/*.md --skip-save-results --allow-dupe --base-url http://localhost:8080/docs/ --white-list ddev.site diff --git a/README.md b/README.md index 1420a67..2974ec2 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ ![project is maintained](https://img.shields.io/maintenance/yes/2024.svg) [![tests](https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml/badge.svg)](https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml) +**Table of Contents** + -**Table of Contents** - - [Quick start](#quick-start) - [Inputs](#inputs) - [Available keys](#available-keys) @@ -227,4 +227,6 @@ jobs: Anyone is welcome to submit a pull request to this repository. +For more details on development processes, please read the [developer guide](./docs/DEVELOPER.md). + **Contributed and maintained by [julienloizelet](https://github.com/julienloizelet)** diff --git a/docs/DEVELOPER.md b/docs/DEVELOPER.md new file mode 100644 index 0000000..0429d0d --- /dev/null +++ b/docs/DEVELOPER.md @@ -0,0 +1,90 @@ +# DDEV add-on test action + +## Developer guide + +**Table of Contents** + + + + +- [Commit message](#commit-message) + - [Allowed message `type` values](#allowed-message-type-values) + - [Squash and merge pull request](#squash-and-merge-pull-request) +- [Update documentation table of contents](#update-documentation-table-of-contents) + + + +## Commit message + +This is not formally required, but in order to have an explicit commit history, we use some commits message convention with the following format: + + (): + +Allowed `type` are defined below. +`scope` value intends to clarify which part of the code has been modified. It can be empty or `*` if the change is a +global or difficult to assign to a specific part. +`subject` describes what has been done using the imperative, present tense. + +Example: + + feat(logger): Add a new property for logger + +### Allowed message `type` values + +- chore (automatic tasks; no production code change) +- ci (updating continuous integration process; no production code change) +- comment (commenting;no production code change) +- docs (changes to the documentation) +- feat (new feature for the user) +- fix (bug fix for the user) +- refactor (refactoring production code) +- style (formatting; no production code change) +- test (adding missing tests, refactoring tests; no production code change) + +### Squash and merge pull request + +Please note that if you merge a pull request in GitHub using the "squash and merge" option (recommended), the pull request title will be used as the commit message for the squashed commit. + +You should ensure that the resulting commit message is valid with respect to the above convention. + +## Update documentation table of contents + +To update the table of contents in the documentation, you can use [the `doctoc` tool](https://github.com/thlorenz/doctoc). + +First, install it: + +```bash +npm install -g doctoc +``` + +Then, run it in the root folder: + +```bash +doctoc README.md --maxlevel 4 && doctoc docs/* --maxlevel 4 +``` + +## Release process + +We are using [semantic versioning](https://semver.org/) to determine a version number. To verify the current tag, +you should run: + +``` +git describe --tags `git rev-list --tags --max-count=1` +``` + +Before publishing a new release, there are some manual steps to take: + +- Update the `CHANGELOG.md` file to the current format. The release description is based on the contents of the `CHANGELOG.md` file. +- If the release is a major release, modify the major tag in the `README.md` file wherever necessary. + +Then, you have to [run the action manually from the GitHub repository](https://github.com/ddev/github-action-add-on-test/actions/workflows/release.yml) + +Alternatively, you could use the [GitHub CLI](https://github.com/cli/cli): + +- publish a release: + +``` +gh workflow run release.yml -f tag_name=vx.y.z +``` + +Note that the GitHub action will fail if the tag `tag_name` already exits. From d1929c1d9e2158b49b7f7c5a644f3e73c1aa47d4 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 2 Oct 2024 14:10:31 +0900 Subject: [PATCH 15/33] docs(developer): Update table of contents --- docs/DEVELOPER.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/DEVELOPER.md b/docs/DEVELOPER.md index 0429d0d..12cf267 100644 --- a/docs/DEVELOPER.md +++ b/docs/DEVELOPER.md @@ -11,6 +11,7 @@ - [Allowed message `type` values](#allowed-message-type-values) - [Squash and merge pull request](#squash-and-merge-pull-request) - [Update documentation table of contents](#update-documentation-table-of-contents) +- [Release process](#release-process) From eed32c440bcb7b1ace580dcf96d979edd57079a8 Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Mon, 14 Oct 2024 23:54:06 -0600 Subject: [PATCH 16/33] feat(*): Quiet down the brew installs (#35) * Minor: Quiet down the brew installs * Quiet the tap too * Remove stderr redirection --- action.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yaml b/action.yaml index 0aa08ff..2afc23a 100644 --- a/action.yaml +++ b/action.yaml @@ -66,8 +66,8 @@ runs: shell: bash run: | # For bats-assert and friends - brew tap kaos/shell - brew install bats-core bats-file bats-assert bats-support jq mkcert yq + brew tap kaos/shell >/dev/null + brew install bats-core bats-file bats-assert bats-support jq mkcert yq >/dev/null mkcert -install - uses: actions/checkout@v4 @@ -80,12 +80,12 @@ runs: - name: Use ddev stable shell: bash if: inputs.ddev_version == 'stable' - run: brew install ddev/ddev/ddev + run: brew install ddev/ddev/ddev >/dev/null - name: Use ddev HEAD shell: bash if: inputs.ddev_version == 'HEAD' - run: brew install --HEAD ddev/ddev/ddev + run: brew install --HEAD ddev/ddev/ddev >/dev/null - name: Download docker images shell: bash From e69436a02c8c4fc2aa5841eb3f1573a48ac20ade Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Tue, 15 Oct 2024 15:02:32 +0900 Subject: [PATCH 17/33] chore(*): Prepare release 2.2.0 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee71d02..ecf2e14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec --- +## [v2.2.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.2.0) - 2024-10-15 + +[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.1.0...v2.2.0) + +### Changed + +- Quiet down the `brew` installs ([PR #35](https://github.com/ddev/github-action-add-on-test/pull/35)) + +--- + ## [v2.1.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.1.0) - 2024-10-02 [_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.0.2...v2.1.0) From da4d15f652e4160ea9abdb69be631bdf164d35c8 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Tue, 29 Oct 2024 08:57:28 +0900 Subject: [PATCH 18/33] feat(*): Exclude release tagged tests for push workflow (#38) --- README.md | 2 +- action.yaml | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2974ec2..dafdbd4 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ Default: `false`. If you want to run a customized test command, you can use this input. -If it's empty, the test command will be `bats tests --filter-tags !release` during a pull request workflow and `bats tests` otherwise. +If it's empty, the test command will be `bats tests --filter-tags !release` during _push_ or _pull request_ workflows and `bats tests` otherwise. Not required. diff --git a/action.yaml b/action.yaml index 2afc23a..da64a43 100644 --- a/action.yaml +++ b/action.yaml @@ -109,16 +109,23 @@ runs: TEST_COMMAND_INPUT: ${{ inputs.test_command }} # Use the addon path ADDON_PATH: ${{ inputs.addon_path }} + # Use the event name + GITHUB_EVENT_NAME: ${{ github.event_name }} shell: bash # Use of "set +H" to ensure that bash history expansion is disabled so that ! can be used in test command run: | set +H if [ -n "$TEST_COMMAND_INPUT" ]; then TEST_COMMAND="$TEST_COMMAND_INPUT" - elif [ "${{ github.event_name }}" == "pull_request" ]; then - TEST_COMMAND="bats tests --filter-tags !release" else - TEST_COMMAND="bats tests" + case "$GITHUB_EVENT_NAME" in + "push"|"pull_request") + TEST_COMMAND="bats tests --filter-tags !release" + ;; + *) + TEST_COMMAND="bats tests" + ;; + esac fi echo "Running: $TEST_COMMAND in $ADDON_PATH" cd $ADDON_PATH && $TEST_COMMAND From 5be9f4ac8f5851ca10a2bde93e2eb5e3ce8deaf9 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Tue, 29 Oct 2024 09:34:08 +0900 Subject: [PATCH 19/33] ci(tests): Improve test workflow --- .github/workflows/add-ons-test.yml | 67 ++++++++++++++++++++++-------- .github/workflows/release.yml | 13 ++++++ 2 files changed, 62 insertions(+), 18 deletions(-) diff --git a/.github/workflows/add-ons-test.yml b/.github/workflows/add-ons-test.yml index 72691e7..e0be567 100644 --- a/.github/workflows/add-ons-test.yml +++ b/.github/workflows/add-ons-test.yml @@ -11,6 +11,19 @@ on: schedule: - cron: "25 08 * * *" workflow_dispatch: + inputs: + action_ref: + description: The ref to use for the action (tag, branch, SHA) + required: false + type: string + default: "" + workflow_call: + inputs: + action_ref: + description: The ref to use for the action (tag, branch, SHA) + required: false + type: string + default: "" permissions: contents: read @@ -22,15 +35,24 @@ jobs: matrix: ddev_version: [stable, HEAD] add_on: - - ddev/ddev-redis-commander - - ddev/ddev-mongo - - ddev/ddev-adminer - - ddev/ddev-redis - - ddev/ddev-solr - - ddev/ddev-pdfreactor - - ddev/ddev-memcached - - ddev/ddev-cron - - ddev/ddev-elasticsearch + - name: ddev/ddev-redis-commander + test_command: "bats tests" + - name: ddev/ddev-mongo + test_command: "" + - name: ddev/ddev-adminer + test_command: "" + - name: ddev/ddev-redis + test_command: "" + - name: ddev/ddev-solr + test_command: "" + - name: ddev/ddev-pdfreactor + test_command: "" + - name: ddev/ddev-memcached + test_command: "" + - name: ddev/ddev-cron + test_command: "" + - name: ddev/ddev-elasticsearch + test_command: "" name: Add-on test runs-on: ubuntu-latest @@ -40,15 +62,24 @@ jobs: uses: actions/checkout@v4 - name: Retrieve last tag of add-on + id: last_tag run: | - echo "ADD_ON_LAST_TAG=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/${{ matrix.add_on }}/releases/latest | grep -oP "\/tag\/\K(.*)$")" >> $GITHUB_ENV + echo "add_on_last_tag=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/${{ matrix.add_on.name }}/releases/latest | grep -oP "\/tag\/\K(.*)$")" >> $GITHUB_OUTPUT - - name: Run add-on test (${{ matrix.ddev_version }}) - uses: ./ + - name: Set action ref + env: + ACTION_REF: ${{ github.event.inputs.action_ref }} + id: set_action_call + run: | + if [ -z "${{ env.ACTION_REF }}" ] + then + echo "action_ref=$(echo './')" >> $GITHUB_OUTPUT + else + echo "action_ref=$(echo ddev/ddev-add-on-test/@${{ env.ACTION_REF }})" >> $GITHUB_OUTPUT + fi + + - name: Run add-on test + uses: jenseng/dynamic-uses@v1 with: - ddev_version: ${{ matrix.ddev_version }} - token: ${{ secrets.GITHUB_TOKEN }} - addon_repository: ${{ matrix.add_on }} - addon_ref: ${{ env.ADD_ON_LAST_TAG }} - addon_path: tested-addon - keepalive: false + uses: ${{ steps.set_action_call.outputs.action_ref }} + with: '{"ddev_version": "${{ matrix.ddev_version }}", "token": "${{ secrets.GITHUB_TOKEN }}", "addon_repository": "${{ matrix.add_on.name }}", "addon_ref": "${{ steps.last_tag.outputs.add_on_last_tag }}", "addon_path": "tested-addon", "keepalive": false, "test_command": "${{ matrix.add_on.test_command }}" }' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9467fe9..2cd9313 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -139,3 +139,16 @@ jobs: - name: Push the major tag run: git push origin ${{ needs.create-release.outputs.major_tag }} --force + + run-test: + name: Run test for release + runs-on: ubuntu-latest + needs: [create-release, update-major-tag] + permissions: + contents: read + + steps: + - name: Test add-ons + uses: ./.github/workflows/add-ons-test.yml + with: + action_ref: ${{ needs.create-release.outputs.major_tag }} From d8750fd96bd881e64749368129a0201c6445e692 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Tue, 29 Oct 2024 10:12:49 +0900 Subject: [PATCH 20/33] docs(changelog): Prepare release 2.3.0 --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecf2e14..c86a716 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec --- +## [v2.3.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.3.0) - 2024-10-29 + +[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.2.0...v2.3.0) + +### Changed + +- Exclude "release" tagged tests for _push_ workflow ([PR #38](https://github.com/ddev/github-action-add-on-test/pull/38)) + +--- + ## [v2.2.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.2.0) - 2024-10-15 [_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.1.0...v2.2.0) @@ -27,7 +37,7 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec ### Changed -- Exclude "release" tagged tests for pull request workflow ([PR #34](https://github.com/ddev/github-action-add-on-test/pull/34)) +- Exclude "release" tagged tests for _pull request_ workflow ([PR #34](https://github.com/ddev/github-action-add-on-test/pull/34)) ### Added From d67e28a63b622ab1f9719b18ace7295c271e8cbb Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Tue, 29 Oct 2024 10:28:10 +0900 Subject: [PATCH 21/33] ci(release): Fix run test job [skip ci] --- .github/workflows/release.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2cd9313..0418aa6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -141,14 +141,8 @@ jobs: run: git push origin ${{ needs.create-release.outputs.major_tag }} --force run-test: - name: Run test for release - runs-on: ubuntu-latest + name: Run test on add-ons needs: [create-release, update-major-tag] - permissions: - contents: read - - steps: - - name: Test add-ons - uses: ./.github/workflows/add-ons-test.yml - with: - action_ref: ${{ needs.create-release.outputs.major_tag }} + uses: ./.github/workflows/add-ons-test.yml + with: + action_ref: ${{ needs.create-release.outputs.major_tag }} From 899d2a1c7944b9f3bfa6aab3ec1d92642210412e Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Fri, 1 Nov 2024 09:16:31 +0900 Subject: [PATCH 22/33] docs(readme): Add more details about bats tags (#40) --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index dafdbd4..0f8e927 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ - [Available keys](#available-keys) - [Usage](#usage) - [Test your DDEV add-on](#test-your-ddev-add-on) + - [`bats` tags and the `test_command` input](#bats-tags-and-the-test_command-input) - [License](#license) - [Contribute](#contribute) @@ -167,6 +168,8 @@ Not required. Default: `""`. +For more details, see [below](#bats-tags-and-the-test_command-input). + --- ## Usage @@ -219,6 +222,30 @@ jobs: addon_ref: ${{ env.GITHUB_REF }} ``` +#### `bats` tags and the `test_command` input + +By default, this GitHub action is configured to exclude `release` tagged tests during _push_ and +_pull_request_ workflows by using the `bats tests --filter-tags '!release'` command. + +For other workflows, the default command is `bats tests`, meaning all tests, regardless of their tags, will run. + +To tag a test with a `release` tag, add `# bats test_tags=release` above the `@test` line in your bats file: + +```bash +# bats test_tags=release +@test "install from release" { + ... + + ... +} +``` + +This setup keeps release-specific tests out of everyday workflows unless you set a custom `test_command`. + +For more information on `bats` tags and filtering tests by tags, refer to the [bats documentation](https://bats-core.readthedocs.io/en/stable/writing-tests.html#tagging-tests). + + + ## License [Apache](LICENSE) From a50ca3fa3add06277da6982ea5d579232e0f915d Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Fri, 1 Nov 2024 16:20:49 +0900 Subject: [PATCH 23/33] ci(tests): Fix input for workflow_call --- .github/workflows/add-ons-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/add-ons-test.yml b/.github/workflows/add-ons-test.yml index e0be567..1e77532 100644 --- a/.github/workflows/add-ons-test.yml +++ b/.github/workflows/add-ons-test.yml @@ -68,7 +68,7 @@ jobs: - name: Set action ref env: - ACTION_REF: ${{ github.event.inputs.action_ref }} + ACTION_REF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.action_ref || inputs.action_ref }} id: set_action_call run: | if [ -z "${{ env.ACTION_REF }}" ] From a4dc9ce76e49fb652f3162073881705d61a763b0 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Thu, 16 Jan 2025 17:02:29 +0900 Subject: [PATCH 24/33] docs(readme): Update maintained date to 2025 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f8e927..5b5c003 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ --- [![Version](https://img.shields.io/github/v/release/ddev/github-action-add-on-test)](https://github.com/ddev/github-action-add-on-test/releases) -![project is maintained](https://img.shields.io/maintenance/yes/2024.svg) +![project is maintained](https://img.shields.io/maintenance/yes/2025.svg) [![tests](https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml/badge.svg)](https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml) **Table of Contents** From bcc47dc016fdfacea64a6db7f2c90bee8bab3ee2 Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 23 Apr 2025 00:28:27 +0900 Subject: [PATCH 25/33] feat(keepalive): Remove keepalive feature, fixes #41, replaces #42 (#43) --- .../add-on-disable-checkout-test.yml | 1 - .github/workflows/add-ons-test.yml | 2 +- .github/workflows/keepalive.yml | 22 ------------- CHANGELOG.md | 10 ++++++ README.md | 31 ------------------- action.yaml | 17 ---------- 6 files changed, 11 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/keepalive.yml diff --git a/.github/workflows/add-on-disable-checkout-test.yml b/.github/workflows/add-on-disable-checkout-test.yml index 1ab8922..204295d 100644 --- a/.github/workflows/add-on-disable-checkout-test.yml +++ b/.github/workflows/add-on-disable-checkout-test.yml @@ -43,5 +43,4 @@ jobs: addon_repository: ${{ env.ADD_ON }} addon_ref: ${{ env.ADD_ON_REF }} addon_path: tested-addon - keepalive: false disable_checkout_action: true diff --git a/.github/workflows/add-ons-test.yml b/.github/workflows/add-ons-test.yml index 1e77532..00adce4 100644 --- a/.github/workflows/add-ons-test.yml +++ b/.github/workflows/add-ons-test.yml @@ -82,4 +82,4 @@ jobs: uses: jenseng/dynamic-uses@v1 with: uses: ${{ steps.set_action_call.outputs.action_ref }} - with: '{"ddev_version": "${{ matrix.ddev_version }}", "token": "${{ secrets.GITHUB_TOKEN }}", "addon_repository": "${{ matrix.add_on.name }}", "addon_ref": "${{ steps.last_tag.outputs.add_on_last_tag }}", "addon_path": "tested-addon", "keepalive": false, "test_command": "${{ matrix.add_on.test_command }}" }' + with: '{"ddev_version": "${{ matrix.ddev_version }}", "token": "${{ secrets.GITHUB_TOKEN }}", "addon_repository": "${{ matrix.add_on.name }}", "addon_ref": "${{ steps.last_tag.outputs.add_on_last_tag }}", "addon_path": "tested-addon", "test_command": "${{ matrix.add_on.test_command }}" }' diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml deleted file mode 100644 index a43294a..0000000 --- a/.github/workflows/keepalive.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Keep Alive -on: - schedule: - - cron: "0 3 * * 4" - -permissions: - actions: write - -jobs: - keep-alive: - name: Keep Alive - runs-on: ubuntu-latest - - steps: - - name: Clone project files - uses: actions/checkout@v4 - - # keepalive-workflow keeps GitHub from turning off tests after 60 days - - uses: gautamkrishnar/keepalive-workflow@v2 - with: - time_elapsed: 30 - workflow_files: "add-ons-test.yml" diff --git a/CHANGELOG.md b/CHANGELOG.md index c86a716..d2e6ee7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec --- +## [v2.4.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.4.0) - 2025-04-22 + +[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.3.0...v2.4.0) + +### Removed + +- Remove "Keep alive" feature as [related repository](https://github.com/gautamkrishnar/keepalive-workflow) has been disabled + +--- + ## [v2.3.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.3.0) - 2024-10-29 [_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.2.0...v2.3.0) diff --git a/README.md b/README.md index 5b5c003..31f0ce0 100644 --- a/README.md +++ b/README.md @@ -107,37 +107,6 @@ Default: `./` --- -- `keepalive` (_Boolean_) - -Keeps GitHub from turning off tests after 60 days. - -If enabled, action will use [keepalive-workflow action](https://github.com/gautamkrishnar/keepalive-workflow) when `ddev_version` has been set to `stable`. - -**N.B.** If enabled, you have to update the permission of the main workflow to `write`: - -```yaml -permissions: - actions: write -``` - -Not required. - -Default: `true`. - ---- - -- `keepalive_time_elapsed` (_String_) - -Time elapsed from the previous commit to keep the repository active using GitHub API (in days). - -Will be used as the `time_elapsed` key of the [keepalive-workflow action](https://github.com/gautamkrishnar/keepalive-workflow). - -Not required. - -Default: `"0"`. - ---- - - `debug_enabled` (_Boolean_) If `true`, a tmate session will be accessible before the tests step. See [action-tmate](https://github.com/mxschmitt/action-tmate) for more details. diff --git a/action.yaml b/action.yaml index da64a43..c0fd140 100644 --- a/action.yaml +++ b/action.yaml @@ -25,17 +25,6 @@ inputs: required: false default: "./" - keepalive: - type: boolean - description: "Keeps GitHub from turning off tests after 60 days" - required: false - default: true - - keepalive_time_elapsed: - description: "Time elapsed from the most recent commit to hit API and prevent expiration (in days)" - required: false - default: "0" - debug_enabled: type: boolean description: "Debug with tmate" @@ -130,12 +119,6 @@ runs: echo "Running: $TEST_COMMAND in $ADDON_PATH" cd $ADDON_PATH && $TEST_COMMAND - # keepalive-workflow keeps GitHub from turning off tests after 60 days - - uses: gautamkrishnar/keepalive-workflow@v2 - if: always() && matrix.ddev_version == 'stable' && inputs.keepalive == 'true' && github.event_name == 'schedule' - with: - time_elapsed: ${{ inputs.keepalive_time_elapsed }} - branding: icon: "code" color: "blue" From 1b811b2a9287dcdf47c20551e27b18c46d6629a0 Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Tue, 22 Apr 2025 14:39:09 -0600 Subject: [PATCH 26/33] docs: Minor documentation updates (#45) --- CHANGELOG.md | 11 +++++++++-- README.md | 2 +- docs/DEVELOPER.md | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e6ee7..eb5a720 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,16 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec --- -## [v2.4.0](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.4.0) - 2025-04-22 +## [v2.3.2](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.3.2) - 2025-04-22 -[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.3.0...v2.4.0) +[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.3.1...v2.3.2) + +### Minor Documentation updates + + +## [v2.3.1](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.3.1) - 2025-04-22 + +[_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.3.0...v2.3.1) ### Removed diff --git a/README.md b/README.md index 31f0ce0..ab3183b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ --- [![Version](https://img.shields.io/github/v/release/ddev/github-action-add-on-test)](https://github.com/ddev/github-action-add-on-test/releases) -![project is maintained](https://img.shields.io/maintenance/yes/2025.svg) +[![last commit](https://img.shields.io/github/last-commit/ddev/github-action-add-on-test)](https://github.com/ddev/github-action-add-on-test/commits) [![tests](https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml/badge.svg)](https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml) **Table of Contents** diff --git a/docs/DEVELOPER.md b/docs/DEVELOPER.md index 12cf267..790c205 100644 --- a/docs/DEVELOPER.md +++ b/docs/DEVELOPER.md @@ -78,7 +78,7 @@ Before publishing a new release, there are some manual steps to take: - Update the `CHANGELOG.md` file to the current format. The release description is based on the contents of the `CHANGELOG.md` file. - If the release is a major release, modify the major tag in the `README.md` file wherever necessary. -Then, you have to [run the action manually from the GitHub repository](https://github.com/ddev/github-action-add-on-test/actions/workflows/release.yml) +Then, you have to [run the action manually using `Actions -> Create Release -> Tag Name`](https://github.com/ddev/github-action-add-on-test/actions/workflows/release.yml). Alternatively, you could use the [GitHub CLI](https://github.com/cli/cli): From 0a808331a6d78ec53fc164536b4705d1d70a80bd Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 23 Apr 2025 10:37:04 +0900 Subject: [PATCH 27/33] docs(changelog): Update 2.3.1 and 2.3.2 release descriptions --- CHANGELOG.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb5a720..d3182b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,16 +15,19 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this projec [_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.3.1...v2.3.2) -### Minor Documentation updates +### Fixed + +- Synchronize the major tag with the correct commit ## [v2.3.1](https://github.com/ddev/github-action-add-on-test/releases/tag/v2.3.1) - 2025-04-22 [_Compare with previous release_](https://github.com/ddev/github-action-add-on-test/compare/v2.3.0...v2.3.1) -### Removed +### Fixed -- Remove "Keep alive" feature as [related repository](https://github.com/gautamkrishnar/keepalive-workflow) has been disabled +- Remove "Keep alive" feature as [related repository](https://github.com/gautamkrishnar/keepalive-workflow) has been + disabled and causes the action to fail ([PR #43](https://github.com/ddev/github-action-add-on-test/pull/43)) --- From cc57e72e7d132faf50ce49ed816dcfb486cf34ca Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Wed, 23 Apr 2025 17:31:10 +0900 Subject: [PATCH 28/33] docs(readme): Downgrade permissions to contents:read actions:write permission was only required for removed gautamkrishnar/keepalive-workflow --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab3183b..ee05cf6 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ on: default: false permissions: - actions: write + contents: read jobs: tests: From 3514d46122ce9d4d846e470581cccea62212a62c Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Thu, 26 Jun 2025 08:11:43 -0600 Subject: [PATCH 29/33] build: Use official brew tap for bats-core (#48) --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index c0fd140..7650fed 100644 --- a/action.yaml +++ b/action.yaml @@ -55,7 +55,7 @@ runs: shell: bash run: | # For bats-assert and friends - brew tap kaos/shell >/dev/null + brew tap bats-core/bats-core >/dev/null brew install bats-core bats-file bats-assert bats-support jq mkcert yq >/dev/null mkcert -install From 1a55661204342fd16650a5a149395bfb1837d4b9 Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Thu, 26 Jun 2025 08:33:41 -0600 Subject: [PATCH 30/33] build: use main branch for setup-homebrew (#47) --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 7650fed..1469bed 100644 --- a/action.yaml +++ b/action.yaml @@ -49,7 +49,7 @@ inputs: runs: using: "composite" steps: - - uses: Homebrew/actions/setup-homebrew@master + - uses: Homebrew/actions/setup-homebrew@main - name: Environment setup shell: bash From 47894109536d4a63d93d7ea514c56e91b0a933b1 Mon Sep 17 00:00:00 2001 From: Stanislav Zhuk Date: Thu, 26 Jun 2025 22:50:12 +0300 Subject: [PATCH 31/33] chore(release): add template for PRs (#49) --- .github/PULL_REQUEST_TEMPLATE.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ec9b430 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,23 @@ +## The Issue + +- Fixes #REPLACE_ME_WITH_RELATED_ISSUE_NUMBER + + + +## How This PR Solves The Issue + + + +## Manual Testing Instructions + + + +## Automated Testing Overview + + + +## Release/Deployment Notes + +Don't create releases manually. Follow the [release process documentation](https://github.com/ddev/github-action-add-on-test/blob/main/docs/DEVELOPER.md#release-process) when making a new release. + + From ad2c61ef4bae22f996cc93f81f990e5bac77844d Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Fri, 4 Jul 2025 07:51:52 -0400 Subject: [PATCH 32/33] Upload artifacts example (#50) Co-authored-by: Stanislav Zhuk --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index ee05cf6..eaf953e 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,37 @@ This setup keeps release-specific tests out of everyday workflows unless you set For more information on `bats` tags and filtering tests by tags, refer to the [bats documentation](https://bats-core.readthedocs.io/en/stable/writing-tests.html#tagging-tests). +#### Preserving Artifacts +GitHub Actions provides a UI for browsing test artifacts. To use it, store `$TESTDIR` in `$GITHUB_ENV` within your Bats tests (see [example](https://github.com/ddev/ddev-addon-template/blob/main/tests/test.bats)), and configure your job as follows: + +```yaml +jobs: + tests: + steps: + ... + + # Optionally, you may need to zip some artifacts before uploading them + # to fix this error: "The path for one of the files in artifact is not valid" + # - name: Zip artifacts that can't be processed by actions/upload-artifact + # if: always() + # run: | + # for d in ${{ env.TESTDIR }}*/; do + # if [ -d "$d/path/to/directory" ]; then + # (cd "$d/path/to" && zip -r directory.zip directory) + # fi + # done + + - name: Upload artifacts + if: always() + uses: actions/upload-artifact@v4 + with: + name: artifact-${{ matrix.ddev_version }} + path: | + ${{ env.TESTDIR }}*/tests + ${{ env.TESTDIR }}*/web/*.junit.xml + ${{ env.TESTDIR }}*/path/to/directory.zip +``` ## License From f1caf17e7e14c6590aaf1d883ed2e39939233f97 Mon Sep 17 00:00:00 2001 From: tyler36 <7234392+tyler36@users.noreply.github.com> Date: Wed, 5 Nov 2025 20:24:06 +0900 Subject: [PATCH 33/33] feat: add ISSUE templates (#53) --- .github/ISSUE_TEMPLATE/bug_report.yml | 45 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 35 +++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..e3d1d93 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,45 @@ +name: 🐞 Bug report or Support Request +description: Create a report to help us improve. +labels: [bug] +body: + - type: checkboxes + attributes: + label: Preliminary checklist + description: Please complete the following checks before submitting an issue. + options: + - label: I am using the latest stable version of DDEV + required: true + - label: I am using the latest stable version of this action + required: true + - type: textarea + attributes: + label: Expected Behavior + description: What did you expect to happen? + validations: + required: true + - type: textarea + attributes: + label: Actual Behavior + description: What actually happened instead? + validations: + required: true + - type: textarea + attributes: + label: Steps To Reproduce + description: Specific steps to reproduce the behavior. + placeholder: | + 1. In this environment... + 2. With this config... + 3. Run `...` + 4. See error... + validations: + required: false + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Screenshots? Anything that will give us more context about your issue! + + 💡 Attach images or log files by clicking this area to highlight it and dragging files in. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..db21167 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,35 @@ +name: 🚀 Feature request +description: Suggest an idea for this project. +labels: [enhancement] +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search existing issues to see if one already exists for your request. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Is your feature request related to a problem? + description: Clearly and concisely describe the problem. (Ex. I'm always frustrated when...) + validations: + required: true + - type: textarea + attributes: + label: Describe your solution + description: Clearly and concisely describe what you want to happen. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives + description: Clearly and concisely describe any alternative solutions or features you've considered. + validations: + required: false + - type: textarea + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request. + validations: + required: false