feat: snowflake key auth server #3622
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: PR Automation test suite | |
on: | |
pull_request: | |
branches: [release] | |
types: | |
- opened | |
- labeled | |
jobs: | |
parse-tags: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
defaults: | |
run: | |
shell: bash | |
outputs: | |
tags: ${{ steps.checkAll.outputs.tags }} | |
matrix: ${{ steps.checkAll.outputs.matrix }} | |
steps: | |
# Checkout the code in the current branch in case the workflow is called because of a branch push event | |
- name: Checkout the head commit of the branch | |
uses: actions/checkout@v4 | |
with: | |
repository: appsmithorg/appsmith | |
# Checks for ok-to-test label presence in PR | |
- name: Check label | |
run: | | |
if [[ '${{ github.event.label.name }}' != 'ok-to-test' ]]; then | |
echo "Irrelevant label '${{ github.event.label.name }}' added! " | |
exit 1 | |
fi | |
# Reads the PR description to retrieve the /ok-to-test or, if that's absent, the /test command | |
- name: Get tags | |
uses: actions/github-script@v7 | |
id: getTags | |
env: | |
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts" | |
with: | |
script: | | |
const testTagParser = require("test-tag-parser.js") | |
core.setOutput("tags", testTagParser.parseTags({core, context})) | |
# Parses the retrieved /ok-to-test slash command to retrieve tags | |
- name: Parse tags | |
id: parseTags | |
run: | | |
if [[ '${{ steps.getTags.outputs.tags }}' != '' ]]; then | |
echo "tags=${{ steps.getTags.outputs.tags }}" >> $GITHUB_OUTPUT | |
echo "outcome=success" >> $GITHUB_OUTPUT | |
else | |
echo "Tags were not found!" | |
echo "outcome=failure" >> $GITHUB_OUTPUT | |
fi | |
# In case of missing tags, guides towards correct usage in test response | |
- name: Add test response with tags documentation link | |
if: steps.parseTags.outputs.outcome != 'success' | |
uses: actions/github-script@v7 | |
env: | |
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts" | |
BODY: | | |
The provided command lacks proper tags. Please modify PR body, specifying the tags you want to include or use `/ok-to-test tags="@tag.All"` to run all specs. | |
Explore the [tags documentation](https://www.notion.so/appsmith/Ok-to-test-With-Tags-7c0fc64d4efb4afebf53348cd6252918). | |
with: | |
script: | | |
require("write-cypress-status.js")({core, context, github}, "warning", process.env.BODY) | |
setFailed() | |
- name: Check Tags | |
env: | |
TAG_LIST: ${{ steps.getTags.outputs.tags }} | |
id: checkTags | |
run: | | |
export IFS="," | |
for tag in ${TAG_LIST//[[:blank:]]/}; do | |
if [[ `cat app/client/cypress/tags.js|grep -w $tag|wc -l` != 1 && $tag != "@tag.All" ]]; then | |
echo "Incorrect Tags" | |
echo "outcome=failure" >> $GITHUB_OUTPUT | |
fi | |
done | |
shell: bash | |
# In case of incorrect tags, guides towards correct tags | |
- name: Add test response with tags list link | |
if: steps.checkTags.outputs.outcome == 'failure' | |
uses: actions/github-script@v7 | |
env: | |
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts" | |
BODY: | | |
The provided command contains incorrect tags. Please modify PR body, specifying the tags you want to include or use `/ok-to-test tags="@tag.All"` to run all specs. | |
Please find [complete list of tags](https://github.com/appsmithorg/appsmith/blob/release/app/client/cypress/tags.js). | |
with: | |
script: | | |
require("write-cypress-status.js")({core, context, github}, "warning", process.env.BODY) | |
setFailed() | |
# In case of a run with all test cases, allocate a larger matrix | |
- name: Check if @tag.All is present in tags | |
id: checkAll | |
run: | | |
tags="${{ steps.parseTags.outputs.tags }}" | |
if [[ ($tags == *"ALL"* || $tags == *"All"* || $tags == *"all"*) && $tags != *"@tag.All"* ]]; then | |
echo "invalid_tags_all=$tags" >> $GITHUB_OUTPUT | |
elif [[ $tags == *"@tag.All"* ]]; then | |
echo "tags=" >> $GITHUB_OUTPUT | |
echo "matrix=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]" >> $GITHUB_OUTPUT | |
else | |
echo "tags=$tags" >> $GITHUB_OUTPUT | |
echo "matrix=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" >> $GITHUB_OUTPUT | |
fi | |
# In case of incorrect usage for all test cases, inform the PR author of correct usage | |
- name: Add test response to use correct @tag.All format | |
if: steps.checkAll.outputs.invalid_tags_all != '' | |
uses: actions/github-script@v7 | |
env: | |
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts" | |
BODY: | | |
Please use `/ok-to-test tags="@tag.All"` to run all specs. | |
Explore the [tags documentation](https://www.notion.so/appsmith/Ok-to-test-With-Tags-7c0fc64d4efb4afebf53348cd6252918). | |
with: | |
script: | | |
require("write-cypress-status.js")({core, context, github}, "warning", process.env.BODY) | |
core.setFailed() | |
# In case of a runnable command, update the PR with run details | |
- name: Add test response with link to workflow run | |
uses: actions/github-script@v7 | |
env: | |
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts" | |
BODY: | | |
Your tests are running. | |
Tests running at: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}> | |
Commit: ${{ github.event.pull_request.head.sha }} | |
Workflow: `${{ github.workflow }}` | |
Tags: `${{ steps.checkAll.outputs.tags }}` | |
with: | |
script: | | |
require("write-cypress-status.js")({core, context, github}, "important", process.env.BODY) | |
# Call the workflow to run Cypress tests | |
perform-test: | |
needs: [parse-tags] | |
if: success() | |
uses: ./.github/workflows/pr-cypress.yml | |
secrets: inherit | |
with: | |
tags: ${{ needs.parse-tags.outputs.tags}} | |
matrix: ${{ needs.parse-tags.outputs.matrix}} | |
is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }} |