Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/compose/neurosynth…
Browse files Browse the repository at this point in the history
…-frontend/micromatch-4.0.8
  • Loading branch information
nicoalee committed Sep 30, 2024
2 parents 2da04fc + 28d569c commit e98e707
Show file tree
Hide file tree
Showing 54 changed files with 3,401 additions and 1,306 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/deploy-to-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# .github/workflows/deploy-to-staging.yml
name: Deploy to Staging

on:
push:
branches:
- staging

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Set up SSH agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Add remote SSH server to known hosts
run: |
ssh-keyscan -H deepdream.psy.utexas.edu >> ~/.ssh/known_hosts
- name: Force sync staging branch to remote server
run: |
ssh [email protected] '
cd /var/www/neurostore &&
git fetch origin && # Fetch full history
git fetch --all && # Fetch all branches and their histories
git reset --hard origin/staging &&
git clean -fd
'
- name: Detect changes in specific directories from the previous commit
id: changes
run: |
# Capture the output of the SSH session and process it locally
ssh_output=$(ssh [email protected] '
cd /var/www/neurostore &&
git fetch origin &&
git log -n 2 &&
changes_in_store=$(git diff --name-only HEAD~1 -- | grep "^store/" || echo "") &&
changes_in_compose=$(git diff --name-only HEAD~1 -- | grep "^compose/" || echo "") &&
changes_in_frontend=$(git diff --name-only HEAD~1 -- | grep "^compose/neurosynth-frontend/" || echo "") &&
# Print results for local parsing
echo "store:$changes_in_store" &&
echo "compose:$changes_in_compose" &&
echo "frontend:$changes_in_frontend"
')
# Parse the results locally and set outputs
echo "$ssh_output" | while IFS=':' read -r key value; do
if [ -n "$value" ]; then
echo "$key=$value" >> $GITHUB_OUTPUT
fi
done
- name: Run Docker commands in store directory if changes detected
if: ${{ steps.changes.outputs.store }}
run: |
ssh [email protected] '
cd /var/www/neurostore/store &&
docker compose down &&
docker compose build &&
docker compose up -d
# Wait for PostgreSQL to be ready
until docker compose exec store_pgsql pg_isready; do sleep 5; done
docker compose exec store flask db migrate
docker compose exec store flask db upgrade
'
- name: Run Docker commands in compose directory if changes detected
if: ${{ steps.changes.outputs.compose }}
run: |
ssh [email protected] '
cd /var/www/neurostore/compose &&
docker compose down &&
docker compose build &&
docker compose up -d
# Wait for PostgreSQL to be ready
until docker compose exec compose_pgsql pg_isready; do sleep 5; done
docker compose exec compose flask db migrate
docker compose exec compose flask db upgrade
'
- name: Skip Docker commands and run frontend build if only frontend changes detected
if: ${{ steps.changes.outputs.frontend }}
run: |
ssh [email protected] '
cd /var/www/neurostore/compose &&
docker compose exec -T compose bash -c "cd /compose/neurosynth-frontend/ && npm install && npm run build:staging"
'
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PAGE_NAME = 'BaseStudyPage';

describe(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.clearLocalStorage();
cy.intercept('GET', `https://api.semanticscholar.org/**`, {
fixture: 'semanticScholar',
}).as('semanticScholarFixture');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PAGE_NAME = 'EditStudyPage';

describe(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('GET', `https://api.semanticscholar.org/**`, {
fixture: 'semanticScholar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PAGE_NAME = 'LandingPage';

describe(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('GET', `**/api/base-studies/**`, {
fixture: 'baseStudies/baseStudiesNoResults',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PAGE_NAME = 'MetaAnalysisPage';

describe(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('GET', `**/api/specifications/**`, { fixture: 'specification' }).as(
'specificationFixture'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PAGE_NAME = 'ProjectMetaAnalysesPage';

describe(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('GET', `**/api/specifications/**`, { fixture: 'specification' }).as(
'specificationFixture'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const PAGE_NAME = 'ProjectPage';

describe(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('POST', `https://www.google-analytics.com/*/**`, {}).as(
'googleAnalyticsFixture'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const PAGE_NAME = 'StudiesPage';

describe.skip(PAGE_NAME, () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe('ImportStudiesDialog', () => {
beforeEach(() => {
cy.clearLocalStorage().clearSessionStorage();
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('GET', `**/api/projects/*`, {
fixture: 'projects/projectExtractionStep',
Expand Down Expand Up @@ -198,14 +198,14 @@ describe('ImportStudiesDialog', () => {
});

it('should set the source and show the input', () => {
cy.get('input[role="combobox"').click();
cy.get('input[role="combobox"]').click();
cy.contains('li', 'Scopus').click();
cy.get('textarea').should('be.visible');
cy.contains(/Input is empty/).should('be.visible');
});

it('should set the sources and enable the next button', () => {
cy.get('input[role="combobox"').click();
cy.get('input[role="combobox"]').click();
cy.contains('li', 'Scopus').click();
cy.get('textarea[placeholder="paste in valid endnote, bibtex, or RIS syntax"]')
.click()
Expand All @@ -220,7 +220,7 @@ describe('ImportStudiesDialog', () => {
});

it('should show an error message', () => {
cy.get('input[role="combobox"').click();
cy.get('input[role="combobox"]').click();
cy.contains('li', 'Scopus').click();
cy.get('textarea[placeholder="paste in valid endnote, bibtex, or RIS syntax"]').type(
'INVALID FORMAT'
Expand All @@ -229,7 +229,7 @@ describe('ImportStudiesDialog', () => {
});

it('should import studies', () => {
cy.get('input[role="combobox"').click();
cy.get('input[role="combobox"]').click();
cy.contains('li', 'Scopus').click();
cy.get('textarea[placeholder="paste in valid endnote, bibtex, or RIS syntax"]')
.click()
Expand All @@ -249,7 +249,7 @@ describe('ImportStudiesDialog', () => {
});

it('should upload a onenote (ENW) file', () => {
cy.get('input[role="combobox"').click();
cy.get('input[role="combobox"]').click();
cy.contains('li', 'Scopus').click();
cy.get('label[role="button"]').selectFile(
'cypress/fixtures/standardFiles/onenoteStudies.txt'
Expand Down
Loading

0 comments on commit e98e707

Please sign in to comment.