-
Notifications
You must be signed in to change notification settings - Fork 65
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
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9d18725
First attempt to use GitHub Actions.
desrosj ec86ffa
Use correct names. Don't run on push for PRs.
desrosj 3358d55
generate `.ssh` folder if not existent
pfefferle d551cae
re-add travis file
pfefferle 66ced63
add scheduler example
pfefferle cb4576c
add env vars as example
pfefferle c2fe22c
Add `continue-on-error: true` for phpunit
pfefferle 9972040
Add some doc
pfefferle 6080a4e
change caching
pfefferle 1631b97
Revert "change caching"
pfefferle cdbe3f5
Use GHA native `concurrency` to cancel duplicate workflow runs.
desrosj aabc6d4
Use caching built into `actions/setup-node`.
desrosj a47082b
Use commit SHAs for third-party actions.
desrosj dcc7b2b
Improve documentation.
desrosj eddcad5
Change the `schedule` example to match the suggestions on https://mak…
desrosj ec143fa
More documentation improvements.
desrosj 7c72203
Remove Remove `push` and `pull_request` events.
desrosj 01652cb
Add a condition to disable the workflow.
desrosj bc5bd6d
Remove `npm` caching from the example GHA workflow.
desrosj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
# To run the action on a schedule, you can also add a scheduler | ||
# | ||
# "*"" is a special character in YAML so you have to quote this string | ||
# | ||
# schedule: | ||
# - cron: '0 * * * *' | ||
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 | ||
|
||
env: | ||
# This is only a subset/example of env vars, see the `.env.default` file for the full list. | ||
WPT_PREPARE_DIR: ${{ secrets.WPT_PREPARE_DIR }} | ||
WPT_TEST_DIR: ${{ secrets.WPT_TEST_DIR }} | ||
WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }} | ||
WPT_PHP_EXECUTABLE: ${{ secrets.WPT_PHP_EXECUTABLE }} | ||
# db settings | ||
WPT_DB_NAME: ${{ secrets.WPT_DB_NAME }} | ||
WPT_DB_USER: ${{ secrets.WPT_DB_USER }} | ||
WPT_DB_PASSWORD: ${{ secrets.WPT_DB_PASSWORD }} | ||
WPT_DB_HOST: ${{ secrets.WPT_DB_HOST }} | ||
# ssh settings | ||
WPT_SSH_CONNECT: ${{ secrets.WPT_SSH_CONNECT }} | ||
WPT_SSH_PRIVATE_KEY_BASE64: ${{ secrets.WPT_SSH_PRIVATE_KEY_BASE64 }} | ||
|
||
steps: | ||
- name: Cancel previous runs of this workflow (pull requests only) | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: styfle/[email protected] | ||
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 | ||
# Prevent GitHub Action to discontinue if PHPUnit runs into errors | ||
continue-on-error: true | ||
|
||
- name: Report tests | ||
run: php report.php | ||
|
||
- name: Cleanup | ||
run: php cleanup.php |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.