Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmaanT committed Dec 21, 2020
1 parent d6475e8 commit c7fa0f2
Show file tree
Hide file tree
Showing 107 changed files with 26,255 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.py linguist-detectable=false
3 changes: 3 additions & 0 deletions .github/cdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
main.js
main.d.ts
2 changes: 2 additions & 0 deletions .github/cdk/cdkactions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
language: typescript
app: node main.js
166 changes: 166 additions & 0 deletions .github/cdk/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
import * as dedent from 'dedent-js';
import { Construct } from "constructs";
import { App, Stack, Workflow, Job } from "cdkactions";

export class JSIIReleaseStack extends Stack {
constructor(scope: Construct, name: string) {
super(scope, name);

// Build workflow
const build = new Workflow(this, "build", {
name: 'Build',
on: ["pullRequest", "push"]
});

new Job(build, 'build', {
runsOn: 'ubuntu-latest',
container: {
image: 'jsii/superchain'
},
steps: [
{ uses: 'actions/checkout@v2' },
{
name: 'Install dependencies',
run: 'yarn install'
},
{
name: 'Compile',
run: dedent`tools/align-version.sh
yarn build`
},
{
name: 'Unit Tests',
run: 'yarn test'
},
{
name: 'Code Coverage',
run: 'yarn codecov'
},
{
name: 'Create Bundle',
run: 'yarn package'
},
{
name: 'Integration Tests',
// run: 'yarn integration'
run: 'echo TODO: add these'
}
]
});

// Release workflow
const release = new Workflow(this, "release", {
name: 'Release',
on: { push: { branches: ['master'] } }
});

new Job(release, 'build_artifact', {
name: 'Build and upload artifact',
if: "github.repository == 'ArmaanT/cdkactions'",
runsOn: 'ubuntu-latest',
container: {
image: 'jsii/superchain'
},
steps: [
{ uses: 'actions/checkout@v2' },
{
name: 'Install dependencies',
run: 'yarn install'
},
{
name: 'Compile',
run: dedent`tools/align-version.sh
yarn build`
},
{
name: 'Unit Tests',
run: 'yarn test'
},
{
name: 'Code Coverage',
run: 'yarn codecov'
},
{
name: 'Create Bundle',
run: 'yarn package'
},
{
name: 'Integration Tests',
// run: 'yarn integration'
run: 'echo TODO: add these'
},
{
name: 'Upload artifact',
uses: 'actions/upload-artifact@v1',
with: {
name: 'dist',
path: 'dist'
}
},
{
name: 'Release to GitHub',
run: 'tools/release-github.sh',
env: {
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}',
REPO: '${{ github.repository }}',
}
},
]
});

new Job(release, 'release_npm', {
name: 'Release to NPM',
needs: 'build_artifact',
runsOn: 'ubuntu-latest',
container: {
image: 'jsii/superchain'
},
steps: [
{
name: 'Download build artifacts',
uses: 'actions/download-artifact@v1',
with: {
name: 'dist'
}
},
{
name: 'Release',
run: 'npx -p jsii-release jsii-release-npm',
env: {
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
}
}
]
});

new Job(release, 'release_pypi', {
name: 'Release to PyPI',
needs: 'build_artifact',
runsOn: 'ubuntu-latest',
container: {
image: 'jsii/superchain'
},
steps: [
{
name: 'Download build artifacts',
uses: 'actions/download-artifact@v1',
with: {
name: 'dist'
}
},
{
name: 'Release',
run: 'npx -p jsii-release jsii-release-pypi',
env: {
TWINE_USERNAME: '${{ secrets.TWINE_USERNAME }}',
TWINE_PASSWORD: '${{ secrets.TWINE_PASSWORD }}'
}
}
]
});
}
}

const app = new App();
new JSIIReleaseStack(app, 'jsii');
app.synth();
24 changes: 24 additions & 0 deletions .github/cdk/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "cdkactions-ci",
"version": "0.1.0",
"main": "main.js",
"types": "main.ts",
"license": "Apache-2.0",
"private": true,
"scripts": {
"synth": "cdkactions synth",
"compile": "tsc",
"watch": "tsc -w",
"build": "yarn compile && yarn synth",
"upgrade-cdk": "yarn upgrade cdkactions@latest cdkactions-cli@latest"
},
"dependencies": {
"cdkactions": "^0.0.12",
"constructs": "^3.2.9"
},
"devDependencies": {
"@types/node": "^14.14.6",
"cdkactions-cli": "^0.0.12",
"typescript": "^4.0.5"
}
}
33 changes: 33 additions & 0 deletions .github/cdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"compilerOptions": {
"alwaysStrict": true,
"charset": "utf8",
"declaration": true,
"experimentalDecorators": true,
"inlineSourceMap": true,
"inlineSources": true,
"lib": [
"es2018"
],
"module": "CommonJS",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"strict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"stripInternal": true,
"target": "ES2018"
},
"include": [
"**/*.ts"
],
"exclude": [
"node_modules"
]
}
Loading

0 comments on commit c7fa0f2

Please sign in to comment.