Improve PDF Preview Support #1591
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: End-to-end Tests | |
on: | |
pull_request: | |
# Cancels all previous workflow runs for pull requests that have not completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name for pull requests | |
# or the commit hash for any other events. | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
cancel-in-progress: true | |
env: | |
GF_LICENSE: ${{ secrets.GF_LICENSE }} | |
jobs: | |
# Runs the end-to-end test suite. | |
# | |
# Performs the following steps: | |
# - Cancels all previous workflow runs for pull requests that have not completed. | |
# - Set environment variables. | |
# - Checks out the repository. | |
# - Logs debug information about the runner container. | |
# - Installs NodeJS 1 | |
# - Sets up caching for NPM. | |
# _ Installs NPM dependencies using install-changed to hash the `package.json` file. | |
# - Builds WordPress to run from the `build` directory. | |
# - Starts the WordPress Docker container. | |
# - Logs general debug information. | |
# - Logs the running Docker containers. | |
# - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container). | |
# - Install WordPress within the Docker container. | |
# - Run the E2E tests. | |
e2e-tests: | |
name: E2E Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure environment variables | |
run: | | |
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV | |
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Docs: https://github.com/shivammathur/setup-php | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node JS | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Log debug information | |
run: | | |
npm --version | |
yarn --version | |
node --version | |
curl --version | |
git --version | |
svn --version | |
php --version | |
php -i | |
locale -a | |
- name: Install Dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn install | |
- name: Build Gravity PDF | |
run: yarn build:production | |
- name: Install / Setup Gravity PDF + WordPress | |
run: | | |
yarn env:install | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run E2E tests | |
run: yarn test:e2e:headless --stop-on-first-fail | |
- name: Dump log files on failure | |
if: failure() | |
run: | | |
npm run wp-env run tests-wordpress "cp -r /var/www/html/wp-content/uploads/gravity_forms/logs/ /var/www/html/wp-content/plugins/gravity-pdf/tmp/" | |
mv tmp screenshots/tmp | |
- name: Upload artifacts on failure | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: my-artifact | |
path: screenshots/ |