Skip to content

Commit

Permalink
feat(golang): Support Multi-version and root level modules (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
iliapolo authored Feb 11, 2021
1 parent 2851ea0 commit 4ef7d59
Show file tree
Hide file tree
Showing 70 changed files with 5,736 additions and 309 deletions.
230 changes: 230 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
{
"env": {
"jest": true,
"node": true
},
"root": true,
"plugins": [
"@typescript-eslint",
"import"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.eslint.json"
},
"extends": [
"plugin:import/typescript"
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".tsx"
]
},
"import/resolver": {
"node": {},
"typescript": {
"project": "./tsconfig.eslint.json"
}
}
},
"ignorePatterns": [
"*.js",
"!.projenrc.js",
"*.d.ts",
"node_modules/",
"*.generated.ts",
"coverage"
],
"rules": {
"@typescript-eslint/no-require-imports": [
"error"
],
"indent": [
"off"
],
"@typescript-eslint/indent": [
"error",
2
],
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"comma-dangle": [
"error",
"always-multiline"
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"no-multi-spaces": [
"error",
{
"ignoreEOLComments": false
}
],
"array-bracket-spacing": [
"error",
"never"
],
"array-bracket-newline": [
"error",
"consistent"
],
"object-curly-spacing": [
"error",
"always"
],
"object-curly-newline": [
"error",
{
"multiline": true,
"consistent": true
}
],
"object-property-newline": [
"error",
{
"allowAllPropertiesOnSameLine": true
}
],
"keyword-spacing": [
"error"
],
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"space-before-blocks": [
"error"
],
"curly": [
"error",
"multi-line",
"consistent"
],
"@typescript-eslint/member-delimiter-style": [
"error"
],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/test/**",
"**/build-tools/**"
],
"optionalDependencies": false,
"peerDependencies": true
}
],
"import/no-unresolved": [
"error"
],
"import/order": [
"warn",
{
"groups": [
"builtin",
"external"
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"no-duplicate-imports": [
"error"
],
"no-shadow": [
"off"
],
"@typescript-eslint/no-shadow": [
"error"
],
"key-spacing": [
"error"
],
"semi": [
"error",
"always"
],
"quote-props": [
"error",
"consistent-as-needed"
],
"no-multiple-empty-lines": [
"error"
],
"max-len": [
"error",
{
"code": 150,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreComments": true,
"ignoreRegExpLiterals": true
}
],
"@typescript-eslint/no-floating-promises": [
"error"
],
"no-return-await": [
"off"
],
"@typescript-eslint/return-await": [
"error"
],
"no-trailing-spaces": [
"error"
],
"dot-notation": [
"error"
],
"no-bitwise": [
"error"
],
"@typescript-eslint/member-ordering": [
"error",
{
"default": [
"public-static-field",
"public-static-method",
"protected-static-field",
"protected-static-method",
"private-static-field",
"private-static-method",
"field",
"constructor",
"method"
]
}
]
},
"overrides": [
{
"files": [
".projenrc.js"
],
"rules": {
"@typescript-eslint/no-require-imports": "off",
"import/no-extraneous-dependencies": "off"
}
}
]
}
17 changes: 11 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".

name: Build
on:
pull_request: {}
Expand All @@ -9,15 +10,19 @@ jobs:
env:
CI: "true"
steps:
- uses: actions/checkout@v2
- run: yarn install --check-files --frozen-lockfile
- run: npx projen
- run: git diff --exit-code
name: Anti-tamper check
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Synthesize project files
run: npx projen
- name: Anti-tamper check
run: git diff --exit-code
- name: Set git identity
run: |-
git config user.name "Auto-bump"
git config user.email "[email protected]"
- run: npx projen build
- name: Build
run: npx projen build
- name: Anti-tamper check
run: git diff --exit-code
58 changes: 58 additions & 0 deletions .github/workflows/rebuild-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".

name: rebuild-bot
on:
issue_comment:
types:
- created
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
env:
CI: "true"
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body,
'@projen rebuild') }}
steps:
- name: Post comment to issue
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: "_projen_: Rebuild started"
- name: Get pull request branch
id: query_pull_request
env:
PULL_REQUEST_URL: ${{ github.event.issue.pull_request.url }}
run: |-
rm -f /tmp/pr.json
curl --silent $PULL_REQUEST_URL > /tmp/pr.json
BRANCH_STR=$(cat /tmp/pr.json | jq ".head.ref")
REPO_NAME=$(cat /tmp/pr.json | jq ".head.repo.full_name")
echo "::set-output name=branch::$(node -p $BRANCH_STR)"
echo "::set-output name=repo::$(node -p $REPO_NAME)"
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.query_pull_request.outputs.branch }}
repository: ${{ steps.query_pull_request.outputs.repo }}
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Synthesize project files
run: npx projen
- name: Set git identity
run: |-
git config user.name "Auto-bump"
git config user.email "[email protected]"
- name: Build
run: npx projen build
- name: Commit changes
run: 'git commit -am "chore: update generated files"'
- name: Push changes
run: git push --follow-tags origin $BRANCH
env:
BRANCH: ${{ steps.query_pull_request.outputs.branch }}
- name: Post comment to issue
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: "_projen_: Rebuild complete. Updates pushed to pull request branch."
34 changes: 24 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".

name: Release
on:
push:
Expand All @@ -11,20 +12,30 @@ jobs:
env:
CI: "true"
steps:
- uses: actions/checkout@v2
- run: yarn install --check-files --frozen-lockfile
- run: npx projen
- run: git diff --exit-code
name: Anti-tamper check
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Synthesize project files
run: npx projen
- name: Anti-tamper check
run: git diff --exit-code
- name: Set git identity
run: |-
git config user.name "Auto-bump"
git config user.email "[email protected]"
- run: npx projen bump
- run: npx projen build
- name: Bump to next version
run: npx projen bump
- name: Build
run: npx projen build
- name: Anti-tamper check
run: git diff --exit-code
- run: git push --follow-tags origin $GITHUB_REF
- name: Push changes
run: git push --follow-tags origin $BRANCH
env:
BRANCH: ${{ github.ref }}
- name: Upload artifact
uses: actions/[email protected]
with:
Expand All @@ -34,13 +45,16 @@ jobs:
name: Release to NPM
needs: build
runs-on: ubuntu-latest
container:
image: jsii/superchain
steps:
- name: Download build artifacts
uses: actions/download-artifact@v1
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Release
run: npx -p jsii-release jsii-release-npm
run: npx -p jsii-release@latest jsii-release-npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_DIST_TAG: latest
Expand Down
Loading

0 comments on commit 4ef7d59

Please sign in to comment.