Merge pull request #298 from docknetwork/AgneCaunt-patch-1 #311
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: Integration Tests | |
on: push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
actions: read | |
checks: write | |
pull-requests: read | |
jobs: | |
integrationTests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.17.1' | |
- name: Install GitHub CLI | |
run: | | |
sudo apt update | |
sudo apt install -y gh | |
- name: Fetch Open PR for Branch | |
id: pr_info | |
env: | |
BRANCH: ${{ github.ref_name }} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
# Check if the workflow was triggered by a merge event and a PR number is available | |
if [[ -n "${{ github.event.pull_request.number }}" ]]; then | |
# Fetch PR details directly using the PR number from the merge event | |
PR=$(gh pr view ${{ github.event.pull_request.number }} --json number,title) | |
echo "Fetching details for merged PR: ${{ github.event.pull_request.number }}" | |
else | |
# Fetch PR details based on the branch name for non-merge scenarios | |
PR=$(gh pr list --head $BRANCH --state open --json number,title -q ".[0]") | |
echo "Fetching details for open PR from branch: $BRANCH" | |
fi | |
PR_NUMBER=$(echo $PR | jq -r ".number") | |
PR_TITLE=$(echo $PR | jq -r ".title") | |
echo "PR Number: $PR_NUMBER" | |
echo "PR Title: $PR_TITLE" | |
echo "Branch: $BRANCH" | |
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT | |
echo "title=$PR_TITLE" >> $GITHUB_OUTPUT | |
- name: Debug GitHub Context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- name: Install dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build | |
- name: Lint | |
run: yarn lint | |
- name: Integration Tests | |
env: | |
SALES_CERTS_API_KEY: ${{ secrets.SALES_CERTS_API_KEY }} | |
CERTS_API_KEY: ${{ secrets.CERTS_API_KEY }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
PROOF_TEMPLATE_FOR_ANY_CREDENTIAL: ${{ vars.PROOF_TEMPLATE_FOR_ANY_CREDENTIAL }} | |
PR_LINK: ${{ github.server_url }}/${{ github.repository }}/pull/${{ steps.pr_info.outputs.number }} | |
PR_NUMBER: ${{ steps.pr_info.outputs.number }} | |
PR_TITLE: ${{ steps.pr_info.outputs.title }} | |
GITHUB_ACTION_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
TESTING_API_URL: ${{secrets.TESTING_API_URL}} | |
EDV_URL: ${{secrets.EDV_URL}} | |
EDV_AUTH_KEY: ${{secrets.EDV_AUTH_KEY}} | |
run: | | |
export NODE_OPTIONS="--max_old_space_size=12096" | |
export CI=true | |
echo "PR Number: $PR_NUMBER" | |
echo "PR Title: $PR_TITLE" | |
yarn test:integration | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
with: | |
name: Integration Test Report | |
path: reports/jest-*.xml | |
reporter: jest-junit |