diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 551977f..eb797ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,16 +5,18 @@ on: jobs: e2e-local-lab: - uses: ./.github/workflows/run-e2e-local.yml + uses: ./.github/workflows/run-e2e.yml with: + client: local environment: lab gitref: ${{ github.ref }} secrets: sops_age_key: ${{ secrets.SOPS_AGE_PRIVATE_KEY }} e2e-remote-lab: - uses: ./.github/workflows/run-e2e-remote.yml + uses: ./.github/workflows/run-e2e.yml with: + client: remote environment: lab gitref: ${{ github.ref }} secrets: diff --git a/.github/workflows/run-e2e-remote.yml b/.github/workflows/run-e2e-remote.yml deleted file mode 100644 index b9c86cf..0000000 --- a/.github/workflows/run-e2e-remote.yml +++ /dev/null @@ -1,65 +0,0 @@ -on: - workflow_call: - inputs: - environment: - required: true - type: string - gitref: - required: false - type: string - default: master - secrets: - sops_age_key: - required: true - -jobs: - e2e-preparations: - runs-on: [ self-hosted ] - outputs: - dns1: ${{ steps.vars.outputs.DNS1 }} - dns2: ${{ steps.vars.outputs.DNS2 }} - steps: - - name: Check out e2e repository - uses: actions/checkout@v3.5.2 - with: - repository: homecentr/e2e - ref: refs/heads/${{ inputs.gitref }} - path: e2e - - - name: Load variables - id: vars - run: cat ./e2e/environments/remote.env >> "$GITHUB_OUTPUT" - - e2e-tests-local: - runs-on: [ self-hosted ] - needs: [ e2e-preparations ] - services: - webdriver-chrome: - image: selenium/standalone-chrome - ports: - - 4444 - - 7900 - env: - VNC_NO_PASSWORD: 1 - options: --shm-size=2g --dns=${{ needs.e2e-preparations.outputs.dns1 }} --dns=${{ needs.e2e-preparations.outputs.dns2 }} - steps: - - name: Print debug link - run: echo "::info::http://$HOST_IP:${{ job.services.webdriver-chrome.ports[7900] }}" - - - name: Check out e2e repository - uses: actions/checkout@v3.5.2 - with: - repository: homecentr/e2e - ref: refs/heads/${{ inputs.gitref }} - path: e2e - - - name: Install dependencies - run: cd e2e && yarn - - - name: Run tests - run: cd e2e && yarn test:remote:${{ inputs.environment }} - env: - WEBDRIVER_HOST: host.docker.internal - WEBDRIVER_PORT: ${{ job.services.webdriver-chrome.ports[4444] }} - SOPS_AGE_KEY: ${{ secrets.sops_age_key }} - SCREENSHOTS_ENABLED: "false" diff --git a/.github/workflows/run-e2e-local.yml b/.github/workflows/run-e2e.yml similarity index 86% rename from .github/workflows/run-e2e-local.yml rename to .github/workflows/run-e2e.yml index 8d317f6..c2754ba 100644 --- a/.github/workflows/run-e2e-local.yml +++ b/.github/workflows/run-e2e.yml @@ -4,6 +4,9 @@ on: environment: required: true type: string + client: + required: true + type: string gitref: required: false type: string @@ -28,9 +31,9 @@ jobs: - name: Load variables id: vars - run: cat ./e2e/environments/local.${{ inputs.environment }}.env >> "$GITHUB_OUTPUT" + run: cat ./e2e/environments/${{ inputs.client }}.${{ inputs.environment }}.env >> "$GITHUB_OUTPUT" - e2e-tests-local: + e2e-tests: runs-on: [ self-hosted ] needs: [ e2e-preparations ] services: @@ -57,7 +60,7 @@ jobs: run: cd e2e && yarn - name: Run tests - run: cd e2e && yarn test:local:${{ inputs.environment }} + run: cd e2e && yarn test:${{ inputs.client }}:${{ inputs.environment }} env: WEBDRIVER_HOST: host.docker.internal WEBDRIVER_PORT: ${{ job.services.webdriver-chrome.ports[4444] }} diff --git a/environments/remote.env b/environments/remote.lab.env similarity index 100% rename from environments/remote.env rename to environments/remote.lab.env diff --git a/environments/remote.prod.env b/environments/remote.prod.env new file mode 100644 index 0000000..7f4b206 --- /dev/null +++ b/environments/remote.prod.env @@ -0,0 +1,2 @@ +DNS1=1.1.1.1 +DNS2=1.0.0.1 \ No newline at end of file diff --git a/package.json b/package.json index 3e04feb..100ceec 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "scripts": { "client:local:lab": "env-cmd -f ./environments/local.lab.env docker-compose up --force-recreate --remove-orphans", "client:local:prod": "env-cmd -f ./environments/local.prod.env docker-compose up --force-recreate --remove-orphans", - "client:remote": "env-cmd -f ./environments/remote.env docker-compose up --force-recreate --remove-orphans", + "client:remote:lab": "env-cmd -f ./environments/remote.lab.env docker-compose up --force-recreate --remove-orphans", + "client:remote:prod": "env-cmd -f ./environments/remote.prod.env docker-compose up --force-recreate --remove-orphans", "test:local:lab": "nightwatch --skiptags remoteonly -e lab", "test:local:prod": "nightwatch --skiptags remoteonly -e prod", "test:remote:lab": "nightwatch --skiptags localonly -e lab",