diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml deleted file mode 100644 index 23e9ee5..0000000 --- a/.github/workflows/e2e.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: E2E test for Dapps website - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - pull_request: - branches: ["main"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - e2e: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v2 - - - name: Install pnpm - uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # pin@v2.4.0 - with: - version: latest - - - name: Setup node - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # pin@v3.8.1 - with: - node-version: 18.16 - - - name: Set pnpm cache directory - run: pnpm config set store-dir .pnpm-store - continue-on-error: true - - - name: Setup cache - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # pin@v2 - with: - path: | - .pnpm-store - node_modules - /home/runner/.cache/Cypress - key: ${{ runner.os }}-pnpm-v1-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-v1- - continue-on-error: true - - - name: Install dependencies - run: pnpm install --frozen-lockfile --prefer-offline - - - name: Install linux deps - run: | - sudo apt-get install --no-install-recommends -y \ - fluxbox \ - xvfb - - - name: Run e2e tests (headful) - run: | - Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac & - fluxbox & - pnpm test - env: - CYPRESS_PRIVATE_KEY_WITH_FUNDS: - ${{ secrets.CYPRESS_PRIVATE_KEY_WITH_FUNDS }} - DISPLAY: :0.0 - - - name: Archive e2e artifacts - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@v2 - if: always() - with: - name: e2e-artifacts - path: | - tests/e2e/videos - tests/e2e/screenshots - continue-on-error: true diff --git a/.github/workflows/gatsby.yml b/.github/workflows/gatsby.yml index 8a50d84..90829fa 100644 --- a/.github/workflows/gatsby.yml +++ b/.github/workflows/gatsby.yml @@ -5,14 +5,13 @@ name: Deploy Gatsby site to Pages on: - workflow_run: - workflows: ['e2e'] - types: [completed] - # Runs on pushes targeting the default branch push: branches: ["main"] + pull_request: + branches: ["main"] + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -34,9 +33,71 @@ defaults: shell: bash jobs: + e2e_test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v2 + + - name: Install pnpm + uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # pin@v2.4.0 + with: + version: latest + + - name: Setup node + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # pin@v3.8.1 + with: + node-version: 18.16 + + - name: Set pnpm cache directory + run: pnpm config set store-dir .pnpm-store + continue-on-error: true + + - name: Setup cache + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # pin@v2 + with: + path: | + .pnpm-store + node_modules + /home/runner/.cache/Cypress + key: ${{ runner.os }}-pnpm-v1-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-v1- + continue-on-error: true + + - name: Install dependencies + run: pnpm install --frozen-lockfile --prefer-offline + + - name: Install linux deps + run: | + sudo apt-get install --no-install-recommends -y \ + fluxbox \ + xvfb + + - name: Run e2e tests (headful) + run: | + Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac & + fluxbox & + pnpm test + env: + CYPRESS_PRIVATE_KEY_WITH_FUNDS: + ${{ secrets.CYPRESS_PRIVATE_KEY_WITH_FUNDS }} + DISPLAY: :0.0 + + - name: Archive e2e artifacts + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@v2 + if: always() + with: + name: e2e-artifacts + path: | + tests/e2e/videos + tests/e2e/screenshots + continue-on-error: true + # Build job build: - if: ${{ github.event.workflow_run.conclusion == 'success' }} + needs: e2e_test + if: ${{ github.ref == 'refs/heads/main' }} runs-on: ubuntu-latest steps: - name: Checkout @@ -91,7 +152,7 @@ jobs: # Deployment job deploy: - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.ref == 'refs/heads/main' }} environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }}