User Story 335474 - 101-azure-functions #659
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 Test Check | |
on: | |
pull_request: | |
types: ['opened', 'synchronize'] | |
paths: | |
- '.github/**' | |
- '.github/workflows/**' | |
- 'quickstart/**' | |
- 'test/**' | |
- 'test/e2e/**' | |
permissions: | |
actions: write | |
contents: read | |
id-token: write | |
jobs: | |
e2e-check: | |
runs-on: ubuntu-latest | |
environment: | |
name: test | |
steps: | |
- name: Checking for Fork | |
shell: pwsh | |
run: | | |
$isFork = "${{ github.event.pull_request.head.repo.fork }}" | |
if($isFork -eq "true") { | |
echo "### WARNING: This workflow is disabled for forked repositories. Please follow the [release branch process](https://azure.github.io/Azure-Verified-Modules/contributing/terraform/terraform-contribution-flow/#5-create-a-pull-request-to-the-upstream-repository) if end to end tests are required." >> $env:GITHUB_STEP_SUMMARY | |
} | |
- name: checkout | |
if: github.event.pull_request.head.repo.fork == false | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3.6.0 | |
- name: Get changed files | |
if: github.event.pull_request.head.repo.fork == false | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
dir_names: true | |
separator: "," | |
dir_names_include_files: "quickstart/*" | |
files: "quickstart/**" | |
files_ignore: "**/TestRecord.md" | |
dir_names_max_depth: 2 | |
- name: test pr | |
if: github.event.pull_request.head.repo.fork == false | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
echo "change files" $ALL_CHANGED_FILES | |
export ARM_OIDC_REQUEST_TOKEN=$ACTIONS_ID_TOKEN_REQUEST_TOKEN | |
export ARM_OIDC_REQUEST_URL=$ACTIONS_ID_TOKEN_REQUEST_URL | |
export ARM_SUBSCRIPTION_ID=${{ secrets.ARM_SUBSCRIPTION_ID }} | |
export ARM_TENANT_ID=${{ secrets.ARM_TENANT_ID }} | |
export ARM_CLIENT_ID=${{ secrets.ARM_CLIENT_ID }} | |
export PACKER_VERSION=${{ vars.PACKER_VERSION }} | |
export CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}" | |
docker run --rm -v $(pwd):/src -w /src/test --network=host -e ARM_SUBSCRIPTION_ID -e ARM_TENANT_ID -e ARM_CLIENT_ID -e ARM_OIDC_REQUEST_TOKEN -e ARM_OIDC_REQUEST_URL -e ARM_USE_OIDC=true -e CHANGED_FOLDERS mcr.microsoft.com/azterraform:latest sh -c "pkenv install $PACKER_VERSION && go mod tidy && go test -timeout=360m -v ./e2e" |