ssa: avoid potential cyclic import #1632
Workflow file for this run
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 | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
git-test: | |
if: github.actor != 'dependabot[bot]' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
provider: | |
- gitkit | |
- gitlab-ce | |
- gitlab | |
- github | |
- bitbucket-server | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# Since this is a monorepo, changes in other packages will also trigger these e2e tests | |
# meant only for the git package. This detects us whether the changed files are part of the | |
# git directory. Subsequent steps check if this is true, before executing, thus helping us | |
# run these tests only when there are changes to the git package. | |
- name: Check for changes to git/ or e2e workflow | |
uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
e2e: | |
- '.github/workflows/e2e.yaml' | |
git: | |
- 'git/**' | |
- name: Setup Go | |
if: ${{ steps.filter.outputs.git == 'true' || steps.filter.outputs.e2e == 'true' || github.event_name == 'workflow_dispatch' }} | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version: 1.20.x | |
# https://github.com/actions/setup-go/blob/main/docs/adrs/0000-caching-dependencies.md#example-of-real-use-cases | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Run tests | |
if: ${{ steps.filter.outputs.git == 'true' || steps.filter.outputs.e2e == 'true' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
run_e2e=true | |
# don't run e2e tests for PRs from forked repos for Github, GitLab and Bitbucket Server | |
if [[ ${{ github.event_name }} != "pull_request" ]] || \ | |
[[ "${{ github.event.pull_request.head.repo.full_name }}" = ${{ github.repository }} ]]; then | |
if [[ ${{ matrix.provider }} = "github" ]]; then | |
export GO_TEST_PREFIX="TestGitHubE2E" | |
export GITHUB_USER="fluxcd-gitprovider-bot" | |
export GITHUB_ORG="fluxcd-testing" | |
export GITHUB_TOKEN="${{ secrets.GITPROVIDER_BOT_TOKEN }}" | |
elif [[ ${{ matrix.provider }} = "gitlab" ]]; then | |
export GO_TEST_PREFIX="TestGitLabE2E" | |
export GITLAB_USER="fluxcd-gitprovider-bot" | |
export GITLAB_GROUP="fluxcd-testing" | |
export GITLAB_PAT="${{ secrets.GITLAB_BOT_TOKEN }}" | |
elif [[ ${{ matrix.provider }} = "bitbucket-server" ]]; then | |
export GO_TEST_PREFIX="TestBitbucketServerE2E" | |
export STASH_PROJECT_KEY="GOG" | |
export STASH_TOKEN="${{ secrets.STASH_TOKEN }}" | |
export STASH_DOMAIN="${{ secrets.STASH_DOMAIN }}" | |
export STASH_USER="${{ secrets.STASH_USER }}" | |
fi | |
else | |
run_e2e=false | |
fi | |
if [[ ${{ matrix.provider }} = "gitkit" ]]; then | |
export GO_TEST_PREFIX="TestGitKitE2E" | |
run_e2e=true | |
elif [[ ${{ matrix.provider }} = "gitlab-ce" ]]; then | |
export GO_TEST_PREFIX="TestGitLabCEE2E" | |
run_e2e=true | |
fi | |
if [ $run_e2e = true ]; then | |
cd git/internal/e2e && GO_TEST_PREFIX="${GO_TEST_PREFIX}" ./run.sh | |
else | |
echo "skipping tests for ${{ matrix.provider }}" | |
fi |