Skip to content

Commit c7fa0f2

Browse files
committed
Initial release
1 parent d6475e8 commit c7fa0f2

107 files changed

Lines changed: 26255 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.py linguist-detectable=false

.github/cdk/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
main.js
3+
main.d.ts

.github/cdk/cdkactions.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
language: typescript
2+
app: node main.js

.github/cdk/main.ts

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
import * as dedent from 'dedent-js';
2+
import { Construct } from "constructs";
3+
import { App, Stack, Workflow, Job } from "cdkactions";
4+
5+
export class JSIIReleaseStack extends Stack {
6+
constructor(scope: Construct, name: string) {
7+
super(scope, name);
8+
9+
// Build workflow
10+
const build = new Workflow(this, "build", {
11+
name: 'Build',
12+
on: ["pullRequest", "push"]
13+
});
14+
15+
new Job(build, 'build', {
16+
runsOn: 'ubuntu-latest',
17+
container: {
18+
image: 'jsii/superchain'
19+
},
20+
steps: [
21+
{ uses: 'actions/checkout@v2' },
22+
{
23+
name: 'Install dependencies',
24+
run: 'yarn install'
25+
},
26+
{
27+
name: 'Compile',
28+
run: dedent`tools/align-version.sh
29+
yarn build`
30+
},
31+
{
32+
name: 'Unit Tests',
33+
run: 'yarn test'
34+
},
35+
{
36+
name: 'Code Coverage',
37+
run: 'yarn codecov'
38+
},
39+
{
40+
name: 'Create Bundle',
41+
run: 'yarn package'
42+
},
43+
{
44+
name: 'Integration Tests',
45+
// run: 'yarn integration'
46+
run: 'echo TODO: add these'
47+
}
48+
]
49+
});
50+
51+
// Release workflow
52+
const release = new Workflow(this, "release", {
53+
name: 'Release',
54+
on: { push: { branches: ['master'] } }
55+
});
56+
57+
new Job(release, 'build_artifact', {
58+
name: 'Build and upload artifact',
59+
if: "github.repository == 'ArmaanT/cdkactions'",
60+
runsOn: 'ubuntu-latest',
61+
container: {
62+
image: 'jsii/superchain'
63+
},
64+
steps: [
65+
{ uses: 'actions/checkout@v2' },
66+
{
67+
name: 'Install dependencies',
68+
run: 'yarn install'
69+
},
70+
{
71+
name: 'Compile',
72+
run: dedent`tools/align-version.sh
73+
yarn build`
74+
},
75+
{
76+
name: 'Unit Tests',
77+
run: 'yarn test'
78+
},
79+
{
80+
name: 'Code Coverage',
81+
run: 'yarn codecov'
82+
},
83+
{
84+
name: 'Create Bundle',
85+
run: 'yarn package'
86+
},
87+
{
88+
name: 'Integration Tests',
89+
// run: 'yarn integration'
90+
run: 'echo TODO: add these'
91+
},
92+
{
93+
name: 'Upload artifact',
94+
uses: 'actions/upload-artifact@v1',
95+
with: {
96+
name: 'dist',
97+
path: 'dist'
98+
}
99+
},
100+
{
101+
name: 'Release to GitHub',
102+
run: 'tools/release-github.sh',
103+
env: {
104+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}',
105+
REPO: '${{ github.repository }}',
106+
}
107+
},
108+
]
109+
});
110+
111+
new Job(release, 'release_npm', {
112+
name: 'Release to NPM',
113+
needs: 'build_artifact',
114+
runsOn: 'ubuntu-latest',
115+
container: {
116+
image: 'jsii/superchain'
117+
},
118+
steps: [
119+
{
120+
name: 'Download build artifacts',
121+
uses: 'actions/download-artifact@v1',
122+
with: {
123+
name: 'dist'
124+
}
125+
},
126+
{
127+
name: 'Release',
128+
run: 'npx -p jsii-release jsii-release-npm',
129+
env: {
130+
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
131+
}
132+
}
133+
]
134+
});
135+
136+
new Job(release, 'release_pypi', {
137+
name: 'Release to PyPI',
138+
needs: 'build_artifact',
139+
runsOn: 'ubuntu-latest',
140+
container: {
141+
image: 'jsii/superchain'
142+
},
143+
steps: [
144+
{
145+
name: 'Download build artifacts',
146+
uses: 'actions/download-artifact@v1',
147+
with: {
148+
name: 'dist'
149+
}
150+
},
151+
{
152+
name: 'Release',
153+
run: 'npx -p jsii-release jsii-release-pypi',
154+
env: {
155+
TWINE_USERNAME: '${{ secrets.TWINE_USERNAME }}',
156+
TWINE_PASSWORD: '${{ secrets.TWINE_PASSWORD }}'
157+
}
158+
}
159+
]
160+
});
161+
}
162+
}
163+
164+
const app = new App();
165+
new JSIIReleaseStack(app, 'jsii');
166+
app.synth();

.github/cdk/package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "cdkactions-ci",
3+
"version": "0.1.0",
4+
"main": "main.js",
5+
"types": "main.ts",
6+
"license": "Apache-2.0",
7+
"private": true,
8+
"scripts": {
9+
"synth": "cdkactions synth",
10+
"compile": "tsc",
11+
"watch": "tsc -w",
12+
"build": "yarn compile && yarn synth",
13+
"upgrade-cdk": "yarn upgrade cdkactions@latest cdkactions-cli@latest"
14+
},
15+
"dependencies": {
16+
"cdkactions": "^0.0.12",
17+
"constructs": "^3.2.9"
18+
},
19+
"devDependencies": {
20+
"@types/node": "^14.14.6",
21+
"cdkactions-cli": "^0.0.12",
22+
"typescript": "^4.0.5"
23+
}
24+
}

.github/cdk/tsconfig.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"compilerOptions": {
3+
"alwaysStrict": true,
4+
"charset": "utf8",
5+
"declaration": true,
6+
"experimentalDecorators": true,
7+
"inlineSourceMap": true,
8+
"inlineSources": true,
9+
"lib": [
10+
"es2018"
11+
],
12+
"module": "CommonJS",
13+
"noEmitOnError": true,
14+
"noFallthroughCasesInSwitch": true,
15+
"noImplicitAny": true,
16+
"noImplicitReturns": true,
17+
"noImplicitThis": true,
18+
"noUnusedLocals": true,
19+
"noUnusedParameters": true,
20+
"resolveJsonModule": true,
21+
"strict": true,
22+
"strictNullChecks": true,
23+
"strictPropertyInitialization": true,
24+
"stripInternal": true,
25+
"target": "ES2018"
26+
},
27+
"include": [
28+
"**/*.ts"
29+
],
30+
"exclude": [
31+
"node_modules"
32+
]
33+
}

0 commit comments

Comments
 (0)