-
Notifications
You must be signed in to change notification settings - Fork 0
ci: stop reaching into the private dcd repo for the mock-api #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,37 +45,23 @@ jobs: | |
| lint-and-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| # The mock-api lives in the private devicecloud-dev/dcd repo, checked out via an | ||
| # SSH deploy key. GitHub does NOT expose secrets to pull_request workflows | ||
| # triggered from forks, so that checkout (and the integration tests that need | ||
| # it) can only run for same-repo events. Fork PRs still run lint/typecheck/build. | ||
| # This repo is PUBLIC and runs no step that reaches into the private | ||
| # devicecloud-dev/dcd repo. It used to check out that repo's mock-api over an | ||
| # SSH deploy key to run test/integration/*, which meant a private-repo | ||
| # credential lived in a public repo's secrets and the API's OpenAPI spec was | ||
| # pulled onto the runner on every same-repo PR. dcd#1036 deleted that mock-api; | ||
| # rather than re-point at it, the linkage is gone. | ||
| # | ||
| # Dependabot PRs branch from this repo (so the fork check passes) but ALSO run | ||
| # without secrets — treat them like forks and skip the private checkout, or | ||
| # the mock-api clone fails with an empty DCD_SSH_DEPLOY_KEY. | ||
| env: | ||
| HAS_PRIVATE_ACCESS: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' }} | ||
|
|
||
| # The consequence is deliberate: test/integration/* does NOT run here, and | ||
| # neither does the swagger contract-drift check it provided (spec drift used to | ||
| # surface as a Prism 422). Only test/unit/* runs — pure, no backend. To run the | ||
| # integration suite locally, point MOCK_API_DIR at a mock; see CLAUDE.md. | ||
| steps: | ||
| - name: Checkout CLI | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| path: cli | ||
|
|
||
| - name: Checkout dcd (mock-api) | ||
| if: env.HAS_PRIVATE_ACCESS == 'true' | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| repository: devicecloud-dev/dcd | ||
| path: dcd | ||
| ssh-key: ${{ secrets.DCD_SSH_DEPLOY_KEY }} | ||
| # api/swagger.json is a file, which cone-mode sparse checkout rejects | ||
| # as of git 2.51 ("is not a directory") — use non-cone patterns. | ||
| sparse-checkout-cone-mode: false | ||
| sparse-checkout: | | ||
| /mock-api/ | ||
| /api/swagger.json | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/[email protected] | ||
| with: | ||
|
|
@@ -93,11 +79,6 @@ jobs: | |
| working-directory: ./cli | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Install Mock API dependencies | ||
| if: env.HAS_PRIVATE_ACCESS == 'true' | ||
| working-directory: ./dcd/mock-api | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Run CLI linter | ||
| working-directory: ./cli | ||
| run: pnpm lint | ||
|
|
@@ -106,16 +87,12 @@ jobs: | |
| working-directory: ./cli | ||
| run: pnpm typecheck | ||
|
|
||
| - name: Run CLI tests | ||
| if: env.HAS_PRIVATE_ACCESS == 'true' | ||
| - name: Run CLI unit tests | ||
| working-directory: ./cli | ||
| env: | ||
| MOCK_API_DIR: ${{ github.workspace }}/dcd/mock-api | ||
| run: pnpm test | ||
| run: pnpm test:unit | ||
|
|
||
| - name: Skip integration tests (fork PR — no mock-api access) | ||
| if: env.HAS_PRIVATE_ACCESS != 'true' | ||
| run: echo "::notice::Integration tests skipped — the mock-api (private devicecloud-dev/dcd) is not accessible from fork PRs. Lint, typecheck, and build still ran." | ||
| - name: Note skipped integration tests | ||
| run: echo "::notice::Integration tests are not run in CI — they need a mock of the dcd API, and this public repo does not reach into the private one. Lint, typecheck, unit tests, build and audit all ran." | ||
|
|
||
| - name: Build CLI | ||
| working-directory: ./cli | ||
|
|
||
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.