Skip to content

Commit

Permalink
XGS open source components
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbertt committed Oct 11, 2024
0 parents commit 0df376e
Show file tree
Hide file tree
Showing 120 changed files with 17,799 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.rs]
indent_size = 4
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Each app has its own .env file, see each .env.example for more information.
# We are following the Turborepo recommendation: https://turbo.build/repo/docs/crafting-your-repository/using-environment-variables#use-env-files-in-packages
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This configuration only applies to the package manager root.
/** @type {import("eslint").Linter.Config} */
module.exports = {
ignorePatterns: ["apps/**", "packages/**"],
extends: ["@repo/eslint-config/library.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
35 changes: 35 additions & 0 deletions .github/actions/setup-dfx/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Setup DFX
description: Setup DFX

inputs:
dfx-identity-pem:
description: "The DFX identity PEM content"

runs:
using: "composite"
steps:
- name: Setup DFX
uses: dfinity/setup-dfx@main
with:
dfx-version: "auto"

- name: Import DFX identity
shell: bash
run: |
if [ -n "${{ inputs.dfx-identity-pem }}" ]; then
echo "${{ inputs.dfx-identity-pem }}" > ./identity.pem
dfx identity import --ic --storage-mode plaintext ci_identity ./identity.pem
dfx identity use ci_identity
else
echo "No DFX identity PEM provided, skipping identity import."
fi
# just to check if the identity is imported correctly
- name: Print principal
shell: bash
run: |
if [ -n "${{ inputs.dfx-identity-pem }}" ]; then
dfx identity get-principal
else
echo "No DFX identity PEM provided, skipping principal print."
fi
41 changes: 41 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Setup NodeJS
description: Setup NodeJS

runs:
using: "composite"
steps:
- name: Setup Turbo cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-${{ github.job }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-turbo-
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
registry-url: "https://registry.npmjs.org"

- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
run_install: false

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
shell: bash
run: pnpm i --frozen-lockfile
18 changes: 18 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Setup Rust
description: Setup Rust
inputs:
cache-key:
description: "The key to use for caching"
required: true

runs:
using: "composite"
steps:
- name: Install Rust toolchain
shell: bash
run: rustup show

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ inputs.cache-key }}
66 changes: 66 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Deployments

on:
# Enable this when you are ready to deploy using the CI/CD workflow
# workflow_run:
# workflows: ["Unit and Integration Tests"]
# types:
# - completed
# branches:
# - main
workflow_dispatch:

jobs:
check-workflow:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
steps:
- name: Workflow check
run: exit 0

deploy:
needs:
- check-workflow
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: ./.github/actions/setup-node

- uses: ./.github/actions/setup-rust
with:
cache-key: "build-wasm"

- uses: ./.github/actions/setup-dfx
with:
dfx-identity-pem: ${{ secrets.DFX_MAINNET_PEM }}

- name: Deploy SSP Backend
run: pnpm turbo run deploy --filter=ssp_backend
env:
ID_TOKEN_ISSUER_BASE_URL: https://${{ vars.AUTH0_DOMAIN }}/
ID_TOKEN_AUDIENCE: ${{ vars.MOBILE_APP_AUTH0_CLIENT_ID }}
DFX_NETWORK: ${{ vars.DFX_NETWORK }}

deploy-auth0:
needs:
- check-workflow
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: ./.github/actions/setup-node

- name: Deploy Auth0
run: pnpm turbo run deploy --filter=auth0
env:
AUTH0_DOMAIN: ${{ vars.AUTH0_DOMAIN }}
AUTH0_CLIENT_ID: ${{ vars.AUTH0_DEPLOY_CLI_CLIENT_ID }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_DEPLOY_CLI_CLIENT_SECRET }}
AUTH0_PRESERVE_KEYWORDS: true
AUTH0_ALLOW_DELETE: true
WEB_APP_URL: ${{ vars.WEB_APP_URL }}
HASURA_GRAPHQL_ENDPOINT: ${{ vars.HASURA_GRAPHQL_ENDPOINT }}
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
38 changes: 38 additions & 0 deletions .github/workflows/format-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Format and Lint checks

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup-node

- uses: ./.github/actions/setup-rust
with:
cache-key: "fmt"

- name: Run format command
run: pnpm format:check

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup-node

- uses: ./.github/actions/setup-rust
with:
cache-key: "clippy"

- name: Run Turborepo lint command
run: pnpm lint
26 changes: 26 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Unit and Integration Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup-node

- uses: ./.github/actions/setup-rust
with:
cache-key: "build-wasm"

- uses: ./.github/actions/setup-dfx

- name: Run Turborepo tests
run: pnpm test
79 changes: 79 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Dependencies
node_modules
.pnp
.pnp.js

# Local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Testing
coverage

# Turbo
.turbo

# Vercel
.vercel

# Build Outputs
.next/
out/
build
dist
web-build/


# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Misc
.DS_Store
*.pem

# Expo
.expo/

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem
**/.DS_Store

# typescript
*.tsbuildinfo

# Internet Computer
.dfx/
pocket-ic

# generated files
**/declarations/

# rust
target/

# Binaries
bin/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

auto-install-peers=true
legacy-peer-deps=true
node-linker=hoisted
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pnpm-lock.yaml

packages/ssp-backend/src/generated/

apps/auth0/config/**/*.yaml
apps/auth0/config/**/*.yml

apps/mobile/android/
apps/mobile/ios/

apps/backend/schemaspy/
apps/backend/hasura/metadata/

packages/graphql/src/generated/
packages/graphql/graphql.schema.json

apps/storybook/storybook-static
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"recommendations": [
"rust-lang.rust-analyzer",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"expo.vscode-expo-tools",
"dfinity-foundation.vscode-motoko",
"graphql.vscode-graphql",
"graphql.vscode-graphql-syntax",
"styled-components.vscode-styled-components",
"lokalise.i18n-ally"
]
}
20 changes: 20 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"editor.formatOnSave": true,
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"rust-analyzer.cargo.extraEnv": {
// just to avoid rust-analyzer env variables errors
"ID_TOKEN_ISSUER_BASE_URL": "https://dummy-issuer-url/",
"ID_TOKEN_AUDIENCE": "dummy-audience"
},
"rust-analyzer.runnables.extraEnv": {
"ID_TOKEN_ISSUER_BASE_URL": "https://test-issuer-url.local/",
"ID_TOKEN_AUDIENCE": "test-audience"
},
"rust-analyzer.cargo.features": "all",
"i18n-ally.localesPaths": ["apps/web/messages"],
"i18n-ally.keystyle": "nested"
}
Loading

0 comments on commit 0df376e

Please sign in to comment.