-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MNT] Automated generation of result examples (#434)
* Added submodules * Updated submodules * Added `UpdateExamples` e2e test * Added `Update examples` workflow * Included the submodules in the checkout step * Fixed typo in the file format * Added `update-query-tool-results` job * Fixed the open condition * Try checking out the examples repo directly * Fixed the oopsie * Let's try this * Removed commit step * Made a few small changes * Removed the debug step * Added permissions * Added pull-request permissions * Updated a few things * Fixed the oopsie * Let's use the latest version * Removed the label * Maybe we need to configure git user idk * A bit of cleaning up * Updated component-test workflow * Updated e2e-test workflow * bumped download-artifact to v4 * Set the specPattern for cypress tests * Bumped create-pull-request to v7 * Revert download-artifact to v3 thanks codeQL * Revert download-artifact to v3 thanks codeQL 2nd round * Bumped artifact version * Try using gh cli * Set git user * Set the owner * Set the committer
- Loading branch information
Showing
7 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: update examples | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
generate-example-files: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up node env | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Create .env file | ||
run: | | ||
echo -e "NB_API_QUERY_URL=https://federate.neurobagel.org/\nNB_ENABLE_AUTH=true\nNB_QUERY_CLIENT_ID=mockclientid" > .env | ||
- name: build | ||
run: npm install && npm run build | ||
|
||
- name: Run end to end tests | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
wait-on: http://localhost:5173 | ||
start: npm run preview | ||
spec: cypress/e2e/UpdateExamples.cy.ts | ||
component: false | ||
|
||
- name: Upload test artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: query-tool-results | ||
path: cypress/downloads/* | ||
|
||
update-query-tool-results: | ||
runs-on: ubuntu-latest | ||
needs: generate-example-files | ||
steps: | ||
- name: Generate a token | ||
id: generate-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ vars.NB_BOT_ID }} | ||
private-key: ${{ secrets.NB_BOT_KEY }} | ||
owner: ${{ github.repository_owner }} | ||
|
||
- name: Checkout neurobagel_examples repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: neurobagel/neurobagel_examples | ||
token: ${{ steps.generate-token.outputs.token }} | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: query-tool-results | ||
path: neurobagel_examples/query-tool-results | ||
|
||
- name: Create Pull Request | ||
id: create_pr | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ steps.generate-token.outputs.token }} | ||
commit-message: Update `query-tool-results` files | ||
title: Update `query-tool-results` files | ||
body: "This PR updates the `query-tool-results` files with the latest changes." | ||
base: main | ||
branch: update-query-tool-results | ||
committer: NeuroBagel Bot <neurobagel-bot[bot]@users.noreply.github.com> | ||
labels: _bot |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import fapiQuerySuccess200 from '../../neurobagel_examples/api-responses/fapi_query_success_200.json'; | ||
|
||
describe('Update Examples', () => { | ||
it('Removes a newline character from a dataset name in the downloaded dataset-level results file', () => { | ||
cy.intercept('GET', 'query*', (req) => { | ||
req.reply(fapiQuerySuccess200); | ||
}).as('call'); | ||
cy.visit('/'); | ||
cy.get('[data-cy="close-auth-dialog-button"]').click(); | ||
cy.get('[data-cy="submit-query-button"]').click(); | ||
cy.wait('@call'); | ||
cy.get('[data-cy="select-all-checkbox"]').find('input').check(); | ||
cy.get('[data-cy="download-results-button"]').click(); | ||
cy.get('[data-cy="download-results-dropdown-button"]').click(); | ||
cy.contains('URIs').click(); | ||
cy.get('[data-cy="download-results-button"]').click(); | ||
}); | ||
}); |
Submodule neurobagel_examples
added at
5690cd