-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from fingerprintjs/ci/e2e_test_improvements
ci: replace test branch flow with new flow
- Loading branch information
Showing
8 changed files
with
116 additions
and
193 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Run e2e for topic branch | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
check-changed-files: | ||
runs-on: ubuntu-20.04 | ||
name: Check changed files | ||
outputs: | ||
NEED_TO_RUN_TESTS: ${{ steps.decision.outputs.NEED_TO_RUN_TESTS }} | ||
steps: | ||
- name: Git clone | ||
uses: actions/checkout@v4 | ||
- name: Get changed files | ||
id: decision | ||
run: | | ||
git fetch origin $GITHUB_BASE_REF | ||
diff=$(git diff --name-only origin/$GITHUB_BASE_REF..HEAD) | ||
echo $diff | ||
needToRunTests=false | ||
for changed_file in $diff; do | ||
if [[ ${changed_file} =~ ^(proxy|scripts|mgmt-lambda)\/.+$ ]]; then | ||
needToRunTests=true | ||
fi | ||
if [[ ${changed_file} =~ ^\.github\/workflows\/.+$ ]]; then | ||
needToRunTests=true | ||
fi | ||
done | ||
echo $needToRunTests | ||
echo NEED_TO_RUN_TESTS=${needToRunTests} >> $GITHUB_OUTPUT | ||
run-e2e-for-topic-branch: | ||
needs: check-changed-files | ||
if: needs['check-changed-files'].outputs.NEED_TO_RUN_TESTS == 'true' | ||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
name: Run e2e for topic branch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git clone | ||
uses: actions/checkout@v4 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 #v4.0.2 | ||
with: | ||
role-to-assume: ${{secrets.AWS_E2E_ROLE_ARN}} | ||
aws-region: ${{vars.AWS_E2E_REGION}} | ||
- name: Trigger AWS CodePipeline | ||
run: | | ||
git_hash=${{ github.event.pull_request.head.sha }} | ||
echo $git_hash | ||
codepipeline_execution_id=$(aws codepipeline start-pipeline-execution --name ${{vars.AWS_E2E_TOPIC_BRANCH_CODEPIPELINE_NAME}} --source-revisions actionName=Source,revisionType=COMMIT_ID,revisionValue=$git_hash --query 'pipelineExecutionId' --output text) | ||
echo "Pipeline execution ID: $codepipeline_execution_id" | ||
echo "codepipeline_execution_id=$codepipeline_execution_id" >> $GITHUB_ENV | ||
- name: Poll Pipeline Status | ||
id: poll-status | ||
run: | | ||
while true; do | ||
sleep 30 | ||
status=$(aws codepipeline get-pipeline-execution \ | ||
--pipeline-name ${{vars.AWS_E2E_TOPIC_BRANCH_CODEPIPELINE_NAME}} \ | ||
--pipeline-execution-id ${{ env.codepipeline_execution_id }} \ | ||
--query 'pipelineExecution.status' --output text) | ||
echo "Current pipeline status: $status" | ||
if [[ "$status" == "Succeeded" ]]; then | ||
echo "Pipeline execution succeeded!" | ||
exit 0 | ||
elif [[ "$status" == "Failed" ]]; then | ||
echo "Pipeline execution failed!" | ||
exit 1 | ||
fi | ||
done | ||
- name: Output Pipeline Link | ||
if: always() | ||
run: | | ||
region=${{ vars.AWS_E2E_REGION }} | ||
pipeline_name=${{ vars.AWS_E2E_TOPIC_BRANCH_CODEPIPELINE_NAME }} | ||
execution_id=${{ env.codepipeline_execution_id }} | ||
pipeline_url="https://${region}.console.aws.amazon.com/codesuite/codepipeline/pipelines/${pipeline_name}/executions/${execution_id}?region=${region}" | ||
echo "AWS CodePipeline Execution URL: $pipeline_url" | ||
echo "## AWS CodePipeline Execution Link" >> $GITHUB_STEP_SUMMARY | ||
echo "[$pipeline_url]($pipeline_url)" >> $GITHUB_STEP_SUMMARY |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 0.2 | ||
|
||
phases: | ||
build: | ||
commands: | ||
# $CODEBUILD_SRC_DIR => rc branch | ||
# $CODEBUILD_SRC_DIR_SourceArtifact => topic branch | ||
- cd $CODEBUILD_SRC_DIR_SourceArtifact | ||
- git status | ||
- cp $CODEBUILD_SRC_DIR/buildspec-e2e.yml buildspec-e2e.yml | ||
- cp $CODEBUILD_SRC_DIR/buildspec-mock-e2e.yml buildspec-mock-e2e.yml | ||
artifacts: | ||
files: | ||
- '**/*' | ||
base-directory: $CODEBUILD_SRC_DIR_SourceArtifact |
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
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
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