|
| 1 | +name: Pull Request CI |
| 2 | +run-name: ${{ github.actor }} is running Pull Request CI |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request_target: |
| 6 | + types: [opened, labeled, reopened, synchronize] |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + initialize: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + env: |
| 17 | + AWS_BUCKET: code.s4d.io |
| 18 | + AWS_REGION: us-east-1 |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v3 |
| 22 | + |
| 23 | + - name: Set up Node.js |
| 24 | + uses: actions/setup-node@v3 |
| 25 | + with: |
| 26 | + node-version: 20.13.1 |
| 27 | + |
| 28 | + - name: Clean yarn cache |
| 29 | + run: yarn cache clean |
| 30 | + |
| 31 | + - name: Initialize dependencies |
| 32 | + run: yarn install |
| 33 | + |
| 34 | + - name: Cache Dependencies |
| 35 | + uses: actions/cache@v3 |
| 36 | + if: steps.validate-dependencies.outputs.cache-hit != 'true' |
| 37 | + with: |
| 38 | + path: "**/node_modules" |
| 39 | + key: node-modules-${{ hashFiles('./yarn.lock') }} |
| 40 | + |
| 41 | + unit_tests_and_linting: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + needs: initialize |
| 44 | + steps: |
| 45 | + - name: Checkout code |
| 46 | + uses: actions/checkout@v3 |
| 47 | + |
| 48 | + - name: Set up Node.js |
| 49 | + uses: actions/setup-node@v3 |
| 50 | + with: |
| 51 | + node-version: 20.13.1 |
| 52 | + |
| 53 | + - name: Uncache Dependencies |
| 54 | + uses: actions/cache@v3 |
| 55 | + with: |
| 56 | + path: "**/node_modules" |
| 57 | + key: node-modules-${{ hashFiles('./yarn.lock') }} |
| 58 | + |
| 59 | + - name: Run eslint |
| 60 | + run: yarn run eslint --format junit -o reports/junit/js-lint-results.xml |
| 61 | + |
| 62 | + - name: Build packages |
| 63 | + run: yarn run build:all |
| 64 | + |
| 65 | + - name: Run Jest test suites |
| 66 | + env: |
| 67 | + JEST_JUNIT_OUTPUT_NAME: js-jest-results.xml |
| 68 | + JEST_JUNIT_OUTPUT_DIR: reports/junit/jest |
| 69 | + run: yarn run jest --reporters="jest-junit" |
| 70 | + |
| 71 | + - name: Upload Jest test results |
| 72 | + uses: actions/upload-artifact@v3 |
| 73 | + with: |
| 74 | + name: junit-test-results |
| 75 | + path: reports/junit |
| 76 | + |
| 77 | + build_for_tests: |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: initialize |
| 80 | + env: |
| 81 | + FEDERATION: true |
| 82 | + NODE_ENV: test |
| 83 | + WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL: https://conversation-intb.ciscospark.com/conversation/api/v1 |
| 84 | + steps: |
| 85 | + - name: Checkout code |
| 86 | + uses: actions/checkout@v3 |
| 87 | + |
| 88 | + - name: Set up Node.js |
| 89 | + uses: actions/setup-node@v3 |
| 90 | + with: |
| 91 | + node-version: 20.13.1 |
| 92 | + |
| 93 | + - name: Uncache Dependencies |
| 94 | + uses: actions/cache@v3 |
| 95 | + with: |
| 96 | + path: "**/node_modules" |
| 97 | + key: node-modules-${{ hashFiles('./yarn.lock') }} |
| 98 | + |
| 99 | + - name: Build for test |
| 100 | + run: yarn run build journey dist-test |
| 101 | + |
| 102 | + - name: Upload build artifacts |
| 103 | + uses: actions/upload-artifact@v3 |
| 104 | + with: |
| 105 | + name: dist-test |
| 106 | + path: dist-test |
| 107 | + |
| 108 | + journey_tests_chrome: |
| 109 | + runs-on: ubuntu-latest |
| 110 | + needs: build_for_tests |
| 111 | + env: |
| 112 | + SAUCE: true |
| 113 | + STATIC_SERVER_PATH: dist-test |
| 114 | + steps: |
| 115 | + - name: Checkout code |
| 116 | + uses: actions/checkout@v3 |
| 117 | + |
| 118 | + - name: Set up Node.js |
| 119 | + uses: actions/setup-node@v3 |
| 120 | + with: |
| 121 | + node-version: 20.13.1 |
| 122 | + |
| 123 | + - name: Create Environment Variables |
| 124 | + run: | |
| 125 | + touch .env |
| 126 | + echo "WEBEX_CONVERSATION_DEFAULT_CLUSTER=urn:TEAM:us-east-1_a:identityLookup" >> .env |
| 127 | + echo "WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL=https://conv-a.wbx2.com/conversation/api/v1" >> .env |
| 128 | + echo "IDBROKER_BASE_URL=https://idbroker.webex.com" >> .env |
| 129 | + echo "U2C_SERVICE_URL=https://u2c.wbx2.com/u2c/api/v1" >> .env |
| 130 | + echo "WDM_SERVICE_URL=https://wdm-a.wbx2.com/wdm/api/v1" >> .env |
| 131 | + cat .env |
| 132 | +
|
| 133 | + - name: Uncache Dependencies |
| 134 | + uses: actions/cache@v3 |
| 135 | + with: |
| 136 | + path: "**/node_modules" |
| 137 | + key: node-modules-${{ hashFiles('./yarn.lock') }} |
| 138 | + |
| 139 | + - name: initialize WebDriver dependencies |
| 140 | + run: | |
| 141 | + yarn initialize -g webdriver-manager |
| 142 | + webdriver-manager update |
| 143 | +
|
| 144 | + - name: initialize Chrome browser |
| 145 | + run: | |
| 146 | + sudo apt-get update |
| 147 | + sudo apt-get initialize -y google-chrome-stable |
| 148 | +
|
| 149 | + - name: Start Xvfb |
| 150 | + run: | |
| 151 | + sudo apt-get initialize -y xvfb |
| 152 | + Xvfb :99 & export DISPLAY=:99 |
| 153 | +
|
| 154 | + - name: Run integration tests on Chrome |
| 155 | + run: BROWSER=chrome yarn run test:integration |
| 156 | + |
| 157 | + - name: Upload test results |
| 158 | + uses: actions/upload-artifact@v3 |
| 159 | + with: |
| 160 | + name: integration-test-results |
| 161 | + path: reports/junit/wdio |
| 162 | + |
| 163 | + journey_tests_firefox: |
| 164 | + runs-on: ubuntu-latest |
| 165 | + needs: build_for_tests |
| 166 | + env: |
| 167 | + SAUCE: true |
| 168 | + STATIC_SERVER_PATH: dist-test |
| 169 | + steps: |
| 170 | + - name: Checkout code |
| 171 | + uses: actions/checkout@v3 |
| 172 | + |
| 173 | + - name: Set up Node.js |
| 174 | + uses: actions/setup-node@v3 |
| 175 | + with: |
| 176 | + node-version: 20.13.1 |
| 177 | + |
| 178 | + - name: Create Environment Variables |
| 179 | + run: | |
| 180 | + touch .env |
| 181 | + echo "WEBEX_CONVERSATION_DEFAULT_CLUSTER=urn:TEAM:us-east-1_a:identityLookup" >> .env |
| 182 | + echo "WEBEX_TEST_USERS_CONVERSATION_SERVICE_URL=https://conv-a.wbx2.com/conversation/api/v1" >> .env |
| 183 | + echo "IDBROKER_BASE_URL=https://idbroker.webex.com" >> .env |
| 184 | + echo "U2C_SERVICE_URL=https://u2c.wbx2.com/u2c/api/v1" >> .env |
| 185 | + echo "WDM_SERVICE_URL=https://wdm-a.wbx2.com/wdm/api/v1" >> .env |
| 186 | + cat .env |
| 187 | +
|
| 188 | + - name: Uncache Dependencies |
| 189 | + uses: actions/cache@v3 |
| 190 | + with: |
| 191 | + path: "**/node_modules" |
| 192 | + key: node-modules-${{ hashFiles('./yarn.lock') }} |
| 193 | + |
| 194 | + - name: initialize WebDriver dependencies |
| 195 | + run: | |
| 196 | + yarn initialize -g webdriver-manager |
| 197 | + webdriver-manager update |
| 198 | +
|
| 199 | + - name: initialize Firefox browser |
| 200 | + run: | |
| 201 | + sudo apt-get update |
| 202 | + sudo apt-get initialize -y firefox |
| 203 | +
|
| 204 | + - name: Start Xvfb |
| 205 | + run: | |
| 206 | + sudo apt-get initialize -y xvfb |
| 207 | + Xvfb :99 & export DISPLAY=:99 |
| 208 | +
|
| 209 | + - name: Run integration tests on Firefox |
| 210 | + run: BROWSER=firefox yarn run test:integration |
| 211 | + |
| 212 | + - name: Upload test results |
| 213 | + uses: actions/upload-artifact@v3 |
| 214 | + with: |
| 215 | + name: integration-test-results |
| 216 | + path: reports/junit/wdio |
0 commit comments