101-use-case-create-ask-cluster #353
Workflow file for this run
This file contains hidden or 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: | |
| branches: | |
| - master | |
| - main | |
| types: [ 'opened', 'synchronize' ] | |
| paths: | |
| - '.github/**' | |
| - '.github/workflows/**' | |
| - 'quickstarts/**' | |
| jobs: | |
| terraform-fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v3 | |
| - name: terraform-fmt | |
| run: | | |
| if [ ! -f /usr/local/bin/terraform ]; then | |
| wget -q https://releases.hashicorp.com/terraform/1.6.0/terraform_1.6.0_linux_amd64.zip | |
| unzip terraform_1.6.0_linux_amd64.zip -d /usr/local/bin/ | |
| fi | |
| error=false | |
| echo "===> Terraform fmt -diff checking in quickstarts" | |
| (terraform -chdir=quickstarts fmt -check -recursive -list=false) || error=true | |
| terraform -chdir=quickstarts fmt -diff -recursive | |
| if ${error}; then | |
| echo -e "\033[31m[ERROR]\033[0m: Some quickstarts codes has not been formatted, and please running terraform fmt --recursive command before pushing." | |
| exit 1 | |
| fi | |
| terraform-validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v3 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v34 | |
| with: | |
| dir_names: "true" | |
| separator: "," | |
| files: "quickstarts/*" | |
| dir_names_max_depth: 2 | |
| - name: pr-check | |
| run: | | |
| bash scripts/terraform-install.sh | |
| CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}" | |
| if [ -z "${{ github.event.number }}" ]; then | |
| CHANGED_FOLDERS=$(find ./quickstarts -maxdepth 1 -mindepth 1 -type d | tr '\n' ',') | |
| fi | |
| bash scripts/terraform-validate.sh ${CHANGED_FOLDERS} | |
| e2e-check: | |
| needs: [terraform-fmt, terraform-validate] | |
| runs-on: ubuntu-latest | |
| name: 'e2e check' | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v3 | |
| - name: Checking the max commits number | |
| run: | | |
| commitNum=${{ github.event.pull_request.commits }} | |
| if [[ ${commitNum} -gt 1 ]]; then | |
| echo -e "\nERROR: The PR has ${commitNum} commits, and please rebase it to 1.\n" | |
| exit 1 | |
| fi | |
| - name: set id | |
| id: set-job-id | |
| uses: ayachensiyuan/[email protected] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| job-name: 'e2e check' | |
| - name: get pull request info | |
| run: | | |
| echo "repo name is" ${{github.event.pull_request.head.repo.full_name}} | |
| echo "branch is" ${{github.event.pull_request.head.ref}} | |
| echo "the current job id is ${{ steps.set-job-id.outputs.jobId }}" | |
| - name: e2e test | |
| run: | | |
| objectPath="github-action/${{github.repository}}/e2e/Action-${{github.run_number}}-${{github.run_id}}-${{ steps.set-job-id.outputs.jobId }}" | |
| curl -H "X-Fc-Invocation-Type:Async" -s https://example-ci-terrafoodule-ci-svrrwvrpnj.ap-southeast-1.fcapp.run/?branch=${{github.event.pull_request.head.ref}}\&repo_name=${{github.event.pull_request.head.repo.full_name}}\&oss_object_path=${objectPath} | |
| go run scripts/e2e_check.go ${objectPath} |