[Tests] Run integration tests #20
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: "[Tests] Run integration tests" | |
on: | |
schedule: | |
- cron: '0 0 * * 1-5' # At 00:00 on every day-of-week from Monday through Friday | |
workflow_dispatch: # or manually | |
issue_comment: | |
types: [ created ] # or by comment | |
# TODO: update workflow permissions to least privilege after auditing all the APIs used | |
# permissions: # limit the permissions of the GITHIUB_TOKEN to reading repository contents | |
# contents: read | |
jobs: | |
cancel_previous: | |
permissions: | |
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows | |
if: ${{ github.event_name != 'issue_comment'}} | |
runs-on: macos-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.0 | |
with: | |
access_token: '${{ secrets.GITHUB_TOKEN }}' | |
run-it-full-suite: | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
fail-fast: false | |
outputs: | |
job_status: ${{ job.status }} | |
build-scan-url: ${{ steps.run-it.outputs.build-scan-url }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@v2 | |
with: | |
egress-policy: audit | |
# TODO: change to 'egress-policy: block' after auditing a number of runs and updating the allowed-endpoints option accordingly | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get PR Number | |
id: pr_number | |
run: | | |
PR_URL="${{ github.event.issue.pull_request.url }}" | |
PR_NUMBER=${PR_URL##*/} | |
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV | |
- name: Checkout Pull Request | |
if: github.event_name == 'issue_comment' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh pr checkout $PR_NUMBER | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: macos-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
macos-gradle- | |
- name: Prepare Google Service Account | |
env: | |
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }} | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
GCLOUD_DIR=$HOMEPATH\\.config\\gcloud\\ | |
mkdir -p $GCLOUD_DIR | |
echo $GCLOUD_KEY > key.txt | |
certutil -decode key.txt $GCLOUD_DIR\application_default_credentials.json | |
else | |
GCLOUD_DIR="$HOME/.config/gcloud/" | |
mkdir -p "$GCLOUD_DIR" | |
echo "$GCLOUD_KEY" | base64 --decode > "$GCLOUD_DIR/application_default_credentials.json" | |
fi | |
shell: bash | |
- name: Gradle integration tests | |
uses: gradle/gradle-build-action@v2.10.0 | |
id: run-it | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
HEAD_REF: ${{ github.ref }} | |
with: | |
arguments: "integrationTests" | |
- name: Export Variables for FlankScripts | |
if: ${{ always() }} | |
uses: UnlyEd/github-action-store-variable@v3.0.15 | |
with: | |
variables: | | |
${{ runner.os }}=${{ job.status }} | |
${{ runner.os }}-bs=${{steps.run-it.outputs.build-scan-url}} | |
trigger-pointer: | |
runs-on: ubuntu-latest | |
if: always() && github.event_name != 'issue_comment' | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@v2 | |
with: | |
egress-policy: audit | |
# TODO: change to 'egress-policy: block' after auditing a number of runs and updating the allowed-endpoints option accordingly | |
- uses: tibdex/github-app-token@v2 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.FLANK_RELEASE_APP_ID }} | |
private_key: ${{ secrets.FLANK_RELEASE_PRIVATE_KEY }} | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
event-type: integration-pointer |