-
Notifications
You must be signed in to change notification settings - Fork 17
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
Migrate Travis jobs to GitHub actions #317
base: develop
Are you sure you want to change the base?
Changes from all commits
3e077c7
5fe3375
0b2efe1
8e9ad2e
c5a3bd0
ce454aa
3d4edb1
61f908a
3a6314a
4833fb5
4e7b4d8
1abd9f9
82163aa
a01e1b5
34a6421
15448c3
1854e26
8e47209
43a5a68
35ecf95
46692d4
dc3d12b
1c7ec0c
f86cf1a
a7b0177
8c89a8d
99e4ccc
3c04a2c
562330d
19e7ffe
b6edb9d
47aac99
c598f5c
5837bef
996fdf7
06a38fe
9419bb7
85f5546
7446d7e
457b7b6
215ea21
2274d05
a4c9e64
170a36d
a2e385b
afc356e
0efe1fb
68a18aa
7e53fa8
a1a9265
9427cff
36ff513
103a5cf
85e140f
5c4bca8
57fabc3
356f9b7
1a0dc21
26ee81c
937b8f3
ba014fd
ba2388c
489b4d8
f444c96
f7aecfb
65e169e
ffd2b2a
17775d6
43a092e
ab337ee
e9f2c58
b4bf2c6
5a7cb83
9484070
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
service_name: travis-ci | ||
coverage_clover: build/logs/clover.xml | ||
json_path: build/logs/coveralls-upload.json | ||
coverage_clover: tests/coverage/clover.xml | ||
json_path: tests/coverage/coveralls-upload.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
name: Coding Standards and Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be main or include main |
||
- develop | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: "Coding Standards" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: "14" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run coding standards check | ||
run: npm run lint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can pipe lint results into cs2pr. This will highlight the line errors. Here is an example. |
||
|
||
test-e2e: | ||
needs: [lint] | ||
name: "E2E tests (PHP 7.4, WordPress latest, with code coverage)" | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
NODE_ENV: e2e | ||
WP_VERSION: 5.7 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this hardcoded to 5.7? Travis just uses latest |
||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: hmarr/debug-action@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: "14" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dont we need to composer install as well here? |
||
- name: Build assets | ||
run: npm run build:js | ||
|
||
- name: Start docker local env | ||
run: npm run env:start | ||
|
||
- name: Install WordPress | ||
run: | | ||
npm run wp -- wp core install --title=WordPress --admin_user=admin --admin_password=password [email protected] --skip-email --url=http://localhost:8088 --quiet | ||
npm run wp -- wp plugin activate foo-bar | ||
|
||
- name: Run E2E tests with coverage | ||
run: npm run test:e2e:coverage | ||
|
||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: ./tests/coverage/e2e/lcov.info | ||
flag-name: "E2E Tests" | ||
parallel: true | ||
|
||
test-js: | ||
needs: [lint] | ||
name: "JS unit tests (with code coverage)" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: "14" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run JS tests | ||
run: npm run test:js:coverage | ||
|
||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: ./tests/coverage/js/lcov.info | ||
flag-name: "JS Unit Tests" | ||
parallel: true | ||
|
||
test-php: | ||
needs: [lint] | ||
name: "PHP tests (PHP ${{ matrix.php_versions }}, WordPress ${{ matrix.wp_versions }})" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php_versions: [7.4, 7.3, 7.2, 7.1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add PHP 8 here. |
||
wp_versions: ["latest"] | ||
os: [ubuntu-latest] | ||
include: | ||
- php_versions: 7.4 | ||
wp_versions: "trunk" | ||
os: ubuntu-latest | ||
|
||
- php_versions: "7.0" | ||
wp_versions: "latest" | ||
os: ubuntu-18.04 # Use ubuntu-18.4 which has MySQL 5.7 for back-compat < PHP7.0 | ||
|
||
- php_versions: 5.6.20 | ||
wp_versions: "latest" | ||
os: ubuntu-18.04 | ||
|
||
- php_versions: 5.6.20 | ||
wp_versions: "5.0" | ||
os: ubuntu-18.04 | ||
|
||
env: | ||
WP_VERSION: ${{ matrix.wp_versions }} | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_PARALLEL: true | ||
COVERALLS: ${{ matrix.php_versions == 7.4 && matrix.wp_versions == 'latest' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup PHP ${{ matrix.php_versions }} | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php_versions }} | ||
tools: phpunit | ||
|
||
- name: Start MySQL | ||
run: | | ||
sudo systemctl enable mysql.service | ||
sudo systemctl start mysql.service | ||
|
||
- name: Install dependencies | ||
run: composer install | ||
|
||
- name: Install and Run tests | ||
if: ${{ matrix.php_versions == '7.0' || matrix.php_versions == '5.6.20' }} | ||
run: | | ||
wget -O bin/phpunit https://phar.phpunit.de/phpunit-5.phar | ||
chmod +x bin/phpunit | ||
source bin/php-tests.sh wordpress_test root root localhost false bin/phpunit | ||
Comment on lines
+142
to
+147
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can install via composer. |
||
|
||
- name: Install and Run tests | ||
if: ${{ matrix.php_versions != '7.0' && matrix.php_versions != '5.6.20' }} | ||
run: source bin/php-tests.sh wordpress_test root root localhost | ||
|
||
finish: | ||
needs: [test-e2e, test-js, test-php] | ||
name: Finish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Coveralls Finished | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.github_token }} | ||
parallel-finished: true |
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.
I think it is cleaner to have this as different workflows in different files.
A good example of this would this project - https://github.com/google/web-stories-wp/tree/main/.github/workflows
I would break into following files.