From a5c19c80d5e128fa2264de3ebabf4118fa321c9f Mon Sep 17 00:00:00 2001 From: Julien Loizelet Date: Fri, 25 Aug 2023 10:34:53 +0900 Subject: [PATCH] ci(*): Add independant keepalive workflow and refactor add-ons test --- .../add-on-disable-checkout-test.yml | 25 ++++----- ...iple-add-ons-test.yml => add-ons-test.yml} | 20 +++++-- .github/workflows/keepalive.yml | 26 +++++++++ .github/workflows/markdown.yml | 1 - .github/workflows/release.yml | 8 +-- .github/workflows/single-add-on-test.yml | 56 ------------------- README.md | 4 +- action.yaml | 2 +- 8 files changed, 60 insertions(+), 82 deletions(-) rename .github/workflows/{multiple-add-ons-test.yml => add-ons-test.yml} (70%) create mode 100644 .github/workflows/keepalive.yml delete mode 100644 .github/workflows/single-add-on-test.yml diff --git a/.github/workflows/add-on-disable-checkout-test.yml b/.github/workflows/add-on-disable-checkout-test.yml index 26c05cb..a011b95 100644 --- a/.github/workflows/add-on-disable-checkout-test.yml +++ b/.github/workflows/add-on-disable-checkout-test.yml @@ -1,4 +1,4 @@ -name: Add-on with disabled checkout tests +name: Disable checkout test on: push: branches: @@ -13,34 +13,33 @@ on: workflow_dispatch: permissions: - contents: write - + contents: read jobs: - add-on-disable-checkout-test: + disable-checkout-test: strategy: fail-fast: false matrix: ddev_version: [ stable ] add_on: ["JanoPL/ddev-kibana"] - name: Add-on with disabled checkout tests + name: Disable checkout test runs-on: ubuntu-latest + env: + ADD_ON: JanoPL/ddev-kibana + ADD_ON_REF: v1.4.0 + steps: - name: Clone current repository uses: actions/checkout@v3 - - name: Retrieve last tag of add-on - 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 - - name: Checkout uses: actions/checkout@v3 with: - repository: ${{ matrix.add_on }} - ref: ${{ env.ADD_ON_LAST_TAG }} + repository: ${{ env.ADD_ON }} + ref: ${{ env.ADD_ON_REF }} path: tested-addon submodules: 'true' @@ -49,8 +48,8 @@ jobs: with: ddev_version: ${{ matrix.ddev_version }} token: ${{ secrets.GITHUB_TOKEN }} - addon_repository: ${{ matrix.add_on }} - addon_ref: ${{ env.ADD_ON_LAST_TAG }} + 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/multiple-add-ons-test.yml b/.github/workflows/add-ons-test.yml similarity index 70% rename from .github/workflows/multiple-add-ons-test.yml rename to .github/workflows/add-ons-test.yml index bdf38ff..c084800 100644 --- a/.github/workflows/multiple-add-ons-test.yml +++ b/.github/workflows/add-ons-test.yml @@ -1,4 +1,4 @@ -name: Multiple add-ons test +name: Add-ons test on: push: branches: @@ -13,15 +13,25 @@ on: workflow_dispatch: permissions: - contents: write + contents: read jobs: - multiple-add-ons-test: + add-ons-test: strategy: fail-fast: false matrix: - ddev_version: [ stable ] - add_on: ["ddev/ddev-redis-commander", "ddev/ddev-mongo", "ddev/ddev-adminer"] + ddev_version: [ stable, HEAD ] + add_on: + - ddev/ddev-redis-commander + - ddev/ddev-mongo + - ddev/ddev-adminer + - ddev/ddev-redis + - ddev/ddev-solr + - ddev/ddev-sqlsrv + - ddev/ddev-pdfreactor + - ddev/ddev-memcached + - ddev/ddev-cron + - ddev/ddev-elasticsearch name: Add-on test runs-on: ubuntu-latest diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml new file mode 100644 index 0000000..424f36f --- /dev/null +++ b/.github/workflows/keepalive.yml @@ -0,0 +1,26 @@ +name: Keep Alive +on: + + schedule: + - cron: '0 3 * * *' + +permissions: + contents: write + +jobs: + keep-alive: + + name: Keep Alive + runs-on: ubuntu-latest + + steps: + + - name: Clone project files + uses: actions/checkout@v3 + + # keepalive-workflow adds a dummy commit if there's no other action here, keeps + # GitHub from turning off tests after 60 days + - uses: gautamkrishnar/keepalive-workflow@v1 + with: + commit_message: "chore(*): Automated commit to keep the repository active" + time_elapsed: 55 diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 9065054..84e4be1 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -35,7 +35,6 @@ jobs: - uses: technote-space/toc-generator@v4 with: MAX_HEADER_LEVEL: 3 - COMMIT_NAME: Okaeli Dev Bot TARGET_PATHS: 'README.md' CHECK_ONLY_DEFAULT_BRANCH: true CREATE_PR: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 50fd0d8..6210920 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -129,8 +129,8 @@ jobs: - name: Set outputs id: set-outputs run: | - echo "version_number=${{ env.VERSION_NUMBER}}" >> $GITHUB_OUTPUT - echo "major_tag=${{ env.MAJOR_TAG}}" >> $GITHUB_OUTPUT + echo "version_number=${{ env.VERSION_NUMBER }}" >> $GITHUB_OUTPUT + echo "major_tag=${{ env.MAJOR_TAG }}" >> $GITHUB_OUTPUT update-major-tag: name: Update major tag @@ -146,7 +146,7 @@ jobs: fetch-depth: 0 - name: Move or create the major tag - run: git tag -f ${{needs.create-release.outputs.major_tag}} ${{needs.create-release.outputs.version_number}} + run: git tag -f ${{ needs.create-release.outputs.major_tag }} ${{ needs.create-release.outputs.version_number }} - name: Push the major tag - run: git push origin ${{needs.create-release.outputs.major_tag}} --force + run: git push origin ${{ needs.create-release.outputs.major_tag }} --force diff --git a/.github/workflows/single-add-on-test.yml b/.github/workflows/single-add-on-test.yml deleted file mode 100644 index 4d4ae82..0000000 --- a/.github/workflows/single-add-on-test.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Single add-on test -on: - push: - branches: - - main - paths-ignore: - - '**.md' - pull_request: - paths-ignore: - - '**.md' - schedule: - - cron: '25 08 * * *' - workflow_dispatch: - -permissions: - contents: write - - -jobs: - single-add-on-test: - strategy: - fail-fast: false - matrix: - ddev_version: [ stable, HEAD ] - add_on: ["ddev/ddev-redis-commander"] - - name: Add-on test - runs-on: ubuntu-latest - - steps: - - - name: Clone current repository - uses: actions/checkout@v3 - - - name: Retrieve last tag of add-on - 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 - - - name: Run DDEV test (${{ matrix.ddev_version }}) - uses: ./ - 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 - - # keepalive-workflow adds a dummy commit if there's no other action here, keeps - # GitHub from turning off tests after 60 days - - name: Keep alive - uses: gautamkrishnar/keepalive-workflow@v1 - if: always() && matrix.ddev_version == 'stable' - with: - commit_message: "chore(*): Automated commit to keep the repository active" - time_elapsed: 55 diff --git a/README.md b/README.md index bcbb6ea..237a5da 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ [![Version](https://img.shields.io/github/v/release/ddev/github-action-add-on-test)](https://github.comddev/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/single-add-on-test.yml/badge.svg)](https://github.com/ddev/github-action-add-on-test/actions/workflows/single-add-on-test.yml) +[![tests](https://github.com/ddev/github-action-add-on-test/actions/workflows/adds-on-test.yml/badge.svg)] +(https://github.com/ddev/github-action-add-on-test/actions/workflows/add-ons-test.yml) @@ -190,7 +191,6 @@ on: permissions: contents: write - jobs: tests: diff --git a/action.yaml b/action.yaml index 83962f3..d75ed89 100644 --- a/action.yaml +++ b/action.yaml @@ -111,4 +111,4 @@ runs: branding: icon: "code" - color: "green" + color: "blue"