-
Notifications
You must be signed in to change notification settings - Fork 11
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
0 parents
commit 9f61f31
Showing
621 changed files
with
199,204 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DATABASE_URL=postgres://postgres@localhost/snaplet_development | ||
|
||
SNAPLET_SNAPSHOT_IPS=3.67.57.100 3.68.126.236 35.158.237.73 | ||
SNAPLET_DISABLE_TELEMETRY=1 | ||
|
||
CIPHER_KEY=<> | ||
|
||
AWS_DEFAULT_REGION=<> | ||
AWS_DEFAULT_ACCOUNT=<> | ||
AWS_ACCESS_KEY_ID=<> | ||
AWS_SECRET_ACCESS_KEY=<> | ||
AWS_S3_BUCKET=<> |
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,76 @@ | ||
const baseConfig = { | ||
ignorePatterns: [ | ||
'node_modules/*', | ||
'node_modules/**/*.d.ts', | ||
'**/__fixtures__/**/*.ts', | ||
'**/cloudSnapshots/**/*.ts', | ||
], | ||
extends: '@redwoodjs/eslint-config', | ||
plugins: ['import'], | ||
rules: { | ||
'import/extensions': [ | ||
'warn', | ||
'always', | ||
{ | ||
ignorePackages: true, | ||
}, | ||
], | ||
'no-console': [ | ||
'error', | ||
{ | ||
allow: ['log', 'time', 'timeEnd'], | ||
}, | ||
], | ||
'prettier/prettier': 'warn', | ||
'react/react-in-jsx-scope': 'off', | ||
'react/no-unescaped-entities': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unused-vars': 'warn', | ||
'@typescript-eslint/no-restricted-imports': [ | ||
'error', | ||
{ | ||
paths: [ | ||
{ | ||
name: 'api', | ||
message: | ||
'Only type imports are allowed for the api to avoid bundling api code in the cli', | ||
allowTypeImports: true, | ||
}, | ||
], | ||
}, | ||
], | ||
'no-unused-vars': 'off', | ||
'no-new': 'off', | ||
'react-hooks/exhaustive-deps': 'off', | ||
'react/prop-types': 'off', | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['infrastructure/**/*', 'web/**/*', 'extension/src/webview/**/*'], | ||
rules: { | ||
'import/extensions': 'off', | ||
}, | ||
}, | ||
], | ||
} | ||
|
||
const typescriptAdvancedConfig = { | ||
...baseConfig, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: [ | ||
'./cli/tsconfig.json', | ||
'./packages/cli/tsconfig.json', | ||
'./packages/sdk/tsconfig.json', | ||
], | ||
}, | ||
rules: { | ||
...baseConfig.rules, | ||
'@typescript-eslint/no-floating-promises': 'error', | ||
}, | ||
} | ||
|
||
module.exports = typescriptAdvancedConfig |
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,19 @@ | ||
name: Generate cache hash keys | ||
|
||
outputs: | ||
yarn-deps-hash: | ||
description: "hash keys used for yarn deps" | ||
value: ${{ steps.generate-hash-keys.outputs.yarn-deps }} | ||
build-cli-hash: | ||
description: "hash keys used for cli build" | ||
value: ${{ steps.generate-hash-keys.outputs.build-cli }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Generate hash keys | ||
id: generate-hash-keys | ||
run: | | ||
echo "yarn-deps=${{ hashFiles('yarn.lock') }}-${{ hashFiles('./api/prisma/schema.prisma') }}" >> $GITHUB_OUTPUT | ||
echo "build-cli=${{ hashFiles('./cli/src/**', './packages/sdk/src/**', './packages/cli/**') }}-${{ hashFiles('yarn.lock', './api/prisma/schema.prisma') }}" >> $GITHUB_OUTPUT | ||
shell: bash |
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,8 @@ | ||
name: Install dependencies | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install dependencies | ||
run: yarn install | ||
shell: bash |
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,10 @@ | ||
name: Setup AWS credentials | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.PREVIEW_AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.PREVIEW_AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-central-1 |
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,11 @@ | ||
name: Setup Node.js | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: buildjet/setup-node@v3 | ||
with: | ||
node-version: 18.18.2 | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: corepack enable | ||
shell: bash |
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,25 @@ | ||
name: Build snaplet binary | ||
|
||
inputs: | ||
lookup-only: | ||
description: 'Should only lookup for the cache' | ||
required: false | ||
default: "false" | ||
skip-on-miss: | ||
description: 'choose if you want to skip on lookup miss' | ||
required: false | ||
default: "false" | ||
outputs: | ||
cache-hit: | ||
description: "cache has been hit" | ||
value: ${{ steps.build-cli-cache.outputs.cache-hit }} | ||
# Assume your in a workflow with install action already ran | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Build Snaplet CLI | ||
if: steps.build-cli-cache.outputs.cache-hit != 'true' && inputs.skip-on-miss != 'true' | ||
run: | | ||
yarn build:binary -- --targets node18-linux-x64 | ||
ls -al ./cli/bin | ||
shell: bash |
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,15 @@ | ||
module.exports = { | ||
types: [ | ||
{ types: ["feat", "feature"], label: "🎉 New Features" }, | ||
{ types: ["fix", "bugfix"], label: "🐛 Bugfixes" }, | ||
{ types: ["improvements", "enhancement"], label: "🔨 Improvements" }, | ||
{ types: ["perf"], label: "🏎️ Performance Improvements" }, | ||
{ types: ["build", "ci"], label: "🏗️ Build System" }, | ||
{ types: ["refactor"], label: "🪚 Refactors" }, | ||
{ types: ["doc", "docs"], label: "📚 Documentation Changes" }, | ||
{ types: ["test", "tests"], label: "🔍 Tests" }, | ||
{ types: ["style"], label: "💅 Code Style Changes" }, | ||
{ types: ["chore"], label: "🧹 Chores" }, | ||
{ types: ["other"], label: "Other Changes" }, | ||
], | ||
}; |
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,40 @@ | ||
## Describe your changes | ||
|
||
|
||
|
||
<!--- Link the corresponding issue from Linear --> | ||
Fixes S-XXX | ||
|
||
<!--- | ||
Conventional commit cheatsheet for your PR title (https://www.conventionalcommits.org/en/v1.0.0/#summary) | ||
Example: | ||
feat(web): Add `Button` component. | ||
^ ^ ^ | ||
| | |__ Subject | ||
| |_______ Scope (optional, can be multiple with "," delimiter) | ||
|____________ Type | ||
Types: | ||
- 🎉 New Features: feat, feature | ||
- 🐛 Bugfixes: fix, bugfix | ||
- 🔨 Improvements: improvements, enhancement | ||
- 🏎️ Performance Improvements: perf | ||
- 🏗️ Build System: build, ci | ||
- 🪚 Refactors: refactor | ||
- 📚 Documentation Changes: doc, docs | ||
- 🔍 Tests: test, tests | ||
- 💅 Code Style Changes: style | ||
- 🧹 Chores: chore | ||
- Other Changes: other | ||
Scopes: | ||
- api | ||
- cli | ||
- sdk | ||
- web | ||
- dev | ||
- infra | ||
- ext | ||
--> |
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,68 @@ | ||
name: Build main shared cache | ||
|
||
env: | ||
SNAPLET_TARGET_DATABASE_URL: 'postgresql://postgres:postgres@localhost/snaplet_development' | ||
DATABASE_URL: 'postgresql://postgres:postgres@localhost/snaplet_development' | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: build-shared-cache-main | ||
cancel-in-progress: true | ||
|
||
# Build a shared cache for the dependencies to be shared between our PR and workflows | ||
jobs: | ||
build-shared-deps-cache: | ||
runs-on: buildjet-4vcpu-ubuntu-2204 | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-node | ||
- uses: ./.github/actions/install | ||
|
||
build-shared-tests-cache: | ||
needs: build-shared-deps-cache | ||
runs-on: buildjet-4vcpu-ubuntu-2204 | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-node | ||
- uses: ./.github/actions/tests/install | ||
# Build and cache snaplet binary | ||
- uses: ./.github/actions/tests/build-cli | ||
with: | ||
lookup-only: true | ||
# Install and cache playwright install for e2e web | ||
- uses: ./.github/actions/tests/install-playwright | ||
with: | ||
lookup-only: true | ||
|
||
# Cache our latests success snapshot to avoid re-download in between PR and workflow | ||
build-shared-snapshot-cache: | ||
needs: build-shared-deps-cache | ||
runs-on: buildjet-4vcpu-ubuntu-2204 | ||
# Right now there is no way to download our snapshot without having to restore it, so sadly we need a database | ||
services: | ||
postgres: | ||
image: postgres:13 | ||
credentials: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-node | ||
- uses: ./.github/actions/install | ||
# TODO: add a way to download the snapshot without the need to restore it | ||
- uses: ./.github/actions/tests/restore-latest-snapshot | ||
with: | ||
snaplet-access-token: ${{ secrets.SNAPLET_ACCESS_TOKEN }} | ||
database-url: postgresql://postgres:postgres@localhost/snaplet_development | ||
|
Oops, something went wrong.