|
| 1 | +name: 'Tests' |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | +jobs: |
| 5 | + test: |
| 6 | + strategy: |
| 7 | + matrix: |
| 8 | + suite: |
| 9 | + - wpunit |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout the repository |
| 13 | + uses: actions/checkout@v4 |
| 14 | + # ------------------------------------------------------------------------------ |
| 15 | + # Set up PHP to run slic |
| 16 | + # ------------------------------------------------------------------------------ |
| 17 | + - name: Configure PHP environment |
| 18 | + uses: shivammathur/setup-php@v2 |
| 19 | + with: |
| 20 | + php-version: 7.4 |
| 21 | + # ------------------------------------------------------------------------------ |
| 22 | + # Checkout slic |
| 23 | + # ------------------------------------------------------------------------------ |
| 24 | + - name: Checkout slic |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + repository: stellarwp/slic |
| 28 | + ref: main |
| 29 | + path: slic |
| 30 | + fetch-depth: 1 |
| 31 | + # ------------------------------------------------------------------------------ |
| 32 | + # Prepare our composer cache directory |
| 33 | + # ------------------------------------------------------------------------------ |
| 34 | + - name: Get Composer Cache Directory |
| 35 | + id: get-composer-cache-dir |
| 36 | + run: | |
| 37 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 38 | + - uses: actions/cache@v4 |
| 39 | + id: composer-cache |
| 40 | + with: |
| 41 | + path: ${{ steps.get-composer-cache-dir.outputs.dir }} |
| 42 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 43 | + restore-keys: | |
| 44 | + ${{ runner.os }}-composer- |
| 45 | + # ------------------------------------------------------------------------------ |
| 46 | + # Initialize slic |
| 47 | + # ------------------------------------------------------------------------------ |
| 48 | + - name: Set up slic env vars |
| 49 | + run: | |
| 50 | + echo "SLIC_BIN=${GITHUB_WORKSPACE}/slic/slic" >> $GITHUB_ENV |
| 51 | + echo "SLIC_WP_DIR=${GITHUB_WORKSPACE}/slic/_wordpress" >> $GITHUB_ENV |
| 52 | + echo "SLIC_WORDPRESS_DOCKERFILE=Dockerfile.base" >> $GITHUB_ENV |
| 53 | + - name: Set run context for slic |
| 54 | + run: echo "SLIC=1" >> $GITHUB_ENV && echo "CI=1" >> $GITHUB_ENV |
| 55 | + - name: Start ssh-agent |
| 56 | + run: | |
| 57 | + mkdir -p "${HOME}/.ssh"; |
| 58 | + ssh-agent -a /tmp/ssh_agent.sock; |
| 59 | + - name: Export SSH_AUTH_SOCK env var |
| 60 | + run: echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV |
| 61 | + - name: Set up slic for CI |
| 62 | + run: | |
| 63 | + cd ${GITHUB_WORKSPACE}/.. |
| 64 | + ${SLIC_BIN} here |
| 65 | + ${SLIC_BIN} interactive off |
| 66 | + ${SLIC_BIN} build-prompt off |
| 67 | + ${SLIC_BIN} build-subdir off |
| 68 | + ${SLIC_BIN} xdebug off |
| 69 | + ${SLIC_BIN} debug on |
| 70 | + ${SLIC_BIN} info |
| 71 | + ${SLIC_BIN} config |
| 72 | + - name: Start the Chrome container |
| 73 | + run: ${SLIC_BIN} up chrome |
| 74 | + - name: Set up StellarWP Schema Models |
| 75 | + run: | |
| 76 | + ${SLIC_BIN} use schema-models |
| 77 | + ${SLIC_BIN} composer install |
| 78 | + - name: Init the WordPress container |
| 79 | + run: | |
| 80 | + ${SLIC_BIN} up wordpress |
| 81 | + ${SLIC_BIN} wp core version |
| 82 | + ${SLIC_BIN} wp core update --force --version=6.7 |
| 83 | + ${SLIC_BIN} wp core version |
| 84 | + - name: Ensure Kadence is installed |
| 85 | + run: | |
| 86 | + ${SLIC_BIN} wp theme install kadence --activate |
| 87 | + - name: Run suites |
| 88 | + run: ${SLIC_BIN} run ${{ matrix.suite }} --ext DotReporter |
0 commit comments