-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Created a workflow to update the pre run script for the integration tests * Update update-prerun-script.yml * Changed the workflow run Changed it to run on every push for testing * Changed the payload path * Update update-prerun-script.yml * Combined the two jobs * Added code to checkout package * Added permissions to Github token * Changed how PR is created * Added commands to commit before PR * Changed the git commit command * Update update-prerun-script.yml * Update update-prerun-script.yml * Removed commit statements * Update update-prerun-script.yml * Split the two PRs * Created new action to upload pre run script * Combined get-previous-version and create PR tasks * Changed from using tags to commit hash
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
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,88 @@ | ||
name: Update pre build script on Saucelabs | ||
|
||
on: | ||
schedule: | ||
- cron: '*/10 * * * *' | ||
# schedule: | ||
# - cron: '0 0 1 */2 *' | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
env: | ||
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} | ||
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} | ||
|
||
jobs: | ||
update-pre-run-script: | ||
name: Update pre run script on Saucelabs | ||
runs-on: ubuntu-latest | ||
outputs: | ||
script-id: ${{ steps.upload-pre-run-script.outputs.script-id }} | ||
steps: | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
- name: Copy script from S3 bucket | ||
run: aws s3 cp s3://saucelabs-prebuild-script/script.sh ./ | ||
- name: Upload pre run script to Saucelabs | ||
id: upload-pre-run-script | ||
run: | | ||
RESPONSE="$(curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" —location --request POST 'https://api.us-west-1.saucelabs.com/v1/storage/upload' --form 'payload=@"script.sh"' --form 'name="blur_replacement_script"')" | ||
SCRIPT_ID=$(jq -r '.item.id' <<< "$RESPONSE") | ||
rm -rf script.sh | ||
echo "::set-output name=script-id::$SCRIPT_ID" | ||
create-pr: | ||
name: Create PR for origin branch | ||
runs-on: ubuntu-latest | ||
needs: [update-pre-run-script] | ||
steps: | ||
- name: Checkout Package | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Update pre run script ID | ||
run: | | ||
echo "Updating integration tests pre-run script ID for origin branch" | ||
SCRIPT_ID=${{ needs.update-pre-run-script.outputs.script-id }} | ||
sed -i -E "s/storage.*'/storage:$SCRIPT_ID'/g" ${GITHUB_WORKSPACE}/integration/js/utils/WebdriverSauceLabs.js | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@f094b77505fb89581e68a1163fbd2fffece39da1 | ||
with: | ||
commit-message: Update integration tests pre-run script ID | ||
title: Update integration tests pre-run script ID | ||
branch: update-pre-run-script-id | ||
base: main | ||
delete-branch: true | ||
|
||
create-pr-previous-version: | ||
name: Create PR for previous version | ||
runs-on: ubuntu-latest | ||
needs: [update-pre-run-script] | ||
steps: | ||
- name: Checkout Package | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get Version | ||
id: get-version | ||
run: | | ||
current_version=$(.github/script/get-current-version) | ||
echo "::set-output name=version-number::$((${current_version%%.*} - 1))" | ||
- name: Update pre run script ID | ||
run: | | ||
echo "Updating integration tests pre-run script ID for previous major version branch" | ||
git checkout release-${{ steps.get-version.outputs.version-number }}.x | ||
SCRIPT_ID=${{ needs.update-pre-run-script.outputs.script-id }} | ||
sed -i -E "s/storage.*'/storage:$SCRIPT_ID'/g" ${GITHUB_WORKSPACE}/integration/js/utils/WebdriverSauceLabs.js | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@f094b77505fb89581e68a1163fbd2fffece39da1 | ||
with: | ||
commit-message: Update integration tests pre-run script ID | ||
title: Update integration tests pre-run script ID for previous release | ||
branch: update-pre-run-script-id-previous-release | ||
delete-branch: true |