Skip to content

Fix composer platform declaration #22

Fix composer platform declaration

Fix composer platform declaration #22

Workflow file for this run

name: 'CI'
on:
push:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# Update this as WordPress releases new backward patches: https://wordpress.org/download/releases/
# Currently supporting two releases back.
wordpress:
- latest
php:
- '7.4'
name: "Tests: WP ${{ matrix.wordpress }} / PHP ${{ matrix.php }}"
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 1000
submodules: recursive
# ------------------------------------------------------------------------------
# Checkout slic
# ------------------------------------------------------------------------------
- name: Checkout slic
uses: actions/checkout@v4
with:
repository: stellarwp/slic
ref: main
path: slic
fetch-depth: 1
# ------------------------------------------------------------------------------
# Prepare our composer cache directory
# ------------------------------------------------------------------------------
- name: Get Composer Cache Directory
id: get-composer-cache-dir
run: |
echo "DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: composer-cache
with:
path: ${{ steps.get-composer-cache-dir.outputs.DIR }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ matrix.php }}-composer-
# ------------------------------------------------------------------------------
# Initialize slic
# ------------------------------------------------------------------------------
- name: Set up slic env vars
run: |
echo "SLIC_BIN=${GITHUB_WORKSPACE}/slic/slic" >> $GITHUB_ENV
echo "SLIC_WP_DIR=${GITHUB_WORKSPACE}/slic/_wordpress" >> $GITHUB_ENV
echo "SLIC_WORDPRESS_DOCKERFILE=Dockerfile.base" >> $GITHUB_ENV
- name: Set run context for slic
run: echo "SLIC=1" >> $GITHUB_ENV && echo "CI=1" >> $GITHUB_ENV
- name: Start ssh-agent
run: |
mkdir -p "${HOME}/.ssh";
ssh-agent -a /tmp/ssh_agent.sock;
- name: Export SSH_AUTH_SOCK env var
run: echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV
- name: Set up slic for CI
run: |
cd ${GITHUB_WORKSPACE}/..
${SLIC_BIN} here
${SLIC_BIN} interactive off
${SLIC_BIN} build-prompt off
${SLIC_BIN} build-subdir off
${SLIC_BIN} xdebug off
${SLIC_BIN} debug on
${SLIC_BIN} php-version set ${{ matrix.php }} --skip-rebuild
${SLIC_BIN} composer-cache set ${{ steps.get-composer-cache-dir.outputs.DIR }}
${SLIC_BIN} info
${SLIC_BIN} config
- name: Install specific WordPress version ${{ matrix.wordpress }}
run: |
${SLIC_BIN} wp core download --version=${{ matrix.wordpress }} --force
- name: Show WordPress version
run: ${SLIC_BIN} wp core version
- name: Update installed WordPress themes
run: ${SLIC_BIN} wp theme update --all
- name: Set up StellarWP SuperGlobals
run: |
${SLIC_BIN} use superglobals
${SLIC_BIN} composer set-version 2
${SLIC_BIN} composer validate
${SLIC_BIN} composer install
- name: Run wpunit tests
run: ${SLIC_BIN} run wpunit --ext DotReporter