chore(ci): create a workflow file for uploading the plugin package as artifact #115
Workflow file for this run
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: Test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
name: PHP ${{ matrix.php-version }} / WP ${{ matrix.wp-version }} | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
php-version: ['7.4', '8.0', '8.1', '8.2'] | |
wp-version: ['6.4.3', '6.3.5', '6.2.4'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker-container | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ matrix.php-version }}-${{ hashFiles('tests/Dockerfile') }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ matrix.php-version }}- | |
${{ runner.os }}-buildx- | |
- name: Build and run tests | |
id: phpunit | |
shell: bash | |
run: | | |
docker buildx build \ | |
--file tests/Dockerfile \ | |
--build-arg PHP_VERSION=${{ matrix.php-version }} \ | |
--cache-from type=local,src=/tmp/.buildx-cache \ | |
--cache-to type=local,dest=/tmp/.buildx-cache,mode=max \ | |
--load \ | |
-t wordpress-test . | |
WP_VERSION=${{ matrix.wp-version }} docker compose run --rm wordpress-test sh -c "composer install && ./vendor/bin/phpunit" |