Skip to content

Run E2E tests on ref (local) #34

Run E2E tests on ref (local)

Run E2E tests on ref (local) #34

name: "Run E2E tests on ref (local)"
on:
workflow_dispatch:
inputs:
# We are using PR number here instead of SHA or branch name to make it possible to run this on PRs from forks
pr:
type: string
required: true
description: "Pull request number/url"
sha:
type: string
required: true
description: "Latest PR commit hash"
# ^ To validate that PR has not changed before the checkout
jobs:
run_e2e:
name: "Build and run E2E"
runs-on: [ self-hosted, linux ]
permissions:
contents: read
packages: read
container:
image: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/debian_docker:latest"
options: -v /var/run/docker.sock:/var/run/docker.sock
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: 'Cleanup build folder'
run: |
rm -rf ./* || true
rm -rf ./.??* || true
rm -rf ../datalens-ui || true
- name: Checkout code
uses: actions/checkout@v2
- name: Fix dubious ownership
run: .github/.scripts/git_config_save_directory.sh
env:
REPOSITORY_NAME: ${{ github.event.repository.name }}
- name: Switch to PR head
run: gh pr checkout ${{ github.event.inputs.pr }}
env:
GH_TOKEN: ${{ github.token }}
- name: Validate SHA
run: |
export HEAD_SHA=$(git rev-parse HEAD)
export INPUT_SHA="${{ github.event.inputs.sha }}"
echo "Calculated latest commit in PR: $HEAD_SHA"
if [ x"$HEAD_SHA" != x"$INPUT_SHA" ]; then
echo "The branch was updated since the workflow was triggered, exiting"
exit 1
fi
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.33.1
# - name: Checkout datalens-ui repo
# uses: actions/checkout@v4
# with:
# repository: datalens-tech/datalens-ui
# path: tools/e2e/datalens-ui
- name: Clone datalens-ui repo
run: git clone https://github.com/datalens-tech/datalens-ui.git ../datalens-ui && chown -R $(whoami) ../datalens-ui
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
# cache-dependency-path: ../datalens-ui/package-lock.json
cache-dependency-path: /__w/datalens-backend/datalens-ui/package-lock.json
- name: Build and run E2E
run: task e2e:init-and-run DATALENS_UI_FOLDER="../../../datalens-ui"