# TODO(billy): this workflow has not been re-named from `acceptance` because # Visual Snapshots compares against artifacts from the same workflow name (on main branch) # We should rename this when we have a more finalized naming scheme. # # Also note that this name *MUST* match the filename because GHA # only provides the workflow name (https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables) # and GH APIs only support querying by workflow *FILENAME* (https://developer.github.com/v3/actions/workflows/#get-a-workflow) name: acceptance on: push: branches: - master - releases/** pull_request: jobs: frontend: name: frontend tests runs-on: ubuntu-20.04 timeout-minutes: 20 env: VISUAL_HTML_ENABLE: 1 steps: - uses: actions/checkout@v2 name: Checkout sentry with: # Avoid codecov error message related to SHA resolution: # https://github.com/codecov/codecov-bash/blob/7100762afbc822b91806a6574658129fe0d23a7d/codecov#L891 fetch-depth: '2' - uses: volta-cli/action@v1 # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - name: Install dependencies run: yarn install --frozen-lockfile - name: jest run: | NODE_ENV=production yarn build-css yarn test-ci --forceExit - name: Save HTML artifacts uses: actions/upload-artifact@v2 with: name: jest-html path: .artifacts/visual-snapshots/jest - name: Create Images from HTML uses: getsentry/action-html-to-image@main with: base-path: .artifacts/visual-snapshots/jest css-path: src/sentry/static/sentry/dist/sentry.css - name: Save snapshots if: always() uses: getsentry/action-visual-snapshot@v2 with: save-only: true snapshot-path: .artifacts/visual-snapshots - name: Handle artifacts uses: ./.github/actions/artifacts acceptance: name: acceptance runs-on: ubuntu-20.04 timeout-minutes: 20 strategy: matrix: instance: [0, 1, 2, 3] env: VISUAL_SNAPSHOT_ENABLE: 1 TEST_GROUP_STRATEGY: roundrobin steps: - uses: actions/checkout@v2 name: Checkout sentry - uses: volta-cli/action@v1 - name: Set python version output id: python-version run: | echo "::set-output name=python-version::$(cat .python-version)" # Until GH composite actions can use `uses`, we need to setup python here - uses: actions/setup-python@v2 with: python-version: ${{ steps.python-version.outputs.python-version }} - name: Setup pip uses: ./.github/actions/setup-pip id: pip - name: pip cache uses: actions/cache@v2 with: path: ${{ steps.pip.outputs.pip-cache-dir }} key: ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ hashFiles('**/requirements-*.txt') }} restore-keys: | ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }} - name: Setup sentry python env uses: ./.github/actions/setup-sentry id: setup with: snuba: true - name: yarn cache uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.setup.outputs.yarn-cache-dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - name: Install Javascript Dependencies run: | yarn install --frozen-lockfile - name: webpack env: SENTRY_INSTRUMENTATION: 1 # this is fine to not have for forks, it shouldn't fail SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }} run: | yarn webpack --display errors-only - name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }}) if: always() run: | mkdir -p ${{ steps.setup.outputs.acceptance-dir }} mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-mobile mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-tooltips make run-acceptance env: PYTEST_SNAPSHOTS_DIR: ${{ steps.setup.outputs.acceptance-dir }} USE_SNUBA: 1 - name: Save snapshots if: always() uses: getsentry/action-visual-snapshot@v2 with: save-only: true snapshot-path: .artifacts/visual-snapshots - name: Handle artifacts uses: ./.github/actions/artifacts