From 0deba2479c28a88129a727c463b4f5efb14e7361 Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:13:37 -0400 Subject: [PATCH 01/17] Cleanup GitHub Actions Signed-off-by: James Talton --- .github/workflows/awx-e2e.yml | 179 --------------------- .github/workflows/awx-update-server.yml | 120 -------------- .github/workflows/component.yml | 49 +++--- .github/workflows/eda-e2e.yml | 128 --------------- .github/workflows/eda-update-server.yml | 120 -------------- .github/workflows/hub-e2e.yml | 142 ---------------- .github/workflows/hub-update-server.yml | 120 -------------- .github/workflows/labeler.yml | 13 -- .github/workflows/pull-request.yml | 93 ----------- .github/workflows/sync-downstream.yml | 28 ---- .github/workflows/upgrade-dependencies.yml | 28 ---- cypress/support/auth.ts | 4 - 12 files changed, 29 insertions(+), 995 deletions(-) delete mode 100644 .github/workflows/awx-e2e.yml delete mode 100644 .github/workflows/awx-update-server.yml delete mode 100644 .github/workflows/eda-e2e.yml delete mode 100644 .github/workflows/eda-update-server.yml delete mode 100644 .github/workflows/hub-e2e.yml delete mode 100644 .github/workflows/hub-update-server.yml delete mode 100644 .github/workflows/labeler.yml delete mode 100644 .github/workflows/sync-downstream.yml delete mode 100644 .github/workflows/upgrade-dependencies.yml diff --git a/.github/workflows/awx-e2e.yml b/.github/workflows/awx-e2e.yml deleted file mode 100644 index cd31bfb061..0000000000 --- a/.github/workflows/awx-e2e.yml +++ /dev/null @@ -1,179 +0,0 @@ -name: AWX E2E - -on: - workflow_call: - inputs: - AWX_SERVER: - type: string - required: true - SKIP_JOB: - type: boolean - required: false - default: false - TAGS: - type: string - required: false - secrets: - AWX_PASSWORD: - required: true - AWX_PROJECT_ID: - required: true - AWX_RECORD_KEY: - required: true - -jobs: - awx-ui-image: - name: AWX UI Image - runs-on: ubuntu-latest - # timeout-minutes: 10 - env: - DOCKER_BUILDKIT: 1 - steps: - - uses: actions/checkout@v4 - if: ${{ !inputs.SKIP_JOB }} - with: - fetch-depth: 1 - - - name: PreCache - if: ${{ !inputs.SKIP_JOB }} - run: npm version 0.0.0 --no-git-tag-version - - - name: Cache dependencies - if: ${{ !inputs.SKIP_JOB }} - id: cache - uses: actions/cache@v4 - with: - path: | - ./node_modules - /home/runner/.cache/Cypress - key: modules-${{ hashFiles('package-lock.json') }} - - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' && !inputs.SKIP_JOB - run: npm ci - - - name: NPM Build - if: ${{ !inputs.SKIP_JOB }} - run: npm run build:awx - - - name: Build Image - if: ${{ !inputs.SKIP_JOB }} - run: npm run docker:build:awx - - - name: Save Image - if: ${{ !inputs.SKIP_JOB }} - run: docker save awx-ui > awx-ui.tar - - - name: Upload Image - if: ${{ !inputs.SKIP_JOB }} - uses: actions/upload-artifact@v4 - with: - name: awx-ui.tar - path: awx-ui.tar - - generate-matrix: - name: Generate Test Matrix - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.MATRIX }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Generate matrix - id: set-matrix - run: | - matrix=$(find cypress/e2e/awx -maxdepth 1 -type d -not -path 'cypress/e2e/awx' | sed 's|cypress/e2e/awx/||' | jq -R . | jq -s -c .) - echo "Matrix value: $matrix" - echo "MATRIX=$matrix" >> $GITHUB_OUTPUT - - awx-e2e: - name: AWX E2E - runs-on: ubuntu-latest - needs: - - awx-ui-image - - generate-matrix - strategy: - fail-fast: false - matrix: - containers: ${{ contains(github.event.pull_request.labels.*.name, 'dashboard') && fromJson('[1,2,3,4]') || fromJson(needs.generate-matrix.outputs.MATRIX) }} - steps: - - name: Download container image - if: ${{ !inputs.SKIP_JOB }} - uses: actions/download-artifact@v4 - with: - name: awx-ui.tar - - - name: Load container image - if: ${{ !inputs.SKIP_JOB }} - run: docker load --input awx-ui.tar - - - name: Checkout - if: ${{ !inputs.SKIP_JOB }} - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Setup node - if: ${{ !inputs.SKIP_JOB }} - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: PreCache - if: ${{ !inputs.SKIP_JOB }} - run: npm version 0.0.0 --no-git-tag-version - - - name: Cache dependencies - if: ${{ !inputs.SKIP_JOB }} - id: cache - uses: actions/cache@v4 - with: - path: | - ./node_modules - /home/runner/.cache/Cypress - key: modules-${{ hashFiles('package-lock.json') }} - - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' && !inputs.SKIP_JOB - run: npm ci - - - name: Cypress with Recording - if: ${{ !inputs.SKIP_JOB && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'dashboard')) }} - uses: cypress-io/github-action@v6 - with: - install: false - start: npm run docker:run:awx - wait-on: 'https://localhost:4101' - record: true - parallel: true - config-file: cypress.awx.config.ts - tag: ${{ inputs.TAGS }} - env: - AWX_SERVER: ${{ inputs.AWX_SERVER }} - AWX_USERNAME: e2e - AWX_PASSWORD: ${{ secrets.AWX_PASSWORD }} - CYPRESS_PROJECT_ID: ${{ secrets.AWX_PROJECT_ID }} - CYPRESS_RECORD_KEY: ${{ secrets.AWX_RECORD_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_TLS_REJECT_UNAUTHORIZED: 0 - CYPRESS_LABELS: '!flaky' - - - name: Cypress without Recording - if: ${{ !inputs.SKIP_JOB && github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'dashboard') }} - uses: cypress-io/github-action@v6 - with: - install: false - start: npm run docker:run:awx - wait-on: 'https://localhost:4101' - config-file: cypress.awx.config.ts - spec: cypress/e2e/awx/${{ matrix.containers }}/**/*.cy.ts - tag: ${{ inputs.TAGS }} - env: - AWX_SERVER: ${{ inputs.AWX_SERVER }} - AWX_USERNAME: e2e - AWX_PASSWORD: ${{ secrets.AWX_PASSWORD }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_TLS_REJECT_UNAUTHORIZED: 0 - CYPRESS_LABELS: '!flaky' - diff --git a/.github/workflows/awx-update-server.yml b/.github/workflows/awx-update-server.yml deleted file mode 100644 index 2cdf9ebd75..0000000000 --- a/.github/workflows/awx-update-server.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: AWX Update E2E Server - -on: - workflow_dispatch: - inputs: - AWX_SERVER: - type: string - description: 'AWX Server' - UPDATE_SERVER: - type: boolean - required: true - default: false - description: 'Update server on success' - schedule: - - cron: '0 8 * * *' - -jobs: - setup: - name: Setup - runs-on: ubuntu-latest - outputs: - AWX_SERVER: ${{ steps.step1.outputs.AWX_SERVER }} - UPDATE_SERVER: ${{ steps.step1.outputs.UPDATE_SERVER }} - steps: - - id: step1 - run: | - CURRENTDATE=$(date +'%Y%m%d') - if([ "${{ github.event_name }}" == "workflow_dispatch" ]); then - echo "AWX_SERVER=${{ github.event.inputs.AWX_SERVER || 'https://awx.ci-ui-${CURRENTDATE}.gcp.testing.ansible.com' }}" >> "$GITHUB_OUTPUT" - echo "UPDATE_SERVER=${{ github.event.inputs.UPDATE_SERVER }}" >> "$GITHUB_OUTPUT" - else - echo "AWX_SERVER=https://awx.ci-ui-${CURRENTDATE}.gcp.testing.ansible.com" >> "$GITHUB_OUTPUT" - echo "UPDATE_SERVER=true" >> "$GITHUB_OUTPUT" - fi - - awx-e2e: - name: AWX E2E - needs: setup - uses: ./.github/workflows/awx-e2e.yml - with: - AWX_SERVER: ${{ needs.setup.outputs.AWX_SERVER }} - secrets: - AWX_PASSWORD: ${{ secrets.AWX_PASSWORD }} - AWX_PROJECT_ID: ${{ secrets.AWX_PROJECT_ID }} - AWX_RECORD_KEY: ${{ secrets.AWX_RECORD_KEY }} - - awx-update-server: - name: AWX Update Server - if: ${{ needs.setup.outputs.UPDATE_SERVER == 'true' }} - needs: - - awx-e2e - - setup - runs-on: ubuntu-latest - steps: - - name: Update Server Variable - run: | - curl -f -L -X PATCH -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/${{ github.repository }}/actions/variables/AWX_SERVER" \ - -d '{"name":"AWX_SERVER","value":"${{ needs.setup.outputs.AWX_SERVER }}"}' - - name: Slack Notification - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "attachments": - [ - { - "color": "#00DD00", - "blocks": - [ - { - "type": "section", - "text": - { - "type": "mrkdwn", - "text": "*Ansible-UI AWX E2E Server Updated* - <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Success> - <${{ needs.setup.outputs.AWX_SERVER }}|Server>" - } - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - - slack-failure-notification: - name: Slack Failure Notification - if: ${{ failure() && needs.setup.outputs.UPDATE_SERVER == 'true' }} - needs: - - awx-update-server - - setup - runs-on: ubuntu-latest - steps: - - name: Slack Notification - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "attachments": - [ - { - "color": "#FF0000", - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Ansible-UI AWX E2E Server Update Failed* - *<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Failure>* - <${{ needs.setup.outputs.AWX_SERVER }}|Server>" - } - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK \ No newline at end of file diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index 3d22302555..d97fa71917 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -1,42 +1,46 @@ -name: Pull Request +name: Component on: workflow_call: - secrets: - COMPONENT_PROJECT_ID: - required: true - COMPONENT_RECORD_KEY: - required: true + jobs: + generate-matrix: + name: Generate Test Matrix + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.MATRIX }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Generate matrix + id: set-matrix + run: | + matrix=$(find frontend -type f -name '*.cy.tsx' | awk -F'/' '{print $1"/"$2"/"$3}' | sort -u | jq -R . | jq -s -c .) + echo "Matrix value: $matrix" + echo "MATRIX=$matrix" >> $GITHUB_OUTPUT + component: name: Component runs-on: ubuntu-latest strategy: fail-fast: true matrix: - task: [ - "awx:access", - "awx:administration", - "awx:common", - "awx:overview", - "awx:resources", - "awx:views", - "eda", - "hub", - "common", - "framework" - ] + directory: ${{ fromJson(needs.generate-matrix.outputs.MATRIX) }} steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 + - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 + - name: PreCache run: npm version 0.0.0 --no-git-tag-version + - name: Cache dependencies id: cache uses: actions/cache@v4 @@ -45,8 +49,13 @@ jobs: ./node_modules /home/runner/.cache/Cypress key: modules-${{ hashFiles('package-lock.json') }} + - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' run: npm ci - - name: Run Cypress component tests ${{ matrix.task }} - run: npm run component:${{ matrix.task }} + + - name: Cypress + uses: cypress-io/github-action@v6 + with: + install: false + spec: frontend/${{ matrix.directory }}/**/*.cy.ts diff --git a/.github/workflows/eda-e2e.yml b/.github/workflows/eda-e2e.yml deleted file mode 100644 index b16e9d1633..0000000000 --- a/.github/workflows/eda-e2e.yml +++ /dev/null @@ -1,128 +0,0 @@ -name: EDA E2E - -on: - workflow_call: - inputs: - EDA_SERVER: - type: string - required: true - SKIP_JOB: - type: boolean - required: false - default: false - TAGS: - type: string - required: false - secrets: - EDA_PASSWORD: - required: true - EDA_PROJECT_ID: - required: true - EDA_RECORD_KEY: - required: true - -jobs: - eda-ui-image: - name: EDA UI Image - runs-on: ubuntu-latest - # timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - if: ${{ !inputs.SKIP_JOB }} - with: - fetch-depth: 1 - - name: PreCache - if: ${{ !inputs.SKIP_JOB }} - run: npm version 0.0.0 --no-git-tag-version - - name: Cache dependencies - if: ${{ !inputs.SKIP_JOB }} - id: cache - uses: actions/cache@v4 - with: - path: | - ./node_modules - /home/runner/.cache/Cypress - key: modules-${{ hashFiles('package-lock.json') }} - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' && !inputs.SKIP_JOB - run: npm ci - - name: NPM Build - if: ${{ !inputs.SKIP_JOB }} - run: npm run build:eda - - name: Build Image - if: ${{ !inputs.SKIP_JOB }} - run: npm run docker:build:eda - - name: Save Image - if: ${{ !inputs.SKIP_JOB }} - run: docker save eda-ui > eda-ui.tar - - name: Upload Image - if: ${{ !inputs.SKIP_JOB }} - uses: actions/upload-artifact@v4 - with: - name: eda-ui.tar - path: eda-ui.tar - - eda-e2e: - name: EDA E2E - runs-on: ubuntu-latest - # timeout-minutes: 15 - needs: eda-ui-image - strategy: - fail-fast: false - matrix: - containers: [1] - steps: - - name: Checkout - if: ${{ !inputs.SKIP_JOB }} - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Download container image - if: ${{ !inputs.SKIP_JOB }} - uses: actions/download-artifact@v4 - with: - name: eda-ui.tar - - name: Load container image - if: ${{ !inputs.SKIP_JOB }} - run: docker load --input eda-ui.tar - - name: Setup Node - if: ${{ !inputs.SKIP_JOB }} - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: PreCache - if: ${{ !inputs.SKIP_JOB }} - run: npm version 0.0.0 --no-git-tag-version - - name: Cache dependencies - if: ${{ !inputs.SKIP_JOB }} - id: cache - uses: actions/cache@v4 - with: - path: | - ./node_modules - /home/runner/.cache/Cypress - key: modules-${{ hashFiles('package-lock.json') }} - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' && !inputs.SKIP_JOB - run: npm ci - - name: Cypress - if: ${{ !inputs.SKIP_JOB }} - uses: cypress-io/github-action@v6 - with: - install: false - start: npm run docker:run:eda - wait-on: 'https://localhost:4103' - record: true - parallel: true - # auto-cancel-after-failures: 1 - config-file: cypress.eda.config.ts - tag: ${{ inputs.TAGS }} - env: - EDA_SERVER: ${{ inputs.EDA_SERVER }} - EDA_USERNAME: e2e - EDA_PASSWORD: ${{ secrets.EDA_PASSWORD }} - CYPRESS_PROJECT_ID: ${{ secrets.EDA_PROJECT_ID }} - CYPRESS_RECORD_KEY: ${{ secrets.EDA_RECORD_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_TLS_REJECT_UNAUTHORIZED: 0 - CYPRESS_LABELS: '!flaky' diff --git a/.github/workflows/eda-update-server.yml b/.github/workflows/eda-update-server.yml deleted file mode 100644 index 0c77975cbe..0000000000 --- a/.github/workflows/eda-update-server.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: EDA Update E2E Server - -on: - workflow_dispatch: - inputs: - EDA_SERVER: - type: string - description: 'EDA Server' - UPDATE_SERVER: - type: boolean - required: true - default: false - description: 'Update server on success' - schedule: - - cron: '0 8 * * *' - -jobs: - setup: - name: Setup - runs-on: ubuntu-latest - outputs: - EDA_SERVER: ${{ steps.step1.outputs.EDA_SERVER }} - UPDATE_SERVER: ${{ steps.step1.outputs.UPDATE_SERVER }} - steps: - - id: step1 - run: | - CURRENTDATE=$(date +'%Y%m%d') - if([ "${{ github.event_name }}" == "workflow_dispatch" ]); then - echo "EDA_SERVER=${{ github.event.inputs.EDA_SERVER || 'https://eda.ci-ui-${CURRENTDATE}.gcp.testing.ansible.com' }}" >> "$GITHUB_OUTPUT" - echo "UPDATE_SERVER=${{ github.event.inputs.UPDATE_SERVER }}" >> "$GITHUB_OUTPUT" - else - echo "EDA_SERVER=https://eda.ci-ui-${CURRENTDATE}.gcp.testing.ansible.com" >> "$GITHUB_OUTPUT" - echo "UPDATE_SERVER=true" >> "$GITHUB_OUTPUT" - fi - - eda-e2e: - name: EDA E2E - needs: setup - uses: ./.github/workflows/eda-e2e.yml - with: - EDA_SERVER: ${{ needs.setup.outputs.EDA_SERVER }} - secrets: - EDA_PASSWORD: ${{ secrets.EDA_PASSWORD }} - EDA_PROJECT_ID: ${{ secrets.EDA_PROJECT_ID }} - EDA_RECORD_KEY: ${{ secrets.EDA_RECORD_KEY }} - - eda-update-server: - name: EDA Update Server - if: ${{ needs.setup.outputs.UPDATE_SERVER == 'true' }} - needs: - - eda-e2e - - setup - runs-on: ubuntu-latest - steps: - - name: Update Server Variable - run: | - curl -f -L -X PATCH -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/${{ github.repository }}/actions/variables/EDA_SERVER" \ - -d '{"name":"EDA_SERVER","value":"${{ needs.setup.outputs.EDA_SERVER }}"}' - - name: Slack Notification - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "attachments": - [ - { - "color": "#00DD00", - "blocks": - [ - { - "type": "section", - "text": - { - "type": "mrkdwn", - "text": "*Ansible-UI EDA E2E Server Updated* - <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Success> - <${{ needs.setup.outputs.EDA_SERVER }}|Server>" - } - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - - slack-failure-notification: - name: Slack Failure Notification - if: ${{ failure() && needs.setup.outputs.UPDATE_SERVER == 'true' }} - needs: - - eda-update-server - - setup - runs-on: ubuntu-latest - steps: - - name: Slack Notification - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "attachments": - [ - { - "color": "#FF0000", - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Ansible-UI EDA E2E Server Update Failed* - *<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Failure>* - <${{ needs.setup.outputs.EDA_SERVER }}|Server>" - } - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK \ No newline at end of file diff --git a/.github/workflows/hub-e2e.yml b/.github/workflows/hub-e2e.yml deleted file mode 100644 index b2782ee917..0000000000 --- a/.github/workflows/hub-e2e.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: HUB E2E - -on: - workflow_call: - inputs: - HUB_SERVER: - type: string - required: true - SKIP_JOB: - type: boolean - required: false - default: false - TAGS: - type: string - required: false - secrets: - HUB_PASSWORD: - required: true - HUB_PROJECT_ID: - required: true - HUB_RECORD_KEY: - required: true - -jobs: - hub-ui-image: - name: HUB UI Image - runs-on: ubuntu-latest - # timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - if: ${{ !inputs.SKIP_JOB }} - with: - fetch-depth: 1 - - name: PreCache - if: ${{ !inputs.SKIP_JOB }} - run: npm version 0.0.0 --no-git-tag-version - - name: Cache dependencies - if: ${{ !inputs.SKIP_JOB }} - id: cache - uses: actions/cache@v4 - with: - path: | - ./node_modules - /home/runner/.cache/Cypress - key: modules-${{ hashFiles('package-lock.json') }} - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' && !inputs.SKIP_JOB - run: npm ci - - name: NPM Build - if: ${{ !inputs.SKIP_JOB }} - run: npm run build:hub - env: - HUB_API_PREFIX: '/api/galaxy' - - name: Build Image - if: ${{ !inputs.SKIP_JOB }} - run: npm run docker:build:hub - - name: Save Image - if: ${{ !inputs.SKIP_JOB }} - run: docker save hub-ui > hub-ui.tar - - name: Upload Image - if: ${{ !inputs.SKIP_JOB }} - uses: actions/upload-artifact@v4 - with: - name: hub-ui.tar - path: hub-ui.tar - - hub-e2e: - name: HUB E2E - runs-on: ubuntu-latest - # timeout-minutes: 20 - needs: hub-ui-image - strategy: - fail-fast: false - matrix: - containers: [1] - steps: - - name: Checkout - if: ${{ !inputs.SKIP_JOB }} - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Download container image - if: ${{ !inputs.SKIP_JOB }} - uses: actions/download-artifact@v4 - with: - name: hub-ui.tar - - name: Load container image - if: ${{ !inputs.SKIP_JOB }} - run: docker load --input hub-ui.tar - - name: Setup Node - if: ${{ !inputs.SKIP_JOB }} - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: PreCache - if: ${{ !inputs.SKIP_JOB }} - run: npm version 0.0.0 --no-git-tag-version - - name: Cache dependencies - if: ${{ !inputs.SKIP_JOB }} - id: cache - uses: actions/cache@v4 - with: - path: | - ./node_modules - /home/runner/.cache/Cypress - key: modules-${{ hashFiles('package-lock.json') }} - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' && !inputs.SKIP_JOB - run: npm ci - - # galaxykit needs pip 23+, Ubuntu 22.04's default Python uses pip 22 - - name: "Install python 3.11" - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Install galaxykit - run: | - # pip3 install galaxykit - # pending a release with https://github.com/ansible/galaxykit/pull/116 - pip3 install git+https://github.com/ansible/galaxykit.git@main - - - name: Cypress - if: ${{ !inputs.SKIP_JOB }} - uses: cypress-io/github-action@v6 - with: - install: false - start: npm run docker:run:hub - wait-on: 'https://localhost:4102' - record: true - parallel: true - config-file: cypress.hub.config.ts - tag: ${{ inputs.TAGS }} - env: - HUB_SERVER: ${{ inputs.HUB_SERVER }} - HUB_USERNAME: e2e - HUB_PASSWORD: ${{ secrets.HUB_PASSWORD }} - HUB_API_PREFIX: '/api/galaxy' - CYPRESS_PROJECT_ID: ${{ secrets.HUB_PROJECT_ID }} - CYPRESS_RECORD_KEY: ${{ secrets.HUB_RECORD_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_TLS_REJECT_UNAUTHORIZED: 0 - CYPRESS_LABELS: '!flaky' diff --git a/.github/workflows/hub-update-server.yml b/.github/workflows/hub-update-server.yml deleted file mode 100644 index 8a4c5e12e7..0000000000 --- a/.github/workflows/hub-update-server.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: HUB Update E2E Server - -on: - workflow_dispatch: - inputs: - HUB_SERVER: - type: string - description: 'HUB Server' - UPDATE_SERVER: - type: boolean - required: true - default: false - description: 'Update server on success' - schedule: - - cron: '0 8 * * *' - -jobs: - setup: - name: Setup - runs-on: ubuntu-latest - outputs: - HUB_SERVER: ${{ steps.step1.outputs.HUB_SERVER }} - UPDATE_SERVER: ${{ steps.step1.outputs.UPDATE_SERVER }} - steps: - - id: step1 - run: | - CURRENTDATE=$(date +'%Y%m%d') - if([ "${{ github.event_name }}" == "workflow_dispatch" ]); then - echo "HUB_SERVER=${{ github.event.inputs.HUB_SERVER || 'https://galaxy.ci-ui-${CURRENTDATE}.gcp.testing.ansible.com' }}" >> "$GITHUB_OUTPUT" - echo "UPDATE_SERVER=${{ github.event.inputs.UPDATE_SERVER }}" >> "$GITHUB_OUTPUT" - else - echo "HUB_SERVER=https://galaxy.ci-ui-${CURRENTDATE}.gcp.testing.ansible.com" >> "$GITHUB_OUTPUT" - echo "UPDATE_SERVER=true" >> "$GITHUB_OUTPUT" - fi - - hub-e2e: - name: HUB E2E - needs: setup - uses: ./.github/workflows/hub-e2e.yml - with: - HUB_SERVER: ${{ needs.setup.outputs.HUB_SERVER }} - secrets: - HUB_PASSWORD: ${{ secrets.HUB_PASSWORD }} - HUB_PROJECT_ID: ${{ secrets.HUB_PROJECT_ID }} - HUB_RECORD_KEY: ${{ secrets.HUB_RECORD_KEY }} - - hub-update-server: - name: HUB Update Server - if: ${{ needs.setup.outputs.UPDATE_SERVER == 'true' }} - needs: - - hub-e2e - - setup - runs-on: ubuntu-latest - steps: - - name: Update Server Variable - run: | - curl -f -L -X PATCH -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/${{ github.repository }}/actions/variables/HUB_SERVER" \ - -d '{"name":"HUB_SERVER","value":"${{ needs.setup.outputs.HUB_SERVER }}"}' - - name: Slack Notification - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "attachments": - [ - { - "color": "#00DD00", - "blocks": - [ - { - "type": "section", - "text": - { - "type": "mrkdwn", - "text": "*Ansible-UI Galaxy E2E Server Updated* - <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Success> - <${{ needs.setup.outputs.HUB_SERVER }}|Server>" - } - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - - slack-failure-notification: - name: Slack Failure Notification - if: ${{ failure() && needs.setup.outputs.UPDATE_SERVER == 'true' }} - needs: - - hub-update-server - - setup - runs-on: ubuntu-latest - steps: - - name: Slack Notification - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "attachments": - [ - { - "color": "#FF0000", - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Ansible-UI Galaxy E2E Server Update Failed* - *<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Failure>* - <${{ needs.setup.outputs.HUB_SERVER }}|Server>" - } - } - ] - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK \ No newline at end of file diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index e79e048893..0000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Labeler -on: - - pull_request_target - -jobs: - add-labels: - name: Labeler - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@v4 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index fda27d953a..8dfe9faa67 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -2,10 +2,6 @@ name: Pull Request on: pull_request: - types: [opened, synchronize, labeled, unlabeled] - -env: - IS_GITHUB_ACTION: true concurrency: group: ${{ github.ref }} @@ -15,15 +11,8 @@ jobs: packages: name: Packages runs-on: ubuntu-latest - # timeout-minutes: 10 - outputs: - awx: ${{ steps.changed-awx.outputs.changed == 'true' }} - hub: ${{ steps.changed-hub.outputs.changed == 'true' }} - eda: ${{ steps.changed-eda.outputs.changed == 'true' }} steps: - uses: actions/checkout@v4 - with: - fetch-depth: 100 - uses: actions/setup-node@v4 with: node-version: 20 @@ -40,47 +29,13 @@ jobs: - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' run: npm ci - - id: changed-awx - run: | - if $(git diff --quiet HEAD^ HEAD -- frontend/awx frontend/common cypress/e2e/awx framework cypress/support package.json); then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" - fi - - id: changed-hub - run: | - if $(git diff --quiet HEAD^ HEAD -- frontend/hub frontend/common cypress/e2e/hub framework cypress/support package.json); then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" - fi - - id: changed-eda - run: | - if $(git diff --quiet HEAD^ HEAD -- frontend/eda frontend/common cypress/e2e/eda framework cypress/support package.json); then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" - fi - - pr-queue: - name: PR Queue - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ahmadnassri/action-workflow-queue@v1 - with: - delay: 60000 - timeout: 14400000 checks: name: ESLint - Prettier - TSC runs-on: ubuntu-latest - # timeout-minutes: 10 needs: packages steps: - uses: actions/checkout@v4 - with: - fetch-depth: 1 - uses: actions/setup-node@v4 with: node-version: 20 @@ -99,55 +54,10 @@ jobs: run: npm ci - run: npm run checks - awx-e2e: - name: AWX E2E - needs: - - packages - - pr-queue - uses: ./.github/workflows/awx-e2e.yml - with: - AWX_SERVER: ${{ vars.AWX_SERVER }} - SKIP_JOB: ${{ needs.packages.outputs.awx != 'true' }} - secrets: - AWX_PASSWORD: ${{ secrets.AWX_PASSWORD }} - AWX_PROJECT_ID: ${{ secrets.AWX_PROJECT_ID }} - AWX_RECORD_KEY: ${{ secrets.AWX_RECORD_KEY }} - - # eda-e2e: - # name: EDA E2E - # needs: - # - packages - # - pr-queue - # uses: ./.github/workflows/eda-e2e.yml - # with: - # EDA_SERVER: ${{ vars.EDA_SERVER }} - # SKIP_JOB: ${{ needs.packages.outputs.eda != 'true' }} - # secrets: - # EDA_PASSWORD: ${{ secrets.EDA_PASSWORD }} - # EDA_PROJECT_ID: ${{ secrets.EDA_PROJECT_ID }} - # EDA_RECORD_KEY: ${{ secrets.EDA_RECORD_KEY }} - - hub-e2e: - name: HUB E2E - needs: - - packages - - pr-queue - uses: ./.github/workflows/hub-e2e.yml - with: - HUB_SERVER: ${{ vars.HUB_SERVER }} - SKIP_JOB: ${{ needs.packages.outputs.hub != 'true' }} - secrets: - HUB_PASSWORD: ${{ secrets.HUB_PASSWORD }} - HUB_PROJECT_ID: ${{ secrets.HUB_PROJECT_ID }} - HUB_RECORD_KEY: ${{ secrets.HUB_RECORD_KEY }} - component: name: Component needs: packages uses: ./.github/workflows/component.yml - secrets: - COMPONENT_PROJECT_ID: ${{ secrets.COMPONENT_PROJECT_ID }} - COMPONENT_RECORD_KEY: ${{ secrets.COMPONENT_RECORD_KEY }} success: name: Success @@ -156,8 +66,5 @@ jobs: needs: - checks - component - - awx-e2e - # - eda-e2e - - hub-e2e steps: - run: echo Success diff --git a/.github/workflows/sync-downstream.yml b/.github/workflows/sync-downstream.yml deleted file mode 100644 index 8a9ef9bdeb..0000000000 --- a/.github/workflows/sync-downstream.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Sync Downstream - -on: - push: - branches: - - main - workflow_dispatch: - -concurrency: main - -jobs: - merge-to-downstream: - name: Merge Main to Downstream - runs-on: ubuntu-latest - # timeout-minutes: 10 - - steps: - - name: Downstream Merge - if: github.repository == 'ansible/ansible-ui' - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: | - curl -L -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${GH_TOKEN}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/ansible/aap-ui/dispatches \ - -d '{"event_type":"sync"}' diff --git a/.github/workflows/upgrade-dependencies.yml b/.github/workflows/upgrade-dependencies.yml deleted file mode 100644 index be774264a4..0000000000 --- a/.github/workflows/upgrade-dependencies.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Upgrade Dependencies - -on: - workflow_dispatch: - schedule: - - cron: '15 20 * * *' - -concurrency: upgrade - -jobs: - upgrade-dependencies: - name: Upgrade Package Dependencies - if: (github.event_name == 'schedule' && github.repository == 'ansible/ansible-ui') || (github.event_name != 'schedule') - runs-on: ubuntu-latest - # timeout-minutes: 110 - steps: - - run: sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb - - uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_TOKEN }} - - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: https://registry.npmjs.org/ - - run: npm run upgrade - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Upgraded package dependencies [skip ci] diff --git a/cypress/support/auth.ts b/cypress/support/auth.ts index 1f8514f09e..9b449b138a 100644 --- a/cypress/support/auth.ts +++ b/cypress/support/auth.ts @@ -3,10 +3,6 @@ import { edaAPI } from './formatApiPathForEDA'; import { hubAPI } from './formatApiPathForHub'; Cypress.Commands.add('requiredVariablesAreSet', (requiredVariables: string[]) => { - if (Cypress.env('IS_GITHUB_ACTION') || process.env.IS_GITHUB_ACTION) { - cy.log('Skipping requiredVariablesAreSet check in GitHub Actions'); - return; - } requiredVariables.forEach((variable) => { if (!Cypress.env(variable)) { throw new Error(`Missing required environment variable: ${variable}`); From dd80bc60e8d558013e86f1a0bedb8f7e0e4e0298 Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:19:22 -0400 Subject: [PATCH 02/17] fixes Signed-off-by: James Talton --- .github/labeler.yml | 21 --------------------- .github/workflows/component.yml | 8 ++++---- 2 files changed, 4 insertions(+), 25 deletions(-) delete mode 100644 .github/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index fa8aa8dde9..0000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,21 +0,0 @@ -AWX: - - frontend/awx/**/* - - cypress/e2e/awx/**/* - -EDA: - - frontend/eda/**/* - - cypress/e2e/eda/**/* - -HUB: - - frontend/hub/**/* - - cypress/e2e/hub/**/* - -E2E: - - cypress/e2e/** - -CCT: - - framework/**/*.cy.* - - frontend/**/*.cy.* - -AFW: - - framework/**/* diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index d97fa71917..50f14ed5cb 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -4,8 +4,8 @@ on: workflow_call: jobs: - generate-matrix: - name: Generate Test Matrix + test-matrix: + name: Test Matrix runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.MATRIX }} @@ -23,10 +23,10 @@ jobs: component: name: Component runs-on: ubuntu-latest + needs: test-matrix strategy: - fail-fast: true matrix: - directory: ${{ fromJson(needs.generate-matrix.outputs.MATRIX) }} + directory: ${{ fromJson(needs.test-matrix.outputs.MATRIX) }} steps: - name: Checkout uses: actions/checkout@v4 From c70eaadbb566b18b107a641cd9084e340b31e81b Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:22:34 -0400 Subject: [PATCH 03/17] fix Signed-off-by: James Talton --- .github/workflows/component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index 50f14ed5cb..b26c9c24da 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -58,4 +58,4 @@ jobs: uses: cypress-io/github-action@v6 with: install: false - spec: frontend/${{ matrix.directory }}/**/*.cy.ts + spec: ${{ matrix.directory }}/**/*.cy.ts From c3f0d1c88432d666f875cd1329042adcdf4c2c6a Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:25:14 -0400 Subject: [PATCH 04/17] fix Signed-off-by: James Talton --- .github/workflows/component.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index b26c9c24da..67832202b6 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -25,6 +25,7 @@ jobs: runs-on: ubuntu-latest needs: test-matrix strategy: + fail-fast: false matrix: directory: ${{ fromJson(needs.test-matrix.outputs.MATRIX) }} steps: From 28d6243d74b29bbd3112e80b79544e21b95ee286 Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:25:34 -0400 Subject: [PATCH 05/17] fix Signed-off-by: James Talton --- .github/workflows/component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index 67832202b6..bf283f8ae7 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -59,4 +59,4 @@ jobs: uses: cypress-io/github-action@v6 with: install: false - spec: ${{ matrix.directory }}/**/*.cy.ts + spec: ${{ matrix.directory }}/**/*.cy.tsx From 86b2a8ec5ea2e725f3d54eaa0a2c22c9a5b46506 Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:28:15 -0400 Subject: [PATCH 06/17] fix Signed-off-by: James Talton --- .github/workflows/component.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index bf283f8ae7..6f36039aa5 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -59,4 +59,5 @@ jobs: uses: cypress-io/github-action@v6 with: install: false + component: true spec: ${{ matrix.directory }}/**/*.cy.tsx From 7c716c2b202dd688ee566e670194aed810b890b6 Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:38:32 -0400 Subject: [PATCH 07/17] fix testing Signed-off-by: James Talton --- .github/workflows/component.yml | 6 +++--- .../access/organizations/OrganizationForm.tsx | 4 ++-- frontend/awx/access/roles/RoleForm.tsx | 8 ++++---- frontend/awx/main/AwxLogin.tsx | 2 +- .../{ => AnsibleLogin}/AnsibleLogin.cy.tsx | 0 .../common/{ => AnsibleLogin}/AnsibleLogin.tsx | 14 +++++++------- frontend/common/crud/useDeleteRequest.tsx | 2 +- frontend/common/crud/usePatchRequest.tsx | 2 +- frontend/common/crud/usePostRequest.tsx | 2 +- frontend/common/crud/usePutRequest.tsx | 2 +- .../useInvalidateCache.cy.tsx | 0 .../useInvalidateCache.tsx | 0 .../OrganizationPage/OrganizationForm.tsx | 4 ++-- frontend/eda/access/roles/RoleForm.tsx | 8 ++++---- .../eda/access/teams/TeamPage/TeamForm.tsx | 8 ++++---- frontend/eda/main/EdaLogin.tsx | 2 +- .../hub/access/roles/RolePage/HubRoleForm.tsx | 18 +++++++++--------- .../remote-registries/RemoteRegistryForm.tsx | 2 +- .../hub/administration/remotes/RemoteForm.tsx | 2 +- frontend/hub/main/HubLogin.tsx | 2 +- frontend/hub/namespaces/HubNamespaceForm.tsx | 2 +- 21 files changed, 45 insertions(+), 45 deletions(-) rename frontend/common/{ => AnsibleLogin}/AnsibleLogin.cy.tsx (100%) rename frontend/common/{ => AnsibleLogin}/AnsibleLogin.tsx (94%) rename frontend/common/{ => useInvalidateCache}/useInvalidateCache.cy.tsx (100%) rename frontend/common/{ => useInvalidateCache}/useInvalidateCache.tsx (100%) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index 6f36039aa5..99ce679294 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -4,7 +4,7 @@ on: workflow_call: jobs: - test-matrix: + generate-matrix: name: Test Matrix runs-on: ubuntu-latest outputs: @@ -23,11 +23,11 @@ jobs: component: name: Component runs-on: ubuntu-latest - needs: test-matrix + needs: generate-matrix strategy: fail-fast: false matrix: - directory: ${{ fromJson(needs.test-matrix.outputs.MATRIX) }} + directory: ${{ fromJson(needs.generate-matrix.outputs.MATRIX) }} steps: - name: Checkout uses: actions/checkout@v4 diff --git a/frontend/awx/access/organizations/OrganizationForm.tsx b/frontend/awx/access/organizations/OrganizationForm.tsx index 3b5ac83f2e..eadf965774 100644 --- a/frontend/awx/access/organizations/OrganizationForm.tsx +++ b/frontend/awx/access/organizations/OrganizationForm.tsx @@ -11,15 +11,15 @@ import { import { PageFormTextInput } from '../../../../framework/PageForm/Inputs/PageFormTextInput'; import { requestGet, requestPatch, swrOptions } from '../../../common/crud/Data'; import { usePostRequest } from '../../../common/crud/usePostRequest'; -import { useInvalidateCacheOnUnmount } from '../../../common/useInvalidateCache'; +import { useInvalidateCacheOnUnmount } from '../../../common/useInvalidateCache/useInvalidateCache'; import { PageFormSelectExecutionEnvironment } from '../../administration/execution-environments/components/PageFormSelectExecutionEnvironment'; import { PageFormInstanceGroupSelect } from '../../administration/instance-groups/components/PageFormInstanceGroupSelect'; import { AwxPageForm } from '../../common/AwxPageForm'; import { awxAPI } from '../../common/api/awx-utils'; +import { getAddedAndRemoved } from '../../common/util/getAddedAndRemoved'; import { InstanceGroup } from '../../interfaces/InstanceGroup'; import { Organization } from '../../interfaces/Organization'; import { AwxRoute } from '../../main/AwxRoutes'; -import { getAddedAndRemoved } from '../../common/util/getAddedAndRemoved'; type IOrganizationData = Organization & { instanceGroups?: InstanceGroup[]; diff --git a/frontend/awx/access/roles/RoleForm.tsx b/frontend/awx/access/roles/RoleForm.tsx index 4b065eb451..966b96a6d4 100644 --- a/frontend/awx/access/roles/RoleForm.tsx +++ b/frontend/awx/access/roles/RoleForm.tsx @@ -1,3 +1,4 @@ +import { useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; import { @@ -9,18 +10,17 @@ import { useGetPageUrl, usePageNavigate, } from '../../../../framework'; +import { PageFormMultiSelect } from '../../../../framework/PageForm/Inputs/PageFormMultiSelect'; +import { PageFormHidden } from '../../../../framework/PageForm/Utils/PageFormHidden'; import { useGet } from '../../../common/crud/useGet'; import { usePatchRequest } from '../../../common/crud/usePatchRequest'; import { usePostRequest } from '../../../common/crud/usePostRequest'; -import { useInvalidateCacheOnUnmount } from '../../../common/useInvalidateCache'; +import { useInvalidateCacheOnUnmount } from '../../../common/useInvalidateCache/useInvalidateCache'; import { AwxPageForm } from '../../common/AwxPageForm'; import { awxAPI } from '../../common/api/awx-utils'; import { AwxRbacRole } from '../../interfaces/AwxRbacRole'; import { AwxRoute } from '../../main/AwxRoutes'; import { AwxContentTypes, useAwxRoleMetadata } from './hooks/useAwxRoleMetadata'; -import { PageFormMultiSelect } from '../../../../framework/PageForm/Inputs/PageFormMultiSelect'; -import { PageFormHidden } from '../../../../framework/PageForm/Utils/PageFormHidden'; -import { useWatch } from 'react-hook-form'; export function CreateRole(props: { breadcrumbLabelForPreviousPage?: string }) { const { t } = useTranslation(); diff --git a/frontend/awx/main/AwxLogin.tsx b/frontend/awx/main/AwxLogin.tsx index 2fcc6cfc02..acc90b12f5 100644 --- a/frontend/awx/main/AwxLogin.tsx +++ b/frontend/awx/main/AwxLogin.tsx @@ -1,7 +1,7 @@ import { Page } from '@patternfly/react-core'; import useSWR, { mutate } from 'swr'; import { LoadingState } from '../../../framework/components/LoadingState'; -import { AnsibleLogin } from '../../common/AnsibleLogin'; +import { AnsibleLogin } from '../../common/AnsibleLogin/AnsibleLogin'; import type { AuthOption } from '../../common/SocialAuthLogin'; import { requestGet } from '../../common/crud/Data'; import { awxAPI } from '../common/api/awx-utils'; diff --git a/frontend/common/AnsibleLogin.cy.tsx b/frontend/common/AnsibleLogin/AnsibleLogin.cy.tsx similarity index 100% rename from frontend/common/AnsibleLogin.cy.tsx rename to frontend/common/AnsibleLogin/AnsibleLogin.cy.tsx diff --git a/frontend/common/AnsibleLogin.tsx b/frontend/common/AnsibleLogin/AnsibleLogin.tsx similarity index 94% rename from frontend/common/AnsibleLogin.tsx rename to frontend/common/AnsibleLogin/AnsibleLogin.tsx index cfad95b65a..bbd91739b2 100644 --- a/frontend/common/AnsibleLogin.tsx +++ b/frontend/common/AnsibleLogin/AnsibleLogin.tsx @@ -10,15 +10,15 @@ import { LoginMainHeader, } from '@patternfly/react-core'; import { ExclamationCircleIcon } from '@patternfly/react-icons'; -import { ReactNode, useCallback, useState, useEffect } from 'react'; -import { useLocation } from 'react-router'; +import { ReactNode, useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { useLocation } from 'react-router'; import styled from 'styled-components'; -import { ErrorBoundary } from '../../framework/components/ErrorBoundary'; -import { useFrameworkTranslations } from '../../framework/useFrameworkTranslations'; -import { AuthOption, SocialAuthLogin } from './SocialAuthLogin'; -import { RequestError, createRequestError } from './crud/RequestError'; -import { getCookie } from './crud/cookie'; +import { useFrameworkTranslations } from '../../../framework'; +import { ErrorBoundary } from '../../../framework/components/ErrorBoundary'; +import { getCookie } from '../crud/cookie'; +import { createRequestError, RequestError } from '../crud/RequestError'; +import { AuthOption, SocialAuthLogin } from '../SocialAuthLogin'; export function AnsibleLogin(props: { /** Title for the login main body header of the login page */ diff --git a/frontend/common/crud/useDeleteRequest.tsx b/frontend/common/crud/useDeleteRequest.tsx index eb3dd9a7e9..7d8d8f01b6 100644 --- a/frontend/common/crud/useDeleteRequest.tsx +++ b/frontend/common/crud/useDeleteRequest.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react'; -import { useClearCache } from '../useInvalidateCache'; +import { useClearCache } from '../useInvalidateCache/useInvalidateCache'; import { createRequestError } from './RequestError'; import { requestCommon } from './requestCommon'; diff --git a/frontend/common/crud/usePatchRequest.tsx b/frontend/common/crud/usePatchRequest.tsx index 339988d7ce..2c3a9716a9 100644 --- a/frontend/common/crud/usePatchRequest.tsx +++ b/frontend/common/crud/usePatchRequest.tsx @@ -1,4 +1,4 @@ -import { useClearCache } from '../useInvalidateCache'; +import { useClearCache } from '../useInvalidateCache/useInvalidateCache'; import { createRequestError } from './RequestError'; import { requestCommon } from './requestCommon'; diff --git a/frontend/common/crud/usePostRequest.tsx b/frontend/common/crud/usePostRequest.tsx index 13ab19fcfd..ff5249f128 100644 --- a/frontend/common/crud/usePostRequest.tsx +++ b/frontend/common/crud/usePostRequest.tsx @@ -1,4 +1,4 @@ -import { useClearCache } from '../useInvalidateCache'; +import { useClearCache } from '../useInvalidateCache/useInvalidateCache'; import { createRequestError } from './RequestError'; import { requestCommon } from './requestCommon'; diff --git a/frontend/common/crud/usePutRequest.tsx b/frontend/common/crud/usePutRequest.tsx index e114ec1838..3cd0e7a7e2 100644 --- a/frontend/common/crud/usePutRequest.tsx +++ b/frontend/common/crud/usePutRequest.tsx @@ -1,4 +1,4 @@ -import { useClearCache } from '../useInvalidateCache'; +import { useClearCache } from '../useInvalidateCache/useInvalidateCache'; import { createRequestError } from './RequestError'; import { requestCommon } from './requestCommon'; diff --git a/frontend/common/useInvalidateCache.cy.tsx b/frontend/common/useInvalidateCache/useInvalidateCache.cy.tsx similarity index 100% rename from frontend/common/useInvalidateCache.cy.tsx rename to frontend/common/useInvalidateCache/useInvalidateCache.cy.tsx diff --git a/frontend/common/useInvalidateCache.tsx b/frontend/common/useInvalidateCache/useInvalidateCache.tsx similarity index 100% rename from frontend/common/useInvalidateCache.tsx rename to frontend/common/useInvalidateCache/useInvalidateCache.tsx diff --git a/frontend/eda/access/organizations/OrganizationPage/OrganizationForm.tsx b/frontend/eda/access/organizations/OrganizationPage/OrganizationForm.tsx index 5379f1107b..55b6970279 100644 --- a/frontend/eda/access/organizations/OrganizationPage/OrganizationForm.tsx +++ b/frontend/eda/access/organizations/OrganizationPage/OrganizationForm.tsx @@ -11,11 +11,11 @@ import { import { PageFormTextInput } from '../../../../../framework/PageForm/Inputs/PageFormTextInput'; import { requestGet, requestPatch, swrOptions } from '../../../../common/crud/Data'; import { usePostRequest } from '../../../../common/crud/usePostRequest'; -import { useInvalidateCacheOnUnmount } from '../../../../common/useInvalidateCache'; +import { useInvalidateCacheOnUnmount } from '../../../../common/useInvalidateCache/useInvalidateCache'; +import { edaAPI } from '../../../common/eda-utils'; import { EdaPageForm } from '../../../common/EdaPageForm'; import { EdaOrganization, EdaOrganizationCreate } from '../../../interfaces/EdaOrganization'; import { EdaRoute } from '../../../main/EdaRoutes'; -import { edaAPI } from '../../../common/eda-utils'; export function CreateOrganization() { const { t } = useTranslation(); diff --git a/frontend/eda/access/roles/RoleForm.tsx b/frontend/eda/access/roles/RoleForm.tsx index b727d01dab..388bb56798 100644 --- a/frontend/eda/access/roles/RoleForm.tsx +++ b/frontend/eda/access/roles/RoleForm.tsx @@ -1,3 +1,4 @@ +import { useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; import { @@ -9,18 +10,17 @@ import { useGetPageUrl, usePageNavigate, } from '../../../../framework'; +import { PageFormMultiSelect } from '../../../../framework/PageForm/Inputs/PageFormMultiSelect'; +import { PageFormHidden } from '../../../../framework/PageForm/Utils/PageFormHidden'; import { useGet } from '../../../common/crud/useGet'; import { usePatchRequest } from '../../../common/crud/usePatchRequest'; import { usePostRequest } from '../../../common/crud/usePostRequest'; -import { useInvalidateCacheOnUnmount } from '../../../common/useInvalidateCache'; +import { useInvalidateCacheOnUnmount } from '../../../common/useInvalidateCache/useInvalidateCache'; import { EdaPageForm } from '../../common/EdaPageForm'; import { edaAPI } from '../../common/eda-utils'; import { EdaRbacRole } from '../../interfaces/EdaRbacRole'; import { EdaRoute } from '../../main/EdaRoutes'; import { EdaContentTypes, useEdaRoleMetadata } from './hooks/useEdaRoleMetadata'; -import { PageFormMultiSelect } from '../../../../framework/PageForm/Inputs/PageFormMultiSelect'; -import { PageFormHidden } from '../../../../framework/PageForm/Utils/PageFormHidden'; -import { useWatch } from 'react-hook-form'; export function CreateRole(props: { breadcrumbLabelForPreviousPage?: string }) { const { t } = useTranslation(); diff --git a/frontend/eda/access/teams/TeamPage/TeamForm.tsx b/frontend/eda/access/teams/TeamPage/TeamForm.tsx index 609ab3b405..2605701cac 100644 --- a/frontend/eda/access/teams/TeamPage/TeamForm.tsx +++ b/frontend/eda/access/teams/TeamPage/TeamForm.tsx @@ -11,13 +11,13 @@ import { import { PageFormTextInput } from '../../../../../framework/PageForm/Inputs/PageFormTextInput'; import { requestGet, requestPatch, swrOptions } from '../../../../common/crud/Data'; import { usePostRequest } from '../../../../common/crud/usePostRequest'; -import { useInvalidateCacheOnUnmount } from '../../../../common/useInvalidateCache'; +import { useInvalidateCacheOnUnmount } from '../../../../common/useInvalidateCache/useInvalidateCache'; +import { edaAPI } from '../../../common/eda-utils'; import { EdaPageForm } from '../../../common/EdaPageForm'; +import { EdaOrganization } from '../../../interfaces/EdaOrganization'; +import { EdaResult } from '../../../interfaces/EdaResult'; import { EdaTeam, EdaTeamCreate, EdaTeamDetail } from '../../../interfaces/EdaTeam'; import { EdaRoute } from '../../../main/EdaRoutes'; -import { edaAPI } from '../../../common/eda-utils'; -import { EdaResult } from '../../../interfaces/EdaResult'; -import { EdaOrganization } from '../../../interfaces/EdaOrganization'; import { PageFormSelectOrganization } from '../../organizations/components/PageFormOrganizationSelect'; export function CreateTeam() { diff --git a/frontend/eda/main/EdaLogin.tsx b/frontend/eda/main/EdaLogin.tsx index f7234203c0..7a26072f47 100644 --- a/frontend/eda/main/EdaLogin.tsx +++ b/frontend/eda/main/EdaLogin.tsx @@ -1,7 +1,7 @@ import { Page } from '@patternfly/react-core'; import { mutate } from 'swr'; import { LoadingState } from '../../../framework/components/LoadingState'; -import { AnsibleLogin } from '../../common/AnsibleLogin'; +import { AnsibleLogin } from '../../common/AnsibleLogin/AnsibleLogin'; import { edaAPI } from '../common/eda-utils'; import { useEdaActiveUser } from '../common/useEdaActiveUser'; diff --git a/frontend/hub/access/roles/RolePage/HubRoleForm.tsx b/frontend/hub/access/roles/RolePage/HubRoleForm.tsx index 7587b69cde..713d00a974 100644 --- a/frontend/hub/access/roles/RolePage/HubRoleForm.tsx +++ b/frontend/hub/access/roles/RolePage/HubRoleForm.tsx @@ -1,6 +1,6 @@ +import { useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { useNavigate, useParams } from 'react-router-dom'; -import { useWatch } from 'react-hook-form'; import { PageFormSelect, PageFormSubmitHandler, @@ -10,18 +10,18 @@ import { useGetPageUrl, usePageNavigate, } from '../../../../../framework'; -import { useInvalidateCacheOnUnmount } from '../../../../common/useInvalidateCache'; +import { PageFormMultiSelect } from '../../../../../framework/PageForm/Inputs/PageFormMultiSelect'; +import { PageFormHidden } from '../../../../../framework/PageForm/Utils/PageFormHidden'; +import { useGet } from '../../../../common/crud/useGet'; +import { usePatchRequest } from '../../../../common/crud/usePatchRequest'; import { usePostRequest } from '../../../../common/crud/usePostRequest'; -import { HubRbacRole } from '../../../interfaces/expanded/HubRbacRole'; +import { useInvalidateCacheOnUnmount } from '../../../../common/useInvalidateCache/useInvalidateCache'; import { hubAPI } from '../../../common/api/formatPath'; -import { HubRoute } from '../../../main/HubRoutes'; import { HubPageForm } from '../../../common/HubPageForm'; -import { useHubRoleMetadata } from '../hooks/useHubRoleMetadata'; -import { PageFormHidden } from '../../../../../framework/PageForm/Utils/PageFormHidden'; -import { PageFormMultiSelect } from '../../../../../framework/PageForm/Inputs/PageFormMultiSelect'; import { ContentTypeEnum } from '../../../interfaces/expanded/ContentType'; -import { useGet } from '../../../../common/crud/useGet'; -import { usePatchRequest } from '../../../../common/crud/usePatchRequest'; +import { HubRbacRole } from '../../../interfaces/expanded/HubRbacRole'; +import { HubRoute } from '../../../main/HubRoutes'; +import { useHubRoleMetadata } from '../hooks/useHubRoleMetadata'; import { useIsValidRoleName } from '../hooks/useIsValidRoleName'; export function CreateRole(props: { breadcrumbLabelForPreviousPage?: string }) { diff --git a/frontend/hub/administration/remote-registries/RemoteRegistryForm.tsx b/frontend/hub/administration/remote-registries/RemoteRegistryForm.tsx index 2b9522f763..dade635207 100644 --- a/frontend/hub/administration/remote-registries/RemoteRegistryForm.tsx +++ b/frontend/hub/administration/remote-registries/RemoteRegistryForm.tsx @@ -18,7 +18,7 @@ import { PageFormSecret } from '../../../../framework/PageForm/Inputs/PageFormSe import { PageFormExpandableSection } from '../../../../framework/PageForm/PageFormExpandableSection'; import { useGet } from '../../../common/crud/useGet'; import { usePostRequest } from '../../../common/crud/usePostRequest'; -import { useClearCache } from '../../../common/useInvalidateCache'; +import { useClearCache } from '../../../common/useInvalidateCache/useInvalidateCache'; import { useIsValidUrl } from '../../../common/validation/useIsValidUrl'; import { HubError } from '../../common/HubError'; import { HubPageForm } from '../../common/HubPageForm'; diff --git a/frontend/hub/administration/remotes/RemoteForm.tsx b/frontend/hub/administration/remotes/RemoteForm.tsx index c1e5814edf..37554463ce 100644 --- a/frontend/hub/administration/remotes/RemoteForm.tsx +++ b/frontend/hub/administration/remotes/RemoteForm.tsx @@ -21,7 +21,7 @@ import { PageFormSection } from '../../../../framework/PageForm/Utils/PageFormSe import { LoadingPage } from '../../../../framework/components/LoadingPage'; import { useGet } from '../../../common/crud/useGet'; import { usePostRequest } from '../../../common/crud/usePostRequest'; -import { useClearCache } from '../../../common/useInvalidateCache'; +import { useClearCache } from '../../../common/useInvalidateCache/useInvalidateCache'; import { useIsValidUrl } from '../../../common/validation/useIsValidUrl'; import { HubError } from '../../common/HubError'; import { HubPageForm } from '../../common/HubPageForm'; diff --git a/frontend/hub/main/HubLogin.tsx b/frontend/hub/main/HubLogin.tsx index 4f31b4a3a2..10e14f8dc5 100644 --- a/frontend/hub/main/HubLogin.tsx +++ b/frontend/hub/main/HubLogin.tsx @@ -1,7 +1,7 @@ import { Page } from '@patternfly/react-core'; import { mutate } from 'swr'; import { LoadingState } from '../../../framework/components/LoadingState'; -import { AnsibleLogin } from '../../common/AnsibleLogin'; +import { AnsibleLogin } from '../../common/AnsibleLogin/AnsibleLogin'; import { useHubActiveUser } from '../../hub/common/useHubActiveUser'; import { hubAPI } from '../common/api/formatPath'; import { HubContextProvider } from '../common/useHubContext'; diff --git a/frontend/hub/namespaces/HubNamespaceForm.tsx b/frontend/hub/namespaces/HubNamespaceForm.tsx index 6addd4dd22..97e95f650a 100644 --- a/frontend/hub/namespaces/HubNamespaceForm.tsx +++ b/frontend/hub/namespaces/HubNamespaceForm.tsx @@ -14,7 +14,7 @@ import { PageFormSection } from '../../../framework/PageForm/Utils/PageFormSecti import { useGet } from '../../common/crud/useGet'; import { usePostRequest } from '../../common/crud/usePostRequest'; import { usePutRequest } from '../../common/crud/usePutRequest'; -import { useClearCache } from '../../common/useInvalidateCache'; +import { useClearCache } from '../../common/useInvalidateCache/useInvalidateCache'; import { HubError } from '../common/HubError'; import { HubPageForm } from '../common/HubPageForm'; import { hubAPI } from '../common/api/formatPath'; From 35a4a5b85008f4d75db2532a036b5f8c4824edea Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:44:53 -0400 Subject: [PATCH 08/17] cleanup Signed-off-by: James Talton --- .github/workflows/component.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index 99ce679294..2b23a82762 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -16,7 +16,7 @@ jobs: - name: Generate matrix id: set-matrix run: | - matrix=$(find frontend -type f -name '*.cy.tsx' | awk -F'/' '{print $1"/"$2"/"$3}' | sort -u | jq -R . | jq -s -c .) + matrix=$(find frontend -type f -name '*.cy.tsx' | awk -F'/' '{print $1"/"$2"/"$3}' | sort -u | sed 's|^frontend/||' jq -R . | jq -s -c .) echo "Matrix value: $matrix" echo "MATRIX=$matrix" >> $GITHUB_OUTPUT @@ -60,4 +60,4 @@ jobs: with: install: false component: true - spec: ${{ matrix.directory }}/**/*.cy.tsx + spec: frontend/${{ matrix.directory }}/**/*.cy.tsx From f95c47b8ab20d67313bff451ce57e5a5277d692d Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:47:14 -0400 Subject: [PATCH 09/17] fix Signed-off-by: James Talton --- .github/workflows/component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index 2b23a82762..aa1f233c3d 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -16,7 +16,7 @@ jobs: - name: Generate matrix id: set-matrix run: | - matrix=$(find frontend -type f -name '*.cy.tsx' | awk -F'/' '{print $1"/"$2"/"$3}' | sort -u | sed 's|^frontend/||' jq -R . | jq -s -c .) + matrix=$(find frontend -type f -name '*.cy.tsx' | awk -F'/' '{print $1"/"$2"/"$3}' | sort -u | sed 's|^frontend/||' | jq -R . | jq -s -c .) echo "Matrix value: $matrix" echo "MATRIX=$matrix" >> $GITHUB_OUTPUT From 87f91164659689d96bff452dda7f8cafe196ce0c Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 14:49:27 -0400 Subject: [PATCH 10/17] tweak Signed-off-by: James Talton --- .github/workflows/component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index aa1f233c3d..1ac7a419cc 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -5,7 +5,7 @@ on: jobs: generate-matrix: - name: Test Matrix + name: Generate Matrix runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.MATRIX }} From 9e97a75ef557a46d9bed11efc90552415057aedd Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 15:00:45 -0400 Subject: [PATCH 11/17] test Signed-off-by: James Talton --- .github/workflows/component.yml | 10 ++++++++-- .github/workflows/pull-request.yml | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index 1ac7a419cc..a05fe38259 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -2,6 +2,11 @@ name: Component on: workflow_call: + inputs: + directory: + description: 'The base directory to search for .cy.tsx files' + required: true + type: string jobs: generate-matrix: @@ -16,7 +21,8 @@ jobs: - name: Generate matrix id: set-matrix run: | - matrix=$(find frontend -type f -name '*.cy.tsx' | awk -F'/' '{print $1"/"$2"/"$3}' | sort -u | sed 's|^frontend/||' | jq -R . | jq -s -c .) + BASE_DIR="${{ inputs.directory }}" + matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' | sort -u | sed "s|^$BASE_DIR/||" | jq -R . | jq -s -c .) echo "Matrix value: $matrix" echo "MATRIX=$matrix" >> $GITHUB_OUTPUT @@ -60,4 +66,4 @@ jobs: with: install: false component: true - spec: frontend/${{ matrix.directory }}/**/*.cy.tsx + spec: ${{ inputs.directory }}/${{ matrix.directory }}/**/*.cy.tsx diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 8dfe9faa67..29d3b9f07c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -55,10 +55,19 @@ jobs: - run: npm run checks component: - name: Component + name: AWX Component needs: packages uses: ./.github/workflows/component.yml - + with: + directory: 'frontend' + + framework: + name: AWX Component + needs: packages + uses: ./.github/workflows/component.yml + with: + directory: 'framework' + success: name: Success runs-on: ubuntu-latest @@ -66,5 +75,6 @@ jobs: needs: - checks - component + - framework steps: - run: echo Success From d7698d06de56968c94a579cab9b9b033833a081f Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 15:04:12 -0400 Subject: [PATCH 12/17] test Signed-off-by: James Talton --- .github/workflows/pull-request.yml | 36 +++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 29d3b9f07c..09d66eaa8c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -54,19 +54,40 @@ jobs: run: npm ci - run: npm run checks - component: - name: AWX Component + awx: + name: AWX needs: packages uses: ./.github/workflows/component.yml with: - directory: 'frontend' + directory: frontend/awx + + eda: + name: EDA + needs: packages + uses: ./.github/workflows/component.yml + with: + directory: frontend/eda + + hub: + name: HBU + needs: packages + uses: ./.github/workflows/component.yml + with: + directory: frontend/hub + + common: + name: Common + needs: packages + uses: ./.github/workflows/component.yml + with: + directory: frontend/common framework: - name: AWX Component + name: Framework needs: packages uses: ./.github/workflows/component.yml with: - directory: 'framework' + directory: framework success: name: Success @@ -74,7 +95,10 @@ jobs: if: ${{ success() }} needs: - checks - - component + - awx + - eda + - hub + - common - framework steps: - run: echo Success From 3b395d3b114527929b0752ab03857951aa3abf97 Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 15:09:23 -0400 Subject: [PATCH 13/17] test Signed-off-by: James Talton --- .github/workflows/component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index a05fe38259..f2b402c7d4 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -22,7 +22,7 @@ jobs: id: set-matrix run: | BASE_DIR="${{ inputs.directory }}" - matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' | sort -u | sed "s|^$BASE_DIR/||" | jq -R . | jq -s -c .) + matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' | sed "s|^$BASE_DIR/||" | awk -F'/' '{print $1"/"$2}' | sort -u | jq -R . | jq -s -c .) echo "Matrix value: $matrix" echo "MATRIX=$matrix" >> $GITHUB_OUTPUT From df9bd1aac498de78f515bdfd6fb443e762486ddb Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 15:14:14 -0400 Subject: [PATCH 14/17] fix Signed-off-by: James Talton --- .github/workflows/component.yml | 2 +- .github/workflows/pull-request.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index f2b402c7d4..ab77fce3c2 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -22,7 +22,7 @@ jobs: id: set-matrix run: | BASE_DIR="${{ inputs.directory }}" - matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' | sed "s|^$BASE_DIR/||" | awk -F'/' '{print $1"/"$2}' | sort -u | jq -R . | jq -s -c .) + matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' -exec dirname {} \; | sed "s|^$BASE_DIR/||" | sort -u | jq -R . | jq -s -c .) echo "Matrix value: $matrix" echo "MATRIX=$matrix" >> $GITHUB_OUTPUT diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 09d66eaa8c..abe2dc76f1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -69,7 +69,7 @@ jobs: directory: frontend/eda hub: - name: HBU + name: HUB needs: packages uses: ./.github/workflows/component.yml with: From bf3c9801f63566d5aeac5e403694661f4f30dd55 Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 29 Aug 2024 15:18:47 -0400 Subject: [PATCH 15/17] fix Signed-off-by: James Talton --- .github/workflows/component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index ab77fce3c2..420aafcc3b 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -22,7 +22,7 @@ jobs: id: set-matrix run: | BASE_DIR="${{ inputs.directory }}" - matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' -exec dirname {} \; | sed "s|^$BASE_DIR/||" | sort -u | jq -R . | jq -s -c .) + matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' -exec dirname {} \; | sed "s|^$BASE_DIR/||" | awk -F'/' '{print $1"/"$2}' | sort -u | jq -R . | jq -s -c .) echo "Matrix value: $matrix" echo "MATRIX=$matrix" >> $GITHUB_OUTPUT From 220106454dc32320ab6c9314eeab35df81aa9111 Mon Sep 17 00:00:00 2001 From: James Talton Date: Fri, 30 Aug 2024 09:38:46 -0400 Subject: [PATCH 16/17] Cleanup GitHub Actions Signed-off-by: James Talton --- .github/workflows/component.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/component.yml b/.github/workflows/component.yml index 420aafcc3b..63c90862d9 100644 --- a/.github/workflows/component.yml +++ b/.github/workflows/component.yml @@ -22,7 +22,7 @@ jobs: id: set-matrix run: | BASE_DIR="${{ inputs.directory }}" - matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' -exec dirname {} \; | sed "s|^$BASE_DIR/||" | awk -F'/' '{print $1"/"$2}' | sort -u | jq -R . | jq -s -c .) + matrix=$(find "$BASE_DIR" -type f -name '*.cy.tsx' -exec dirname {} \; | sed "s|^$BASE_DIR/||" | awk -F'/' '{print $1}' | sort -u | jq -R . | jq -s -c .) echo "Matrix value: $matrix" echo "MATRIX=$matrix" >> $GITHUB_OUTPUT From 3f6342ea5b2cd9f4d9d40102bacd399970459047 Mon Sep 17 00:00:00 2001 From: James Talton Date: Fri, 30 Aug 2024 10:38:44 -0400 Subject: [PATCH 17/17] revert some changes Signed-off-by: James Talton --- .github/labeler.yml | 21 ++++++++++++++++++++ .github/workflows/labeler.yml | 13 +++++++++++++ .github/workflows/sync-downstream.yml | 28 +++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/sync-downstream.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000000..fa8aa8dde9 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,21 @@ +AWX: + - frontend/awx/**/* + - cypress/e2e/awx/**/* + +EDA: + - frontend/eda/**/* + - cypress/e2e/eda/**/* + +HUB: + - frontend/hub/**/* + - cypress/e2e/hub/**/* + +E2E: + - cypress/e2e/** + +CCT: + - framework/**/*.cy.* + - frontend/**/*.cy.* + +AFW: + - framework/**/* diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000000..77bd21cfbe --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,13 @@ +name: Labeler +on: + - pull_request_target + +jobs: + add-labels: + name: Labeler + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4 \ No newline at end of file diff --git a/.github/workflows/sync-downstream.yml b/.github/workflows/sync-downstream.yml new file mode 100644 index 0000000000..bdcef0abba --- /dev/null +++ b/.github/workflows/sync-downstream.yml @@ -0,0 +1,28 @@ +name: Sync Downstream + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: main + +jobs: + merge-to-downstream: + name: Merge Main to Downstream + runs-on: ubuntu-latest + # timeout-minutes: 10 + + steps: + - name: Downstream Merge + if: github.repository == 'ansible/ansible-ui' + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + curl -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${GH_TOKEN}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/ansible/aap-ui/dispatches \ + -d '{"event_type":"sync"}' \ No newline at end of file