Skip to content

Commit

Permalink
ci: use github action for bulk of github test (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay authored Sep 17, 2023
1 parent 23447ca commit 8c39807
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 67 deletions.
69 changes: 8 additions & 61 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,73 +19,20 @@ on:
permissions:
contents: write

defaults:
run:
shell: bash

env:
# NIGHTLY_DDEV_PR_URL: "https://nightly.link/ddev/ddev/actions/runs/1720215802/ddev-linux-amd64.zip"
# Allow ddev get to use a github token to prevent rate limiting by tests
DDEV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Allow `--HEAD` flag when running tests against HEAD

jobs:
tests:
defaults:
run:
shell: bash

strategy:
matrix:
ddev_version: [stable, HEAD]
# ddev_version: [stable, edge, HEAD, PR]
fail-fast: false

runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Environment setup
run: |
brew install bats-core mkcert
mkcert -install
- name: Use ddev stable
if: matrix.ddev_version == 'stable'
run: brew install ddev/ddev/ddev

- name: Use ddev edge
if: matrix.ddev_version == 'edge'
run: brew install ddev/ddev-edge/ddev

- name: Use ddev HEAD
if: matrix.ddev_version == 'HEAD'
run: brew install --HEAD ddev/ddev/ddev

- name: Use ddev PR
if: matrix.ddev_version == 'PR'
run: |
curl -sSL -o ddev_linux.zip ${NIGHTLY_DDEV_PR_URL}
unzip ddev_linux.zip
mv ddev /usr/local/bin/ddev && chmod +x /usr/local/bin/ddev
- name: Download docker images
run: mkdir junk && pushd junk && ddev config --auto && ddev debug download-images >/dev/null

- name: tmate debugging session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
github-token: ${{ secrets.GITHUB_TOKEN }}
if: github.event.inputs.debug_enabled == 'true'

- name: tests
run: bats tests

# 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
if: matrix.ddev_version == 'stable'
- uses: ddev/github-action-add-on-test@v1
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 }}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

This repository is a template for providing [DDEV](https://ddev.readthedocs.io) add-ons and services.

In DDEV addons can be installed from the command line using the `ddev get` command, for example, `ddev get ddev/ddev-addon-template` or `ddev get ddev/ddev-drupal9-solr`.
In DDEV addons can be installed from the command line using the `ddev get` command, for example, `ddev get ddev/ddev-redis` or `ddev get ddev/ddev-solr`.

A repository like this one is the way to get started. You can create a new repo from this one by clicking the template button in the top right corner of the page.
This repository is a quick way to get started. You can create a new repo from this one by clicking the template button in the top right corner of the page.

![template button](images/template-button.png)

Expand Down Expand Up @@ -41,13 +41,14 @@ A repository like this one is the way to get started. You can create a new repo
8. Create a release on GitHub.
9. Test manually with `ddev get <owner/repo>`.
10. You can test PRs with `ddev get https://github.com/<user>/<repo>/tarball/<branch>`
11. Update the README.md to describe the add-on, how to use it, and how to contribute. If there are any manual actions that have to be taken, please explain them. If it requires special configuration of the using project, please explain how to do those. Examples in [ddev/ddev-drupal9-solr](https://github.com/ddev/ddev-drupal9-solr), [ddev/ddev-memcached](github.com/ddev/ddev-memcached), and [ddev/ddev-beanstalkd](https://github.com/ddev/ddev-beanstalkd).
11. Update the README.md to describe the add-on, how to use it, and how to contribute. If there are any manual actions that have to be taken, please explain them. If it requires special configuration of the using project, please explain how to do those. Examples in [ddev/ddev-solr](https://github.com/ddev/ddev-solr), [ddev/ddev-memcached](github.com/ddev/ddev-memcached), and (advanced) [ddev-platformsh](https://github.com/ddev/ddev-platformsh).
12. Add a good short description to your repo, and add the label "ddev-get". It will immediately be added to the list provided by `ddev get --list --all`.
13. When it has matured you will hopefully want to have it become an "official" maintained add-on. Open an issue in the [ddev queue](https://github.com/ddev/ddev/issues) for that.

Note that more advanced techniques are discussed in [DDEV docs](https://ddev.readthedocs.io/en/latest/users/extend/additional-services/#additional-service-configurations-and-add-ons-for-ddev).

## How to debug in Github Actions
## How to debug tests (Github Actions)

1. You need a SSH-key registered with Github. You either pick the key you already authenticate with `github.com` or you create a dedicated new one with `ssh-keygen -t ed25519 -a 64 -f tmate_ed25519 -C "$(date +'%d-%m-%Y')"` and add it at `https://github.com/settings/keys`.

2. Add the following snippet to `~/.ssh/config`
Expand Down Expand Up @@ -86,6 +87,5 @@ Host *.tmate.io

For a more detailed documentation about `tmate` see [Debug your GitHubActions by using tmate](https://mxschmitt.github.io/action-tmate/)

**Contributed and maintained by [@CONTRIBUTOR](https://github.com/CONTRIBUTOR) based on the original [ddev-contrib recipe](https://github.com/ddev/ddev-contrib/tree/master/docker-compose-services/RECIPE) by [@CONTRIBUTOR](https://github.com/CONTRIBUTOR)**

**Originally Contributed by [somebody](https://github.com/somebody) in <https://github.com/ddev/ddev-contrib/>
**Contributed and maintained by [@CONTRIBUTOR](https://github.com/CONTRIBUTOR)**

0 comments on commit 8c39807

Please sign in to comment.