|
5 | 5 | pull_request: |
6 | 6 | branches: ["main", "develop"] |
7 | 7 |
|
8 | | - |
9 | | -env: |
10 | | - # For recording and parallelization to work you must set your CYPRESS_RECORD_KEY |
11 | | - # in GitHub repo → Settings → Secrets → Actions |
12 | | - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} |
13 | | - # Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token |
14 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
15 | | - # Custom environment variables |
16 | | - |
17 | | - |
18 | | - # AUTH0 |
19 | | - AUTH0_USERNAME: ${{ secrets.AUTH0_USERNAME }} |
20 | | - AUTH0_PASSWORD: ${{ secrets.AUTH0_PASSWORD }} |
21 | | - AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }} |
22 | | - |
23 | | - REACT_APP_AUTH0_DOMAIN: ${{ secrets.REACT_APP_AUTH0_DOMAIN }} |
24 | | - REACT_APP_AUTH0_AUDIENCE: ${{ secrets.REACT_APP_AUTH0_AUDIENCE }} |
25 | | - REACT_APP_AUTH0_CLIENT: ${{ secrets.REACT_APP_AUTH0_CLIENT }} |
26 | | - |
27 | | - # API |
28 | | - REACT_APP_API: ${{ secrets.REACT_APP_API }} |
29 | | - REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }} |
30 | | - REACT_APP_MAPBOX_TOKEN: ${{ secrets.REACT_APP_MAPBOX_TOKEN }} |
31 | | - REACT_APP_GOOGLE_ANALYTICS_ID: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID }} |
32 | | - REACT_APP_CMS_API: ${{ secrets.REACT_APP_CMS_API }} |
33 | | - REACT_APP_CMS_TOKEN: ${{ secrets.REACT_APP_CMS_TOKEN }} |
34 | | - REACT_APP_GOOGLE_API_CLIENT_ID: ${{ secrets.REACT_APP_GOOGLE_API_CLIENT_ID }} |
35 | | - REACT_APP_GOOGLE_API_DEV_KEY: ${{ secrets.REACT_APP_GOOGLE_API_DEV_KEY }} |
36 | | - REACT_APP_CYPRESS_TEST: "true" |
37 | | - CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} |
38 | | - GENERATE_SOURCEMAP: false |
39 | | - |
40 | | - # GOOGLE CYPRESS |
41 | | - GOOGLE_CLIENT_ID_TEST: ${{ secrets.GOOGLE_CLIENT_ID_TEST }} |
42 | | - GOOGLE_CLIENT_SECRET_TEST: ${{ secrets.GOOGLE_CLIENT_SECRET_TEST }} |
43 | | - GOOGLE_REFRESH_TOKEN_TEST: ${{ secrets.GOOGLE_REFRESH_TOKEN_TEST }} |
44 | | - |
45 | 8 | jobs: |
46 | | - jest-run: |
47 | | - runs-on: ubuntu-latest |
48 | | - steps: |
49 | | - - name: Checkout |
50 | | - uses: actions/checkout@v4 |
51 | | - |
52 | | - - name: Set up Node.js |
53 | | - uses: actions/setup-node@v4 |
54 | | - with: |
55 | | - node-version: '16' |
56 | | - cache: 'yarn' |
57 | | - |
58 | | - - name: Install packages |
59 | | - run: yarn install && yarn add "https://github.com/zimmerman-team/rawgraphs-charts.git#b86c928" |
60 | | - |
61 | | - - name: Build rawgraphs package |
62 | | - run: | |
63 | | - if [ -d "node_modules/@rawgraphs/rawgraphs-charts" ]; then |
64 | | - cd node_modules/@rawgraphs/rawgraphs-charts |
65 | | - yarn |
66 | | - yarn build |
67 | | - else |
68 | | - echo "Package directory not found" |
69 | | - fi |
70 | | -
|
71 | | - - name: Jest run |
72 | | - run: yarn test |
| 9 | + # jest-run: |
| 10 | + # runs-on: ubuntu-latest |
| 11 | + # steps: |
| 12 | + # - name: Checkout |
| 13 | + # uses: actions/checkout@v4 |
| 14 | + |
| 15 | + # - name: Set up Node.js |
| 16 | + # uses: actions/setup-node@v4 |
| 17 | + # with: |
| 18 | + # node-version: "16" |
| 19 | + # cache: "yarn" |
| 20 | + |
| 21 | + # - name: Install packages |
| 22 | + # run: yarn install --frozen-lockfile && yarn add "https://github.com/zimmerman-team/rawgraphs-charts.git#0fc0c9d" |
| 23 | + |
| 24 | + # - name: Build rawgraphs package |
| 25 | + # run: | |
| 26 | + # if [ -d "node_modules/@rawgraphs/rawgraphs-charts" ]; then |
| 27 | + # cd node_modules/@rawgraphs/rawgraphs-charts |
| 28 | + # yarn |
| 29 | + # yarn build |
| 30 | + # else |
| 31 | + # echo "Package directory not found" |
| 32 | + # fi |
| 33 | + |
| 34 | + # - name: Jest run |
| 35 | + # run: yarn test |
73 | 36 |
|
74 | 37 | cypress-run: |
75 | | - runs-on: ubuntu-latest |
| 38 | + runs-on: [self-hosted, cypress] |
76 | 39 | steps: |
77 | | - - name: Checkout |
78 | | - uses: actions/checkout@v4 |
| 40 | + - name: Checkout to current branch |
| 41 | + run: | |
| 42 | + cd ~/DX |
| 43 | + cd dx.client |
| 44 | + git fetch origin |
| 45 | + git checkout ${{ github.head_ref || github.ref_name }} |
| 46 | + git pull origin ${{ github.head_ref || github.ref_name }} |
79 | 47 |
|
80 | | - - name: Set up Node.js |
81 | | - uses: actions/setup-node@v4 |
82 | | - with: |
83 | | - node-version: '16' |
84 | | - cache: 'yarn' |
| 48 | + - name: Build yarn |
| 49 | + run: | |
| 50 | + cd ~/DX |
| 51 | + cd dx.client |
| 52 | + yarn install |
85 | 53 |
|
86 | | - - name: Install packages |
87 | | - run: yarn install && yarn add "https://github.com/zimmerman-team/rawgraphs-charts.git#b86c928" |
| 54 | + - name: Run app with pm2 |
| 55 | + run: | |
| 56 | + cd ~/DX |
| 57 | + cd dx.client |
| 58 | + pm2 start yarn --name "dx.client" -- start |
88 | 59 |
|
89 | | - - name: Build rawgraphs package |
| 60 | + - name: Wait for app to be ready |
90 | 61 | run: | |
91 | | - if [ -d "node_modules/@rawgraphs/rawgraphs-charts" ]; then |
92 | | - cd node_modules/@rawgraphs/rawgraphs-charts |
93 | | - yarn |
94 | | - yarn build |
95 | | - else |
96 | | - echo "Package directory not found" |
97 | | - fi |
98 | | - |
| 62 | + cd ~/DX |
| 63 | + cd dx.client |
| 64 | + while ! curl -s -f -o /dev/null http://localhost:3000; do sleep 5; done |
| 65 | + echo "App is ready" |
| 66 | +
|
99 | 67 | - name: Cypress run |
100 | 68 | # Uses the official Cypress GitHub action https://github.com/cypress-io/github-action |
101 | | - uses: cypress-io/github-action@v6 |
102 | | - with: |
103 | | - # Starts web server for E2E tests - replace with your own server invocation |
104 | | - # https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server |
105 | | - start: yarn start |
106 | | - wait-on: "http://127.0.0.1:3000" # Waits for above |
107 | | - wait-on-timeout: 180 |
108 | | - # Records to Cypress Cloud |
109 | | - # https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record |
110 | | - record: true |
111 | | - # parallel: true # Runs test in parallel using settings above |
112 | | - |
| 69 | + run: | |
| 70 | + cd ~/DX |
| 71 | + cd dx.client |
| 72 | + npx cypress run --record --key ${{ secrets.CYPRESS_RECORD_KEY }} |
113 | 73 |
|
| 74 | + - name: Stop pm2 |
| 75 | + run: | |
| 76 | + cd ~/DX |
| 77 | + cd dx.client |
| 78 | + pm2 stop dx.client |
| 79 | + pm2 delete dx.client |
0 commit comments