GP-45362 GP-43955 GP-20469 Skip API4 permission checks, upgrade civix and add CI via GitHub Actions and fix tests #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Run unit tests" | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
pull_request: | |
env: | |
CIVI_CI_CIVICRM: ${{ vars.CIVI_CI_CIVICRM || '["5.69", "master"]' }} | |
CIVI_CI_MYSQL: ${{ vars.CIVI_CI_MYSQL || '["8.0"]' }} | |
CIVI_CI_OS: ${{ vars.CIVI_CI_OS || '["ubuntu-22.04"]' }} | |
CIVI_CI_PHP: ${{ vars.CIVI_CI_PHP || '["7.4", "8.0", "8.1"]' }} | |
CIVI_CI_BUILD_TYPE: ${{ vars.CIVI_CI_BUILD_TYPE || '["drupal-clean"]' }} | |
CIVI_CI_EXCLUDES: ${{ vars.CIVI_CI_EXCLUDES || '' }} | |
jobs: | |
setup-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.setup-matrix.outputs.matrix }} | |
steps: | |
- id: setup-matrix | |
uses: druzsan/setup-matrix@v2 | |
with: | |
matrix: | | |
civicrm: ${{ env.CIVI_CI_CIVICRM }} | |
mysql: ${{ env.CIVI_CI_MYSQL }} | |
os: ${{ env.CIVI_CI_OS }} | |
php: ${{ env.CIVI_CI_PHP }} | |
build-type: ${{ env.CIVI_CI_BUILD_TYPE }} | |
exclude: ${{ env.CIVI_CI_EXCLUDES }} | |
run-tests: | |
needs: setup-matrix | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} | |
runs-on: "${{ matrix.os }}" | |
services: | |
mysql: | |
image: "mysql:${{ matrix.mysql }}" | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | |
ports: | |
- "3306:3306" | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval="10s" | |
--health-timeout="5s" | |
--health-retries="3" | |
steps: | |
- id: clone-repo | |
name: "Clone the repository" | |
uses: "actions/checkout@v4" | |
with: | |
path: "at.greenpeace.mailingwork" | |
- id: build-ci | |
uses: greenpeace-cee/civi-ci@main | |
with: | |
extension: at.greenpeace.mailingwork | |
civicrm: ${{ matrix.civicrm }} | |
php: ${{ matrix.php }} | |
build-type: ${{ matrix.build-type }} | |
- id: install-extension | |
name: "Install Extension" | |
env: | |
EXT_DIR: ${{ steps.build-ci.outputs.ext-dir }} | |
run: | | |
PATH="/home/runner/buildkit/bin:$PATH" | |
cd "$EXT_DIR" | |
cp -R "$GITHUB_WORKSPACE/at.greenpeace.mailingwork" "$EXT_DIR/at.greenpeace.mailingwork" | |
git clone https://github.com/systopia/de.systopia.identitytracker.git "$EXT_DIR/de.systopia.identitytracker" | |
composer install --working-dir="$EXT_DIR/at.greenpeace.mailingwork" | |
cv en at.greenpeace.mailingwork | |
- id: run-tests | |
name: "Run Tests" | |
env: | |
EXT_DIR: ${{ steps.build-ci.outputs.ext-dir }} | |
run: | | |
PATH="/home/runner/buildkit/bin:$PATH" | |
cd "$EXT_DIR/at.greenpeace.mailingwork" | |
CIVICRM_UF="UnitTests" phpunit9 |