feat: Enhance "Add collection manually" component with autocomplete and source-based version filtering #743
This file contains hidden or 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 | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| env: | |
| TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }} | |
| TURBO_SCM_HEAD: ${{ github.sha }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| docs: | |
| # Skip for patchback PRs (automated backports of already-tested code) | |
| if: ${{ !startsWith(github.head_ref, 'patchback/backports/') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: pip install -r .config/requirements.txt | |
| - name: Build Developer docs | |
| run: mkdocs build | |
| test: | |
| # Skip for patchback PRs (automated backports of already-tested code) | |
| if: ${{ !startsWith(github.head_ref, 'patchback/backports/') }} | |
| name: Test with Node.js ${{ matrix.node-version }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| checks: read | |
| contents: read | |
| id-token: write | |
| strategy: | |
| matrix: | |
| node-version: [20, 22] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Setup local Turbo cache | |
| uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1 | |
| - name: Install dependencies | |
| uses: backstage/actions/yarn-install@b3c1841fd69e1658ac631afafd0fb140a2309024 # v0.6.17 | |
| with: | |
| cache-prefix: ${{ github.ref_name }}-${{ runner.os }}-${{ matrix.node-version }} | |
| - name: Run TSC | |
| run: yarn tsc | |
| - name: Run Lint | |
| run: yarn lint:all | |
| - name: Run tests | |
| id: tests | |
| run: | | |
| yarn run test:all | |
| npx -y nyc report --reporter html --reporter text -t coverage --report-dir coverage/summary | |
| # Filter coverage to only include plugins/ directory | |
| - name: Filter coverage for plugins only | |
| run: | | |
| # Create filtered coverage file containing only plugins/ paths | |
| awk '/^SF:/{found=/^SF:plugins\//} found' ./coverage/lcov.info > ./coverage/lcov-plugins.info || true | |
| - name: Upload coverage report to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} | |
| file: ./coverage/lcov-plugins.info | |
| flags: plugins | |
| fail_ci_if_error: false | |
| verbose: true | |
| - name: Upload Code Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report-${{ matrix.node-version }} | |
| path: | | |
| ./coverage/lcov.info | |
| ./coverage/lcov-plugins.info | |
| ./coverage/summary/ | |
| retention-days: 30 | |
| - name: Upload JUnit XML results to PDE | |
| if: > | |
| github.event_name != 'pull_request' || | |
| github.event.pull_request.head.repo.fork == false | |
| env: | |
| UPLOAD_USER: ${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }} | |
| UPLOAD_PASSWORD: ${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }} | |
| UPLOAD_URL: ${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }} | |
| run: | | |
| if [ -f junit.xml ]; then | |
| curl -v --fail-with-body \ | |
| --user "${UPLOAD_USER}:${UPLOAD_PASSWORD}" \ | |
| --form "xunit_xml=@junit.xml" \ | |
| --form "component_name=ansible-backstage-plugins" \ | |
| --form "git_commit_sha=${{ github.sha }}" \ | |
| --form "git_repository_url=https://github.com/${{ github.repository }}" \ | |
| "${UPLOAD_URL}/api/results/upload/" | |
| else | |
| echo "junit.xml not found!" | |
| exit 1 | |
| fi | |
| all-green: | |
| if: ${{ always() }} | |
| name: check | |
| needs: | |
| - docs | |
| - test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Verify all jobs succeeded | |
| run: | | |
| python -c " | |
| results = { | |
| 'docs': '${{ needs.docs.result }}', | |
| 'test': '${{ needs.test.result }}' | |
| } | |
| # Allow 'skipped' for patchback PRs | |
| failed = [job for job, result in results.items() if result not in ('success', 'skipped')] | |
| if failed: | |
| print(f'Failed jobs: {failed}') | |
| print(f'Results: {results}') | |
| exit(1) | |
| print('All jobs succeeded!') | |
| " | |