Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,29 @@ jobs:

steps:
- uses: ddev/github-action-add-on-test@v2
env:
# Ensure that browser_output, junit, Nightwatch report are available as artifacts.
SKIP_CLEANUP: "true"
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 }}

- name: Archive browser_output
# 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/web/core/reports/nightwatch" ]; then
(cd "$d/web/core/reports" && zip -r nightwatch.zip nightwatch)
fi
done

- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: browser_output
name: artifact-${{ matrix.ddev_version }}
path: |
web/sites/simpletest/browser_output

- name: Archive junits
uses: actions/upload-artifact@v4
with:
name: junits
path: |
*.junit.xml

- name: Nightwatch reports
uses: actions/upload-artifact@v4
with:
name: nightwatch
path: |
web/core/reports/nightwatch
${{ env.TESTDIR }}*/web/sites/simpletest/browser_output
${{ env.TESTDIR }}*/web/*.junit.xml
${{ env.TESTDIR }}*/web/core/reports/nightwatch.zip
9 changes: 7 additions & 2 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ setup() {

export DIR="$(cd "$(dirname "${BATS_TEST_FILENAME}")/.." >/dev/null 2>&1 && pwd)"
export PROJNAME="test-$(basename "${GITHUB_REPO}")"
export SKIP_CLEANUP=1
mkdir -p ~/tmp
export TESTDIR=$(mktemp -d ~/tmp/${PROJNAME}.XXXXXX)
export DDEV_NONINTERACTIVE=true
Expand Down Expand Up @@ -90,7 +89,13 @@ health_checks() {
teardown() {
set -eu -o pipefail
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1
[ ! -z "${SKIP_CLEANUP}" ] || ( [ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} )
# Persist TESTDIR if running inside GitHub Actions. Useful for uploading test result artifacts
# See example at https://github.com/ddev/github-action-add-on-test#preserving-artifacts
if [ -n "${GITHUB_ENV:-}" ]; then
[ -e "${GITHUB_ENV:-}" ] && echo "TESTDIR=${HOME}/tmp/${PROJNAME}" >> "${GITHUB_ENV}"
else
[ "${TESTDIR}" != "" ] && rm -rf "${TESTDIR}"
fi
}

@test "install from directory" {
Expand Down