Skip to content

Commit

Permalink
feat: Add some initial scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
KallynGowdy committed Aug 16, 2024
1 parent f2b1cef commit 089a57a
Show file tree
Hide file tree
Showing 8 changed files with 3,480 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Deploy

on:
push:
branches-ignore:
- 'master'
- 'staging'
- 'release/**'
tags-ignore:
- '**'
pull_request:
branches-ignore:
- 'master'
- 'staging'
- 'release/**'
tags-ignore:
- '**'

jobs:
test:
name: Test
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [18.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Fix node-gyp (Windows Only)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
npm install -g node-gyp
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
- name: npm install and test
run: |
corepack enable
npm run bootstrap
npx --node-options="--max_old_space_size=4096" jest --detectOpenHandles --forceExit --no-cache
env:
CI: true
build:
name: Build AUX
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [18.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Fix node-gyp (Windows Only)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
npm install -g node-gyp
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
- name: npm install and build
run: |
corepack enable
npm run bootstrap
npm run build
env:
CI: true
docs:
name: Build Docs
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [18.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Fix node-gyp (Windows Only)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
npm install -g node-gyp
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
- name: npm install
run: |
corepack enable
npm run bootstrap
env:
CI: true
- name: build docs
run: |
cd docs
npm run build
env:
CI: true
43 changes: 43 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Preview

on:
pull_request:
tags-ignore:
- '**'
workflow_dispatch:

jobs:
preview:
name: Preview
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
repository: 'casual-simulation/casualos'
ref: 'master'
path: casualos
fetch-depth: 20
- uses: actions/checkout@v4
path: infra
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: build casualos
working-directory: casualos
run: |
corepack enable
npm run bootstrap
npm run build
env:
CI: true
- uses: pulumi/actions@v5
- name: preview infrastructure
working-directory: infra
run: |
pnpm install
pulumi login file://./.pulumi
pulumi preview --diff > ./previews/preview.diff
1 change: 1 addition & 0 deletions Pulumi.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
encryptionsalt: v1:QFUBps5oMC0=:v1:ujK1dCvyihPPrZ7g:rVcaIpOxtv3+dV1x6Vro3bz2k2a0rA==
10 changes: 10 additions & 0 deletions Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: .pulumi
runtime:
name: nodejs
options:
packagemanager: pnpm
description: A minimal TypeScript Pulumi program
config:
pulumi:tags:
value:
pulumi:template: typescript
23 changes: 23 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { aws } from '@casual-simulation/infra';
import * as pulumi from '@pulumi/pulumi';

let config = new pulumi.Config();

const allowedOrigins = config.require('allowedOrigins');
const allowedApiOrigins = config.require('allowedApiOrigins');
const filesStorageClass = config.get('filesStorageClass');
const moderationJobSchedule = config.get('moderationJobSchedule');
const moderationJobPriority = config.get('moderationJobPriority');
const moderationJobProjectVersion = config.get('moderationJobProjectVersion');
const sesIdentityName = config.get('sesIdentityName');

new aws.serverless.CasualOSComponent('casualos', {
allowedOrigins: allowedOrigins,
allowedApiOrigins: allowedApiOrigins,
filesStorageClass: filesStorageClass,
sesIdentityName: sesIdentityName,
moderationJobPriority: moderationJobPriority,
moderationJobProjectVersion: moderationJobProjectVersion,
moderationJobScheduleExpression: moderationJobSchedule,
archive: new pulumi.asset.FileArchive('../casualos/src/aux-server/aux-backend/serverless/aws/dist/handlers'),
});
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "infra-template",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Casual Simulation",
"license": "MIT",
"dependencies": {
"@casual-simulation/infra": "3.3.8-alpha.0",
"@pulumi/aws": "^6.0.0",
"@pulumi/aws-apigateway": "^2.0.0",
"@pulumi/awsx": "^2.0.2",
"@pulumi/pulumi": "^3.113.0",
"@pulumi/aws-native": "^0.116.0"
},
"devDependencies": {
"@types/node": "^18",
"typescript": "^5.0.0"
}
}
Loading

0 comments on commit 089a57a

Please sign in to comment.