E2E tests account #955
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E tests account | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
schedule: | |
- cron: '* */12 * * *' | |
workflow_dispatch: | |
workflow_call: | |
env: | |
BLOCKSCOUT_URL: ${{ secrets.E2E_BLOCKSCOUT_URL }} | |
FRONTEND_URL: ${{ secrets.E2E_FRONTEND_URL }} | |
NETWORK_URL: ${{ secrets.E2E_NETWORK_URL }} | |
ACCOUNT_USERNAME: ${{ secrets.ACCOUNT_USERNAME }} | |
ACCOUNT_PASSWORD: ${{ secrets.ACCOUNT_PASSWORD }} | |
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} | |
MAILSLURP_EMAIL_ID: ${{ secrets.MAILSLURP_EMAIL_ID }} | |
ENV: test | |
RESOURCE_MODE: account | |
PUBLIC: false | |
PORT: 4000 | |
PORT_PG: 5432 | |
PORT_NETWORK_HTTP: 8545 | |
PORT_NETWORK_WS: 8546 | |
WALLET: ${{ secrets.WALLET }} | |
PWDEBUG: 0 | |
LOAD_AUTH_CTX: 0 | |
LOAD_CONTRACTS_DATA: 0 | |
ACCOUNT: 1 | |
jobs: | |
e2e_tests: | |
name: Tests | |
permissions: | |
id-token: write | |
contents: read | |
runs-on: ubuntu-20.04 | |
environment: | |
name: Tests | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: blockscout/blockscout-ci-cd | |
path: blockscout-ci-cd | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- name: Set environment variables | |
run: | | |
env_vars=${{ inputs.env_vars }} | |
for i in ${env_vars//,/ } | |
do | |
echo "$i" >> $GITHUB_ENV | |
echo "${{ inputs.appNamespace }}.${{ env.K8S_DOMAIN }}" | |
done | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: v14.17.0 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install deps | |
working-directory: blockscout-ci-cd/tests/e2e | |
run: npm ci | |
- name: Lint | |
working-directory: blockscout-ci-cd/tests/e2e | |
run: npm run lint | |
- name: Build contracts | |
working-directory: blockscout-ci-cd/tests/contracts | |
run: | | |
# gyp build from root | |
npm config set user 0 | |
npm ci | |
npm run build | |
- name: Cache playwright binaries | |
uses: actions/cache@v2 | |
id: playwright-cache | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }} | |
# check if instance is ready | |
- name: Check the deployed service URL | |
uses: jtalk/url-health-check-action@v2 | |
with: | |
# Check the following URLs one by one sequentially | |
url: ${{ env.FRONTEND_URL }}|${{ env.NETWORK_URL }}|${{ env.BLOCKSCOUT_URL }} | |
# | |
# Follow redirects, or just report success on 3xx status codes | |
follow-redirect: false # Optional, defaults to "false" | |
# Fail this action after this many failed attempts | |
max-attempts: 30 # Optional, defaults to 1 | |
# Delay between retries | |
retry-delay: 10s # Optional, only applicable to max-attempts > 1 | |
# Retry all errors, including 404. This option might trigger curl upgrade. | |
retry-all: true # Optional, defaults to "false" | |
- name: Run playwright smoke suite | |
working-directory: blockscout-ci-cd/tests/e2e | |
run: | | |
npx playwright install | |
npm run test:smoke:account | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: report | |
path: blockscout-ci-cd/tests/e2e/html-report/index.html | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: tests-results | |
path: blockscout-ci-cd/tests/e2e/test-results | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: state | |
path: blockscout-ci-cd/tests/e2e/state.json | |
defaults: | |
run: | |
shell: bash |