Commits
Tim Donohue authored 6d1d446c0d2
25 25 | strategy |
26 26 | # Create a matrix of Node versions to test against (in parallel) |
27 27 | matrix |
28 28 | node-version 14.x 16.x |
29 29 | # Do NOT exit immediately if one matrix job fails |
30 30 | fail-fast false |
31 31 | # These are the actual CI steps to perform per job |
32 32 | steps |
33 33 | # https://github.com/actions/checkout |
34 34 | name Checkout codebase |
35 - | uses actions/checkout@v2 |
35 + | uses actions/checkout@v3 |
36 36 | |
37 37 | # https://github.com/actions/setup-node |
38 38 | name Install Node.js $ matrix.node-version |
39 - | uses actions/setup-node@v2 |
39 + | uses actions/setup-node@v3 |
40 40 | with |
41 41 | node-version $ matrix.node-version |
42 42 | |
43 43 | # If CHROME_VERSION env variable specified above, then pin to that version. |
44 44 | # Otherwise, just install latest version of Chrome. |
45 45 | name Install Chrome (for e2e tests) |
46 46 | run |
47 47 | if [[ -z "${CHROME_VERSION}" ]] |
48 48 | then |
49 49 | echo "Installing latest stable version" |
54 54 | wget -q "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb" |
55 55 | sudo dpkg -i "google-chrome-stable_${CHROME_VERSION}_amd64.deb" |
56 56 | fi |
57 57 | google-chrome --version |
58 58 | |
59 59 | # https://github.com/actions/cache/blob/main/examples.md#node---yarn |
60 60 | name Get Yarn cache directory |
61 61 | id yarn-cache-dir-path |
62 62 | run echo "::set-output name=dir::$(yarn cache dir)" |
63 63 | name Cache Yarn dependencies |
64 - | uses actions/cache@v2 |
64 + | uses actions/cache@v3 |
65 65 | with |
66 66 | # Cache entire Yarn cache directory (see previous step) |
67 67 | path $ steps.yarn-cache-dir-path.outputs.dir |
68 68 | # Cache key is hash of yarn.lock. Therefore changes to yarn.lock will invalidate cache |
69 69 | key $ runner.os -yarn-$ hashFiles('**/yarn.lock') |
70 70 | restore-keys $ runner.os -yarn- |
71 71 | |
72 72 | name Install Yarn dependencies |
73 73 | run yarn install --frozen-lockfile |
74 74 | |
81 81 | name Run build |
82 82 | run yarn run build prod |
83 83 | |
84 84 | name Run specs (unit tests) |
85 85 | run yarn run test headless |
86 86 | |
87 87 | # NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286 |
88 88 | # Upload coverage reports to Codecov (for one version of Node only) |
89 89 | # https://github.com/codecov/codecov-action |
90 90 | name Upload coverage to Codecov.io |
91 - | uses codecov/codecov-action@v2 |
91 + | uses codecov/codecov-action@v3 |
92 92 | if matrix.node-version == '16.x' |
93 93 | |
94 94 | # Using docker-compose start backend using CI configuration |
95 95 | # and load assetstore from a cached copy |
96 96 | name Start DSpace REST Backend via Docker (for e2e tests) |
97 97 | run |
98 98 | docker-compose -f ./docker/docker-compose-ci.yml up -d |
99 99 | docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli |
100 100 | docker container ls |
101 101 | |
102 102 | # Run integration tests via Cypress.io |
103 103 | # https://github.com/cypress-io/github-action |
104 104 | # (NOTE: to run these e2e tests locally, just use 'ng e2e') |
105 105 | name Run e2e tests (integration tests) |
106 - | uses cypress-io/github-action@v2 |
106 + | uses cypress-io/github-action@v4 |
107 107 | with |
108 108 | # Run tests in Chrome, headless mode |
109 109 | browser chrome |
110 110 | headless true |
111 111 | # Start app before running tests (will be stopped automatically after tests finish) |
112 112 | start yarn run serve ssr |
113 113 | # Wait for backend & frontend to be available |
114 114 | # NOTE: We use the 'sites' REST endpoint to also ensure the database is ready |
115 115 | wait-on http //localhost 8080/server/api/core/sites, http //localhost4000 |
116 116 | # Wait for 2 mins max for everything to respond |
117 117 | wait-on-timeout 120 |
118 118 | |
119 119 | # Cypress always creates a video of all e2e tests (whether they succeeded or failed) |
120 120 | # Save those in an Artifact |
121 121 | name Upload e2e test videos to Artifacts |
122 - | uses actions/upload-artifact@v2 |
122 + | uses actions/upload-artifact@v3 |
123 123 | if always() |
124 124 | with |
125 125 | name e2e-test-videos |
126 126 | path cypress/videos |
127 127 | |
128 128 | # If e2e tests fail, Cypress creates a screenshot of what happened |
129 129 | # Save those in an Artifact |
130 130 | name Upload e2e test failure screenshots to Artifacts |
131 - | uses actions/upload-artifact@v2 |
131 + | uses actions/upload-artifact@v3 |
132 132 | if failure() |
133 133 | with |
134 134 | name e2e-test-screenshots |
135 135 | path cypress/screenshots |
136 136 | |
137 137 | name Stop app (in case it stays up after e2e tests) |
138 138 | run |
139 139 | app_pid=$(lsof -t -i:4000) |
140 140 | if [[ ! -z $app_pid ]]; then |
141 141 | echo "App was still up! (PID: $app_pid)" |