Skip to content

Commit 4d4a729

Browse files
Update testing dev docs to GitHub Actions (#1251)
1 parent 48c9b29 commit 4d4a729

14 files changed

+33
-29
lines changed

dev/testing/en/continuous-integration.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ title: Continuous Integration - Testing - OJS/OMP
44

55
# Continuous Integration
66

7-
We use [Travis CI](https://travis-ci.com) for Continuous Integration (CI) testing. Integration and unit tests are run against every commit and pull request to help catch regressions before they are released.
7+
We use [GitHub Actions](https://github.com/features/actions) for Continuous Integration (CI) testing. Integration and unit tests are run against every pull request to help catch regressions before they are released.
88

9-
CI tests are configured to run the tests against multiple PHP versions and databases. The configuration details are stored in the `.travis.yml` file in the application's root directory.
9+
CI tests are configured to run the tests against multiple PHP versions and databases. The configuration details are stored in `.github/workflows/main.yml` for each application.
1010

11-
![OJS test results in Travis.](./travis-overview.png)
11+
![OMP test results in GitHub.](./github-actions-overview.png)
1212

13-
View the tests for [OJS](https://travis-ci.com/pkp/ojs/), [OMP](https://travis-ci.com/pkp/omp/) and [OPS](https://travis-ci.com/pkp/ops/).
13+
View the tests for [OJS](https://github.com/pkp/ojs/actions), [OMP](https://github.com/pkp/omp/actions) and [OPS](https://github.com/pkp/ops/actions).
1414

1515
## Tests for pull requests
1616

17-
Travis will run tests against every pull request to OJS or OMP. The tests are listed in the checks at the bottom of the pull request.
17+
GitHub Actions will run tests against every pull request to OJS, OMP, or OPS. The tests are listed in the checks at the bottom of the pull request.
1818

19-
![A Travis check in the pull request.](./travis-pr.png)
19+
![A list of checks in a pull request.](./github-pr.png)
2020

21-
Click the **Details** link beside the Travis tests to watch the tests as they run and see which tests have passed or failed. All tests must pass before a pull request will be merged.
21+
Click the **Details** link beside a test to watch the test as it runs and see which tests have passed or failed. All tests must pass before a pull request will be merged.
2222

2323
### Prepare pull requests for testing
2424

25-
A single change to an application may involve pull requests to more than one repository. For example, a change that impacts `pkp-lib` and `ojs` will require two pull requests.
25+
A change to an application may involve pull requests to more than one repository. For example, a change that impacts `pkp-lib` and `ojs` will require two pull requests.
2626

27-
Travis must be able to locate the correct repository and branch for the `pkp-lib` submodule in order to run the tests against the correct code. To do this, an extra commit with a special commit message, `Submodule update ##<username>/<branch>##`, is added to the application repository.
27+
GitHub Actions must be able to locate the correct repository and branch for the `pkp-lib` submodule in order to run the tests against the correct code. To do this, an extra commit with a special commit message, `Submodule update ##<username>/<branch>##`, is added to the application repository.
2828

29-
The example below will instruct Travis to clone the `ojs` and `pkp-lib` repositories owned by `NateWr` and check out the `i123_example` branch.
29+
The example below will instruct GitHub Actions to clone the `ojs` and `pkp-lib` repositories owned by `NateWr` and check out the `i123_example` branch.
3030

3131
```
3232
cd path/to/ojs

dev/testing/en/debug.md

+10-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Debug Test Failures - Testing - OJS/OMP
44

55
# Debug Test Failures
66

7-
When a test fails it means that a recent change has broken the application. The log files for the tests will will indicate which tests failed and will list all of the commands that were run before the failure occurred.
7+
When a test fails it means that a recent change has broken the application. The log files for the tests will indicate which tests failed and will list all of the commands that were run before the failure occurred.
88

99
In most cases, the server's error log will contain important clues about what went wrong.
1010

@@ -16,40 +16,36 @@ When the tests are run from the terminal you will find a screenshot of the brows
1616

1717
## Debug CI
1818

19-
The [CI tests](./continuous-integration) can be difficult to debug. Travis provides access to its build logs and screenshots of test failures to help.
19+
The [CI tests](./continuous-integration) can be difficult to debug. GitHub provides access to its build logs and artifacts produced by tests to help. Click **Checks** on a pull request to see the logs from the tests.
2020

2121
<figure class="video_container">
2222
<video controls="true" allowfullscreen="true">
23-
<source src="./travis-log.mp4" type="video/mp4">
23+
<source src="./github-log.mp4" type="video/mp4">
2424
</video>
25-
<figcaption>Short video showing how to access log of build results.</figcaption>
25+
<figcaption>Short video showing how to access the log of build results.</figcaption>
2626
</figure>
2727

2828
This provides a log of the entire build process including the logs from the Cypress and PHP Unit tests. Parts of the log, such as the server's error log, are truncated and can only be reached by accessing the raw log.
2929

3030
<figure class="video_container">
3131
<video controls="true" allowfullscreen="true">
32-
<source src="./travis-log-raw.mp4" type="video/mp4">
32+
<source src="./github-log-raw.mp4" type="video/mp4">
3333
</video>
3434
<figcaption>Short video showing how to access the raw log of build results.</figcaption>
3535
</figure>
3636

3737
> When viewing the raw log, run a search in your browser for "fatal". This is a quick way to find the source of many -- _but not all_ -- test failures.
3838
{:.tip}
3939

40-
### Travis debug mode
40+
### Artifacts
4141

42-
Travis provides a [debug mode](https://docs.travis-ci.com/user/running-build-in-debug-mode/). When enabled it is possible to log into the Travis environment via SSH and explore the tests manually.
42+
When a test fails, GitHub Actions will create individual artifact downloads that contain screenshots generated by Cypress for each failing test, as well as server logs.
4343

44-
### Screenshots
44+
![GitHub Actions log with an artifact download URL.](./download-artifacts.png)
4545

46-
Screenshots can be accessed by using the uuencode tool on the Travis VM. To extract the screenshots related to a test failure, follow these steps.
46+
Download URLs will also be output in the logs for each failing test near the end of a test run.
4747

48-
- When viewing the test output on Travis, click the "Raw Log" button.
49-
- Save the log to your computer, for example `/tmp/log.txt`.
50-
- Run `cat /tmp/log.txt | uudecode | tar xvz` to extract the screenshots locally.
51-
52-
> If you are struggling to understand a test failure in Travis, it may be best to run the tests locally where you have more insight into the state of the application.
48+
> If you are struggling to understand a test failure, it may be best to run the tests locally where you have more insight into the state of the application.
5349
{:.tip}
5450

5551
---

dev/testing/en/download-artifacts.png

152 KB
Loading

dev/testing/en/getting-started.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We use [Cypress](https://www.cypress.io/) and [PHPUnit](https://phpunit.de/) to
88

99
## Configure your environment
1010

11-
There are many ways to [configure your environment](https://docs.cypress.io/guides/guides/environment-variables.html#Setting) to run the Cypress tests. We recommend creating a `cypress.env.json` file.
11+
There are many ways to [configure your environment](https://docs.cypress.io/guides/guides/environment-variables#Setting) to run the Cypress tests. We recommend creating a `cypress.env.json` file.
1212

1313
```json
1414
{
@@ -31,7 +31,7 @@ The integration tests will install the software and create test data.
3131

3232
## Run integration tests
3333

34-
The integration tests will install the software and run a number of tests to add users, make submissions, record editorial decisions and publish articles.
34+
The integration tests will install the software and run tests to add users, make submissions, record editorial decisions and publish articles.
3535

3636
Before the integration tests are run, update your `config.inc.php` file and set the `installed` flag to `Off`.
3737

@@ -41,7 +41,7 @@ Before the integration tests are run, update your `config.inc.php` file and set
4141
installed = Off
4242
```
4343

44-
Run the following comand in the root directory of the application to start a server. The URL should match the `baseUrl` in `cypress.env.json`.
44+
Run the following command in the root directory of the application to start a server. The URL should match the `baseUrl` in `cypress.env.json`.
4545

4646
```
4747
php -S localhost:8000
110 KB
Loading

dev/testing/en/github-log-raw.mp4

281 KB
Binary file not shown.

dev/testing/en/github-log.mp4

191 KB
Binary file not shown.

dev/testing/en/github-pr.png

109 KB
Loading

dev/testing/en/plugins-themes.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@ title: Plugins and Themes - Testing - OJS/OMP
66

77
Plugins and themes can make use of parts of the application tests to prepare a test environment and run tests. This allows each plugin to implement [continuous integration](./continuous-integration) testing in its own repository.
88

9-
The [Static Pages](https://github.com/pkp/staticPages/) and [Quick Submit](https://github.com/pkp/quickSubmit) plugins and the [Manuscript](https://github.com/pkp/defaultManuscript) theme are configured for testing. The `.travis.yml` file in each repository configures the integration tests. The tests that are run can be found in each repository's `cypress/tests` directory .
9+
The `.github/workflows/main.yml` file in each repository configures the integration tests. Additional plugin-dependent commands that are run during tests may be found in `.github/actions/tests.sh`. The tests that are run can be found in each repository's `cypress/tests` directory.
1010

1111
Plugin and theme tests can be run locally by running the following command in the application's root directory.
1212

1313
```
1414
cd path/to/ojs
1515
npx cypress run --config integrationFolder=plugins/generic/staticPages/cypress/tests
1616
```
17+
18+
## Examples
19+
20+
Examples of plugins that have been configured with tests include:
21+
22+
- [OAI JATS](https://github.com/pkp/oaiJats)
23+
- [Quick Submit](https://github.com/pkp/quickSubmit)
24+
- The [Manuscript theme](https://github.com/pkp/defaultManuscript)

dev/testing/en/travis-log-raw.mp4

-61.2 KB
Binary file not shown.

dev/testing/en/travis-log.mp4

-144 KB
Binary file not shown.

dev/testing/en/travis-overview.png

-103 KB
Binary file not shown.

dev/testing/en/travis-pr.png

-38.9 KB
Binary file not shown.

dev/testing/en/writing-tests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It is often appropriate to add to one of the existing tests rather than create a
1111
> If you are writing a test which checks a particular part of the editorial workflow, it should be put in `cypress/tests/data`. If you are writing a test for something else, such as statistics or journal settings, it should be put in `cypress/tests/integration`.
1212
{:.notice}
1313

14-
Read the Cypress documentation to learn how to write your [first test](https://docs.cypress.io/guides/getting-started/writing-your-first-test.html), [organize tests](https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests.html#Test-Structure), and [interact with buttons and fields](https://docs.cypress.io/guides/core-concepts/interacting-with-elements.html#Actionability).
14+
Read the Cypress documentation to learn how to write your [first test](https://docs.cypress.io/guides/end-to-end-testing/writing-your-first-end-to-end-test), [organize tests](https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests#Test-Structure), and [interact with buttons and fields](https://docs.cypress.io/guides/core-concepts/interacting-with-elements#Actionability).
1515

1616
## Commands
1717

0 commit comments

Comments
 (0)