-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
2,265 additions
and
438 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: ci_cd | ||
|
||
on: push | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout ${{ github.sha }} | ||
uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
- name: Install NPM dependencies | ||
run: npm ci | ||
- name: Lint | ||
run: npm run lint --if-present | ||
- name: Build | ||
run: npm run build --if-present | ||
- name: Test | ||
run: npm run test --if-present | ||
- id: modified_paths_check | ||
uses: fkirc/[email protected] | ||
with: | ||
paths_filter: | | ||
backend: | ||
paths: | ||
- 'apps/backend/**' | ||
bubble-proxy: | ||
paths: | ||
- 'apps/bubble-proxy/**' | ||
frontend-example: | ||
paths: | ||
- 'apps/bubble-proxy/**' | ||
infra: | ||
paths: | ||
- 'apps/infra/**' | ||
paths: | ||
- 'package-lock.json' | ||
outputs: | ||
should_skip: ${{ steps.modified_paths_check.outputs.should_skip }} | ||
paths_result: ${{ steps.modified_paths_check.outputs.paths_result }} | ||
|
||
cd_infra: | ||
needs: ci | ||
if: ${{ github.ref == 'refs/heads/master' && needs.ci.outputs.should_skip != 'true' || !fromJSON(needs.ci.outputs.paths_result).infra.should_skip }} | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: prevent-concurrent-jobs | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout ${{ github.sha }} | ||
uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
- name: Install NPM dependencies | ||
run: npm ci | ||
|
||
- name: Configure for deployment | ||
if: github.ref == 'refs/heads/master' | ||
run: | | ||
echo "$INFRA_PULUMI_PASSPHRASE" > apps/infra/passphrase.prod.txt | ||
mkdir -p ~/.aws | ||
echo "$INFRA_AWS_CREDENTIALS" > ~/.aws/credentials | ||
env: | ||
INFRA_PULUMI_PASSPHRASE: ${{ secrets.INFRA_PULUMI_PASSPHRASE }} | ||
# See the infra README - these should actually have details for Vultr Object Storage | ||
INFRA_AWS_CREDENTIALS: ${{ secrets.INFRA_AWS_CREDENTIALS }} | ||
- name: Deploy | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
run: npm run deploy:prod |
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
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,24 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { describe, expect, test } from 'vitest'; | ||
import { ErrorPage } from './ErrorPage'; | ||
|
||
describe('ErrorPage', () => { | ||
test('should render the error message correctly', () => { | ||
const errorMessage = 'This is an error message'; | ||
render(<ErrorPage error={new Error(errorMessage)} />); | ||
|
||
const heading = screen.getByRole('heading', { level: 1 }); | ||
expect(heading.textContent).toContain('Error'); | ||
|
||
const errorMessageElement = screen.getByText(errorMessage); | ||
expect(errorMessageElement).toBeDefined(); | ||
}); | ||
|
||
test('should render a default error message when the error is not an instance of Error', () => { | ||
const errorObject = { message: 'This is an error object' }; | ||
render(<ErrorPage error={errorObject} />); | ||
|
||
const errorMessageElement = screen.getByText('{"message":"This is an error object"}'); | ||
expect(errorMessageElement).toBeDefined(); | ||
}); | ||
}); |
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,9 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
export default defineConfig({ | ||
plugins: [react()], | ||
test: { | ||
environment: 'happy-dom', | ||
}, | ||
}); |
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
Oops, something went wrong.