{"id":20329330,"url":"https://github.com/ddev/github-action-add-on-test","last_synced_at":"2025-04-11T20:41:36.134Z","repository":{"id":180034737,"uuid":"664479964","full_name":"ddev/github-action-add-on-test","owner":"ddev","description":"A GitHub action to run tests on a DDEV add-on","archived":false,"fork":false,"pushed_at":"2025-01-16T08:02:35.000Z","size":104,"stargazers_count":2,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-25T16:47:04.510Z","etag":null,"topics":["add-on","ddev","github-actions"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ddev"],"custom":["https://www.paypal.com/donate/?hosted_button_id=MCNCSZHC7LHSQ","https://ddev.com/support-ddev/"]}},"created_at":"2023-07-10T04:32:15.000Z","updated_at":"2025-01-16T08:02:37.000Z","dependencies_parsed_at":"2023-08-20T10:55:20.887Z","dependency_job_id":"c0e84f0e-4888-4a61-8c92-2fa24ebdbc96","html_url":"https://github.com/ddev/github-action-add-on-test","commit_stats":null,"previous_names":["julienloizelet/ddev-add-on-test-init","julienloizelet/ddev-add-on-test","ddev/github-action-add-on-test"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fgithub-action-add-on-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fgithub-action-add-on-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fgithub-action-add-on-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fgithub-action-add-on-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddev","download_url":"https://codeload.github.com/ddev/github-action-add-on-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248478790,"owners_count":21110763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["add-on","ddev","github-actions"],"created_at":"2024-11-14T20:10:12.184Z","updated_at":"2025-04-11T20:41:36.124Z","avatar_url":"https://github.com/ddev.png","language":null,"funding_links":["https://github.com/sponsors/ddev","https://www.paypal.com/donate/?hosted_button_id=MCNCSZHC7LHSQ","https://ddev.com/support-ddev/"],"categories":[],"sub_categories":[],"readme":"# DDEV add-on test action\n\n---\n\n\u003e A GitHub action to run tests on a DDEV add-on.\n\n---\n\n[![Version](https://img.shields.io/github/v/release/ddev/github-action-add-on-test)](https://github.com/ddev/github-action-add-on-test/releases)\n![project is maintained](https://img.shields.io/maintenance/yes/2025.svg)\n[![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)\n\n**Table of Contents**\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Quick start](#quick-start)\n- [Inputs](#inputs)\n  - [Available keys](#available-keys)\n- [Usage](#usage)\n  - [Test your DDEV add-on](#test-your-ddev-add-on)\n    - [`bats` tags and the `test_command` input](#bats-tags-and-the-test_command-input)\n- [License](#license)\n- [Contribute](#contribute)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Quick start\n\n_We will suppose here that you want to test your add-on with the stable version of DDEV._\n\nYou can add the following step in your workflow:\n\n```yaml\n- uses: ddev/github-action-add-on-test@v2\n  with:\n    ddev_version: \"stable\"\n    token: ${{ secrets.GITHUB_TOKEN }}\n    addon_repository: ${{ env.GITHUB_REPOSITORY }}\n    addon_ref: ${{ env.GITHUB_REF }}\n```\n\nThis step will install the latest stable version of DDEV and run `bats tests` command from the source folder of your add-on.\n\n(The source folder of your add-on must contain a `tests` folder with at least a `bats` file, as it is the case if you have used the [DDEV addon template](https://github.com/ddev/ddev-addon-template) to create your add-on.)\n\n## Inputs\n\n### Available keys\n\nThe following keys are available as `step.with` keys:\n\n---\n\n- `ddev_version` (_String_)\n\nDDEV version that will be installed before your tests.\n\nNot required.\n\nDefault: `stable`.\n\nAllowed values are: `stable`, `HEAD`.\n\n---\n\n- `token` (_String_)\n\nA GitHub Personal Access Token used by the `debug` and `run test` steps.\n\nRequired.\n\nExample: `${{ secrets.GITHUB_TOKEN }}`.\n\n---\n\n- `addon_repository`(_String_)\n\nGitHub repository of the tested addon (`{owner}/{repo}`). Will be used as the `repository` key during a [checkout\naction](https://github.com/actions/checkout#usage)\n\nRequired.\n\nExample: `${{ env.GITHUB_REPOSITORY }}`.\n\n---\n\n- `addon_ref`(_String_)\n\nGitHub reference of the tested addon. Will be used as the `ref` key during a [checkout action](https://github.com/actions/checkout#usage)\n\nRequired.\n\nExample: `${{ env.GITHUB_REF }}`.\n\n---\n\n- `addon_path`(_String_)\n\nPath (relative to `$GITHUB_WORKSPACE` ) where the addon will be cloned by a checkout action. Will be used as the `path`\nkey of the [checkout action](https://github.com/actions/checkout#usage)\n\nNot required.\n\nDefault: `./`\n\n---\n\n- `keepalive` (_Boolean_)\n\nKeeps GitHub from turning off tests after 60 days.\n\nIf enabled, action will use [keepalive-workflow action](https://github.com/gautamkrishnar/keepalive-workflow) when `ddev_version` has been set to `stable`.\n\n**N.B.** If enabled, you have to update the permission of the main workflow to `write`:\n\n```yaml\npermissions:\n  actions: write\n```\n\nNot required.\n\nDefault: `true`.\n\n---\n\n- `keepalive_time_elapsed` (_String_)\n\nTime elapsed from the previous commit to keep the repository active using GitHub API (in days).\n\nWill be used as the `time_elapsed` key of the [keepalive-workflow action](https://github.com/gautamkrishnar/keepalive-workflow).\n\nNot required.\n\nDefault: `\"0\"`.\n\n---\n\n- `debug_enabled` (_Boolean_)\n\nIf `true`, a tmate session will be accessible before the tests step. See [action-tmate](https://github.com/mxschmitt/action-tmate) for more details.\n\nNot required.\n\nDefault: `false`.\n\n---\n\n- `disable_checkout_action` (_Boolean_)\n\nIf you need to check out your add-on source code with some specific inputs (`submodules`, `ssh-key`, etc.), or you need to perform some extra steps between checkout and DDEV installation steps, you can disable the default checkout action by setting `true` for this input.\n\nNot required.\n\nDefault: `false`.\n\n---\n\n- `test_command` (_String_)\n\nIf you want to run a customized test command, you can use this input.\n\nIf it's empty, the test command will be `bats tests --filter-tags !release` during _push_ or _pull request_ workflows and `bats tests` otherwise.\n\nNot required.\n\nDefault: `\"\"`.\n\nFor more details, see [below](#bats-tags-and-the-test_command-input).\n\n---\n\n## Usage\n\n### Test your DDEV add-on\n\nIf your add-on is based on the [DDEV add-on template repository](https://github.com/ddev/ddev-addon-template), you\nshould have a tests folder containing a `test.bats` file.\n\nUsing this GitHub action, a `.github/workflows/tests.yml` file could have the following content:\n\n```yaml\nname: tests\non:\n  pull_request:\n  push:\n    branches: [main]\n    paths-ignore:\n      - \"**.md\"\n\n  schedule:\n    - cron: \"25 08 * * *\"\n\n  workflow_dispatch:\n    inputs:\n      debug_enabled:\n        type: boolean\n        description: Debug with tmate\n        default: false\n\npermissions:\n  actions: write\n\njobs:\n  tests:\n    strategy:\n      matrix:\n        ddev_version: [stable, HEAD]\n      fail-fast: false\n\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: ddev/github-action-add-on-test@v2\n        with:\n          ddev_version: ${{ matrix.ddev_version }}\n          token: ${{ secrets.GITHUB_TOKEN }}\n          debug_enabled: ${{ github.event.inputs.debug_enabled }}\n          addon_repository: ${{ env.GITHUB_REPOSITORY }}\n          addon_ref: ${{ env.GITHUB_REF }}\n```\n\n#### `bats` tags and the `test_command` input\n\nBy default, this GitHub action is configured to exclude `release` tagged tests during _push_ and \n_pull_request_ workflows by using the `bats tests --filter-tags '!release'` command. \n\nFor other workflows, the default command is `bats tests`, meaning all tests, regardless of their tags, will run.\n\nTo tag a test with a `release` tag, add `# bats test_tags=release` above the `@test` line in your bats file:\n\n```bash\n# bats test_tags=release\n@test \"install from release\" {\n  ...\n  \u003crun your test here\u003e\n  ...\n}\n```\n\nThis setup keeps release-specific tests out of everyday workflows unless you set a custom `test_command`.\n\nFor 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).\n\n\n\n## License\n\n[Apache](LICENSE)\n\n## Contribute\n\nAnyone is welcome to submit a pull request to this repository.\n\nFor more details on development processes, please read the [developer guide](./docs/DEVELOPER.md).\n\n**Contributed and maintained by [julienloizelet](https://github.com/julienloizelet)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddev%2Fgithub-action-add-on-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddev%2Fgithub-action-add-on-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddev%2Fgithub-action-add-on-test/lists"}