Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to GitHub Actions #143

Merged
merged 19 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test

on:
push:
branches:
- master
pull_request:

jobs:
# Tests the PHPUnit test runner.
#
# Performs the following steps:
# - Cancels all previous workflow runs for pull requests that have not completed.
# - Checks out the repository.
# - Installs PHP.
# - Installs NodeJS 14.
# - Sets up caching for NPM.
# - Prepares the environment for tests.
# - Runs the tests.
# - Reports the results.
# - Cleans up.
test:
name: Test the runner
runs-on: ubuntu-latest

steps:
- name: Cancel previous runs of this workflow (pull requests only)
if: ${{ github.event_name == 'pull_request' }}
uses: styfle/cancel-workflow-action@0.8.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 3rd party actions, using version numbers and ranges is OK, but there are some tradeoffs. The Security hardening page in the GHA docs details these.

In Gutenberg and WordPress Core, we have adopted the pattern of using the full length commit SHA followed by an inline # v0.8.0 comment.

with:
access_token: ${{ github.token }}

- name: Checkout repository
uses: actions/checkout@v2

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none

- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: 14

pfefferle marked this conversation as resolved.
Show resolved Hide resolved
- name: Cache NodeJS modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-

- name: Prepare step
run: php prepare.php

- name: Run tests
run: php test.php

- name: Report tests
run: php report.php

- name: Cleanup
run: php cleanup.php
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.