feat: precommit pipeline for QA [WPB-11042] #8
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: precommit | |
on: | |
pull_request: | |
# we want to run the CI on every PR targetting those branches | |
branches: [dev] | |
concurrency: | |
group: precommit-deploy | |
cancel-in-progress: true | |
jobs: | |
procommit-deploy: | |
runs-on: buildjet-8vcpu-ubuntu-2204 | |
env: | |
DEPLOYMENT_RECOVERY_TIMEOUT_SECONDS: 150 | |
AWS_APPLICATION_NAME: Webapp | |
AWS_BUILD_ZIP_PATH: server/dist/s3/ebs.zip | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.16.x | |
cache: 'yarn' | |
- name: Install JS dependencies | |
run: yarn --immutable | |
- name: Fetch PR details | |
id: pr_details | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check total PR additions | |
id: check_additions | |
run: | | |
echo "${{ steps.pr_details.outputs.data }}" | jq '.additions' > total_additions.txt | |
total_additions=$(cat total_additions.txt) | |
echo "Total additions: $total_additions" | |
echo "total_additions=$total_additions" >> $GITHUB_ENV | |
- name: Deploy to precommit environment | |
if: ${{ steps.check_additions.outputs.total_additions > 100 && github.actor != 'dependabot[bot]' }} | |
uses: einaregilsson/beanstalk-deploy@v22 | |
with: | |
application_name: ${{ env.AWS_APPLICATION_NAME }} | |
aws_access_key: ${{ secrets.WEBTEAM_AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.WEBTEAM_AWS_SECRET_ACCESS_KEY }} | |
deployment_package: ${{ env.AWS_BUILD_ZIP_PATH }} | |
environment_name: wire-webapp-precommit | |
region: eu-central-1 | |
use_existing_version_if_available: true | |
version_description: ${{ github.sha }} | |
version_label: ${{ github.run_id }} | |
wait_for_deployment: false | |
wait_for_environment_recovery: ${{ env.DEPLOYMENT_RECOVERY_TIMEOUT_SECONDS }} |