|
2 | 2 |
|
3 | 3 | ## 🏋️♀️Let's add this code to our CI system.
|
4 | 4 |
|
5 |
| -1. Create a `charity.ci.yml` file in this folder structure `.github/workflows/` in the root of your directory |
6 |
| -2. Paste in the following configuration |
| 5 | +1. In the repository's Github, go to `Actions` tab |
| 6 | +2. Configure `Node.js` |
| 7 | +3. Keep the name of the file and on line 4, or change, up to you |
| 8 | +4. Paste in the following configuration |
7 | 9 |
|
8 | 10 | ```yml
|
9 |
| -name: Testing for Charity |
| 11 | +name: Comprehensive Testing |
| 12 | +env: |
| 13 | + SCREENER_API_KEY: ${{ secrets.SCREENER_API_KEY }} |
| 14 | + SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} |
| 15 | + SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} |
10 | 16 |
|
11 | 17 | on:
|
12 | 18 | push:
|
13 |
| - branches: [ main ] |
| 19 | + # Only trigger if files in this path changed |
| 20 | + paths: |
| 21 | + - 'tado-sec/my-react-app/**' |
| 22 | + - '.github/workflows/tado.sec.yml' |
| 23 | + # Don't run on Markdown changes |
| 24 | + - '!**.md' |
| 25 | + branches: [main] |
14 | 26 | pull_request:
|
15 |
| - branches: [ main ] |
| 27 | + # Only trigger if files in this path changed |
| 28 | + paths: |
| 29 | + - 'tado-sec/my-react-app/**' |
| 30 | + - '.github/workflows/tado.sec.yml' |
| 31 | + # Don't run on Markdown changes |
| 32 | + - '!**.md' |
| 33 | + branches: [main] |
16 | 34 |
|
17 | 35 | jobs:
|
18 | 36 | build:
|
19 |
| - |
20 | 37 | runs-on: ubuntu-latest
|
21 | 38 |
|
22 | 39 | strategy:
|
23 | 40 | matrix:
|
24 |
| - node-version: [14.x] |
| 41 | + node-version: [16.x] |
25 | 42 |
|
26 | 43 | steps:
|
27 |
| - - uses: actions/checkout@v2 |
28 |
| - - name: Use Node.js ${{ matrix.node-version }} |
29 |
| - uses: actions/setup-node@v1 |
30 |
| - with: |
31 |
| - node-version: ${{ matrix.node-version }} |
32 |
| - - name: Install dependencies 📦 |
33 |
| - #Using npm ci is generally faster than running npm install |
34 |
| - run: | |
35 |
| - cd testing-for-charity/my-react-app |
36 |
| - npm ci |
37 |
| - - name: Build the app 🏗 |
38 |
| - run: | |
39 |
| - cd testing-for-charity/my-react-app |
40 |
| - npm run build |
41 |
| - # If we had more time, at this point we can actually deploy our app |
42 |
| - # to a staging server and then run functional tests |
43 |
| - - name: Start the app 📤 |
44 |
| - run: | |
45 |
| - cd testing-for-charity/my-react-app |
46 |
| - npm start & |
47 |
| - npx wait-on --timeout 60000 |
48 |
| - - name: Run functional UI tests 🖥 |
49 |
| - run: | |
50 |
| - cd testing-for-charity/my-react-app |
51 |
| - npm run cy:ci |
| 44 | + - uses: actions/checkout@v2 |
| 45 | + - name: Use Node.js ${{ matrix.node-version }} |
| 46 | + uses: actions/setup-node@v1 |
| 47 | + with: |
| 48 | + node-version: ${{ matrix.node-version }} |
| 49 | + - name: Install dependencies 📦 |
| 50 | + #Using npm ci is generally faster than running npm install |
| 51 | + run: | |
| 52 | + npm ci |
| 53 | + - name: Build the app 🏗 |
| 54 | + run: | |
| 55 | + npm run build |
| 56 | + # If we had more time, at this point we can actually deploy our app |
| 57 | + # to a staging server and then run functional tests |
| 58 | + - name: Start the app 📤 |
| 59 | + run: | |
| 60 | + npm start & |
| 61 | + npx wait-on --timeout 60000 |
| 62 | + - name: Run functional UI tests 🖥 |
| 63 | + run: | |
| 64 | + npm run cy:ci |
| 65 | + - name: Run visual tests 👁 |
| 66 | + run: | |
| 67 | + npm run test:visual |
52 | 68 | ```
|
| 69 | +
|
53 | 70 | 3. Add New repository secrets for the repo
|
54 | 71 |
|
55 | 72 | 
|
56 | 73 |
|
57 |
| -4. `git push` and watch it run |
| 74 | +1. Commit the new file |
| 75 | +2. `git push` all of your changes to your repo |
58 | 76 |
|
59 | 77 | ## 🧪Current Test Coverage
|
60 | 78 |
|
|
0 commit comments