From 02cfe0945e3d3ebcced00f511d240f077461bfe1 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar M Date: Fri, 5 Jun 2020 18:41:05 -0700 Subject: [PATCH] Set environment variable in the secrets to access the connection string in the secrets folder --- .github/workflows/blank.yml | 130 ++++++++++++++++++++++++++ cypress/utilities/connectionString.js | 2 +- 2 files changed, 131 insertions(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index faf02007d..646d3e4bf 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -67,6 +67,136 @@ jobs: EMULATOR_ENDPOINT: https://0.0.0.0:8081/ NODE_TLS_REJECT_UNAUTHORIZED: 0 CYPRESS_CACHE_FOLDER: ~/.cache/Cypress + endtoendprodsql: + name: "End to End Tests Prod" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Restore Cypress Binary Cache + uses: actions/cache@v2 + with: + path: ~/.cache/Cypress + key: ${{ runner.os }}-cypress-binary-cache + - name: End to End Tests + run: | + npm ci + npm start & + npm ci --prefix ./cypress + npm run test --prefix ./cypress + shell: bash + env: + EMULATOR_ENDPOINT: https://0.0.0.0:8081/ + NODE_TLS_REJECT_UNAUTHORIZED: 0 + CYPRESS_CACHE_FOLDER: ~/.cache/Cypress + CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }} + endtoendprodmongo: + name: "End to End Tests Prod" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Restore Cypress Binary Cache + uses: actions/cache@v2 + with: + path: ~/.cache/Cypress + key: ${{ runner.os }}-cypress-binary-cache + - name: End to End Tests + run: | + npm ci + npm start & + npm ci --prefix ./cypress + npm run test --prefix ./cypress + shell: bash + env: + EMULATOR_ENDPOINT: https://0.0.0.0:8081/ + NODE_TLS_REJECT_UNAUTHORIZED: 0 + CYPRESS_CACHE_FOLDER: ~/.cache/Cypress + CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_MONGO }} + endtoendprodtable: + name: "End to End Tests Prod" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Restore Cypress Binary Cache + uses: actions/cache@v2 + with: + path: ~/.cache/Cypress + key: ${{ runner.os }}-cypress-binary-cache + - name: End to End Tests + run: | + npm ci + npm start & + npm ci --prefix ./cypress + npm run test --prefix ./cypress + shell: bash + env: + EMULATOR_ENDPOINT: https://0.0.0.0:8081/ + NODE_TLS_REJECT_UNAUTHORIZED: 0 + CYPRESS_CACHE_FOLDER: ~/.cache/Cypress + CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_TABLE }} + endtoendprodgraph: + name: "End to End Tests Prod" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Restore Cypress Binary Cache + uses: actions/cache@v2 + with: + path: ~/.cache/Cypress + key: ${{ runner.os }}-cypress-binary-cache + - name: End to End Tests + run: | + npm ci + npm start & + npm ci --prefix ./cypress + npm run test --prefix ./cypress + shell: bash + env: + EMULATOR_ENDPOINT: https://0.0.0.0:8081/ + NODE_TLS_REJECT_UNAUTHORIZED: 0 + CYPRESS_CACHE_FOLDER: ~/.cache/Cypress + CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_GRAPH }} + endtoendprodcassandra: + name: "End to End Tests Prod" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Restore Cypress Binary Cache + uses: actions/cache@v2 + with: + path: ~/.cache/Cypress + key: ${{ runner.os }}-cypress-binary-cache + - name: End to End Tests + run: | + npm ci + npm start & + npm ci --prefix ./cypress + npm run test --prefix ./cypress + shell: bash + env: + EMULATOR_ENDPOINT: https://0.0.0.0:8081/ + NODE_TLS_REJECT_UNAUTHORIZED: 0 + CYPRESS_CACHE_FOLDER: ~/.cache/Cypress + CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_CASSANDRA }} nuget: name: Publish Nuget needs: [build, test, endtoend] diff --git a/cypress/utilities/connectionString.js b/cypress/utilities/connectionString.js index a823a74ee..d6e35a7e3 100644 --- a/cypress/utilities/connectionString.js +++ b/cypress/utilities/connectionString.js @@ -24,7 +24,7 @@ module.exports = { .last() .click({ force: true }); - const secret = Cypress.env('connectionString')[api]; + const secret = Cypress.env(`CONNECTION_STRING_${api && api.toUpperCase()}`); cy.wrap($body) .find("input[class='inputToken']")