Skip to content

Commit

Permalink
Merge branch 'main' into cli-cloud-progress
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jun 29, 2023
2 parents 1b57c17 + e65e61b commit ac297b8
Show file tree
Hide file tree
Showing 615 changed files with 24,535 additions and 14,246 deletions.
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/incident.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Incident 🚒
description: Respond to a production incident - checklist
labels: ["🚒 incident"]
body:
- type: textarea
id: description
attributes:
label: "Incident description"
placeholder: "Please describe the issue in a few clear words"
validations:
required: true
- type: textarea
id: workaround
attributes:
label: "Is there a workaround?"
placeholder: "What's the workaround to avoid this issue?"
- type: markdown
attributes:
value: |
A production incident started. Please stay cool, no need to call 911. Follow the checklist below - you've got this :muscle: <br/>
You may refer to the [Wing maintainers operational guide](https://www.winglang.io/contributing/maintainers/operations) for more details.
- type: checkboxes
id: checklist
attributes:
label: Incident Response Checklist
description:
options:
- label: CREATE this issue (fill up the title, description and submit), then follow the next steps.
- label: PIN the incident issue.
- label: ACKNOWLEDGE the incident on [PagerDuty](https://monada.pagerduty.com/incidents).
- label: ACKNOWLEDGE the incident on [BetterStack](https://uptime.betterstack.com/team/48207/incidents).
- label: WORKAROUND - if there is one, make sure it is documented in the section above.
- label: PRIORITIZE (P0/P1/P2 - see the definitions [here](https://www.winglang.io/contributing/maintainers/operations#severity-levels)).
- label: (optional) CONTACT a relevant person who has more information about the incident.
- label: (optional) ANNOUNCE major incidents on Slack \#dev or \#general channels. "NOTICE - P0 incident started. {incident-description}. Track on {link to issue}".
- label: HANDLE by reverting or forward fixing.
- label: UPDATE the team on your actions in the created \#alert Slack thread throughout the incident.
- label: RESOLVE the incident on [PagerDuty](https://monada.pagerduty.com/incidents) (BetterStack resolves automatically).
- label: UPDATE the team on the issue closure.
- label: (optional) ANNOUNCE closure of major incidents on Slack \#dev or \#general channels. "NOTICE - P0 incident ended. {incident-resolution-description}. Track on {link to issue}".
- label: UNPIN the incident issue.
- label: LESSONS LEARNED should be shared via the "post-mortem" workflow on \#dev Slack channel.
- label: CLOSE the incident issue.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Checklist

- [ ] Title matches [Winglang's style guide](https://docs.winglang.io/contributors/pull_requests#how-are-pull-request-titles-formatted)
- [ ] Title matches [Winglang's style guide](https://docs.winglang.io/contributing/pull_requests#how-are-pull-request-titles-formatted)
- [ ] Description explains motivation and solution
- [ ] Tests added (always)
- [ ] Docs updated (only required for features)
Expand Down
127 changes: 116 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
version: ${{ fromJson(steps.changelog.outputs.data).newVersion }}
last-version: ${{ fromJson(steps.changelog.outputs.data).lastVersion }}
changelog: ${{ fromJson(steps.changelog.outputs.data).changelog }}
vscode-wing-changed: ${{ steps.git-diff-vscode-wing.outputs.diff }}

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -71,6 +73,8 @@ jobs:

- name: Build
run: npm run build:ci
env:
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}

- name: Package
run: npm run package:ci
Expand All @@ -87,6 +91,18 @@ jobs:
name: wingconsoleserver
path: apps/wing-console/console/server/*.tgz

- name: Upload Wing Console Design System
uses: actions/upload-artifact@v3
with:
name: wingconsoledesignsystem
path: apps/wing-console/console/design-system/*.tgz

- name: Upload Wing Console UI
uses: actions/upload-artifact@v3
with:
name: wingconsoleui
path: apps/wing-console/console/ui/*.tgz

- name: Upload Wing Console App
uses: actions/upload-artifact@v3
with:
Expand All @@ -111,6 +127,19 @@ jobs:
name: wingc
path: target/wasm32-wasi/release/wingc.wasm

- name: Derive appropriate SHAs for base and head for `nx affected` commands
id: setSHAs
uses: nrwl/nx-set-shas@v3

- name: Check git diff of VSCode Extension
id: git-diff-vscode-wing
run: |
if git diff --quiet ${{ steps.setSHAs.outputs.base }} ${{ github.sha }} -- apps/vscode-wing; then
echo "::set-output name=diff::false"
else
echo "::set-output name=diff::true"
fi
- name: Upload Extension
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -178,13 +207,34 @@ jobs:
- name: Test
run: npm run test:ci

- name: Create git patch
id: diff
run: |
git add --all
git diff --staged --patch > build.diff
if [ -s build.diff ]; then
echo "Diff found, creating a patch to apply later"
cat build.diff
echo "diff=true" >> $GITHUB_OUTPUT
fi
- name: Upload Diff
if: steps.diff.outputs.diff == 'true'
uses: actions/upload-artifact@v3
with:
name: build.diff
path: build.diff

benchmarks:
name: E2E Benchmarks
runs-on: ubuntu-latest
needs:
- build
env:
HANGAR_WING_SPEC: "file:${{ github.workspace }}/wing/winglang-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCONSOLE_APP_SPEC: "file:${{ github.workspace }}/wingconsoleapp/wingconsole-app-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCONSOLE_SERVER_SPEC: "file:${{ github.workspace }}/wingconsoleserver/wingconsole-server-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCONSOLE_DESIGN_SYSTEM_SPEC: "file:${{ github.workspace }}/wingconsoledesignsystem/wingconsole-design-system-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCONSOLE_UI_SPEC: "file:${{ github.workspace }}/wingconsoleui/wingconsole-ui-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCOMPILER_SPEC: "file:${{ github.workspace }}/wingcompiler/winglang-compiler-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGSDK_SPEC: "file:${{ github.workspace }}/wingsdk/winglang-sdk-${{ needs.build.outputs.version }}.tgz"
steps:
Expand Down Expand Up @@ -247,15 +297,21 @@ jobs:
full_run: false
runs-on: "${{ matrix.runner }}-latest"
env:
HANGAR_WING_SPEC: "file:${{ github.workspace }}/wing/winglang-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCOMPILER_SPEC: "file:${{ github.workspace }}/wingcompiler/winglang-compiler-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGSDK_SPEC: "file:${{ github.workspace }}/wingsdk/winglang-sdk-${{ needs.build.outputs.version }}.tgz"
HANGAR_WING_SPEC: "file:${{ github.workspace }}/target/wing/winglang-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCONSOLE_APP_SPEC: "file:${{ github.workspace }}/target/wingconsoleapp/wingconsole-app-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCONSOLE_SERVER_SPEC: "file:${{ github.workspace }}/target/wingconsoleserver/wingconsole-server-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCONSOLE_DESIGN_SYSTEM_SPEC: "file:${{ github.workspace }}/target/wingconsoledesignsystem/wingconsole-design-system-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCONSOLE_UI_SPEC: "file:${{ github.workspace }}/target/wingconsoleui/wingconsole-ui-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGCOMPILER_SPEC: "file:${{ github.workspace }}/target/wingcompiler/winglang-compiler-${{ needs.build.outputs.version }}.tgz"
HANGAR_WINGSDK_SPEC: "file:${{ github.workspace }}/target/wingsdk/winglang-sdk-${{ needs.build.outputs.version }}.tgz"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download Build Artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: target

- name: Setup Node
uses: actions/setup-node@v3
Expand All @@ -275,7 +331,29 @@ jobs:
working-directory: tools/hangar
run: |
npm run test:generate
npm run test -- --shard=${{ matrix.shard }}
npm run test -- --shard=${{ matrix.shard }} --update=${{ matrix.runner == 'ubuntu' && matrix.node == '18' }}
- name: Create mutation if needed
# we only care about the diff in our standard dev env
if: matrix.runner == 'ubuntu' && matrix.node == '18'
id: diff
env:
RAW_SHARD: ${{ matrix.shard }}
run: |
SHARD=$(echo $RAW_SHARD | sed 's/\//of/g')
DIFF_NAME="e2e-$SHARD.diff"
git add --all
git diff --staged --patch > $DIFF_NAME
if [ -s $DIFF_NAME ]; then
echo "diff=true" >> $GITHUB_OUTPUT
echo "diff_name=$DIFF_NAME" >> $GITHUB_OUTPUT
fi
- name: Upload mutation
if: matrix.runner == 'ubuntu' && matrix.node == '18' && steps.diff.outputs.diff == 'true'
uses: actions/upload-artifact@v3
with:
name: ${{ steps.diff.outputs.diff_name }}
path: ${{ steps.diff.outputs.diff_name }}

quality-gate:
name: Quality Gate
Expand All @@ -286,6 +364,19 @@ jobs:
- benchmarks
- unit-tests
steps:
- name: Download patches
uses: actions/download-artifact@v3
- name: Check patches
run: |
PATCH_COUNT=0
for f in $(find ./*.diff/*.diff); do
PATCH_COUNT=$((PATCH_COUNT + 1))
cat $f
done
if [ $PATCH_COUNT -gt 0 ]; then
echo "Found $PATCH_COUNT patches, build failed. A self-mutation should happen soon."
exit 1
fi
- name: All good
run: echo "Builds and tests passed! 🎉🎉🎉"

Expand All @@ -298,7 +389,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3

- name: Tag commit
uses: tvdias/[email protected]
Expand All @@ -307,12 +398,8 @@ jobs:
repo-token: "${{ secrets.PROJEN_GITHUB_TOKEN }}"
tag: "v${{ needs.build.outputs.version }}"

- name: Check published VSCode Version
id: vscode-version
run: echo "version=$(npx -y vsce show Monada.vscode-wing --json | jq '.versions[0].version' -r)" >> $GITHUB_OUTPUT

- name: Publish Extension to Visual Studio Marketplace
if: ${{ steps.vscode-version.outputs.version != needs.build.outputs.version }}
if: needs.build.outputs.vscode-wing-changed == 'true'
uses: "HaaLeo/publish-vscode-extension@v1"
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
Expand Down Expand Up @@ -340,6 +427,24 @@ jobs:
working-directory: wingcompiler
run: npm publish *.tgz --access public

- name: Publish Wing Console Design System
if: ${{ steps.wingconsoledesignsystem-version.outputs.version != needs.build.outputs.version }}
working-directory: wingconsoledesignsystem
run: npm publish *.tgz --access public

- name: Check published Wing Console Design System version
id: wingconsoledesignsystem-version
run: echo "version=$(npm view @wingconsole/design-system version)" >> $GITHUB_OUTPUT

- name: Check published Wing Console UI version
id: wingconsoleui-version
run: echo "version=$(npm view @wingconsole/ui version)" >> $GITHUB_OUTPUT

- name: Publish Wing Console UI
if: ${{ steps.wingconsoleui-version.outputs.version != needs.build.outputs.version }}
working-directory: wingconsoleui
run: npm publish *.tgz --access public

- name: Check published Wing Console Server version
id: wingconsoleserver-version
run: echo "version=$(npm view @wingconsole/server version)" >> $GITHUB_OUTPUT
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "Pull Request Mutation"

run-name: "Pull Request Mutation: ${{ github.event.workflow_run.head_branch }}"

on:
workflow_run:
workflows:
- Build
types:
- completed

concurrency:
group: "mutation-${{ github.event.workflow_run.head_branch }}"
cancel-in-progress: true

permissions:
contents: read
packages: read
statuses: write

jobs:
mutate:
runs-on: ubuntu-latest
# Run if the workflow run is a pull request
if: github.event.workflow_run.conclusion == 'failure' && (github.event.workflow_run.head_branch != 'main' || github.event.workflow_run.head_repository.fork)
steps:
- name: Download artifacts
id: download-artifacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
run_id: ${{ github.event.workflow_run.id }}
name: .+\.diff$
name_is_regexp: true
if_no_artifact_found: ignore
path: patches
- uses: marocchino/action-workflow_run-status@54b6e87d6cb552fc5f36dbe9a722a6048725917a
if: steps.download-artifacts.outputs.found_artifact == 'true'
with:
github_token: ${{secrets.GITHUB_TOKEN}}
- name: Token check
if: steps.download-artifacts.outputs.found_artifact == 'true'
run: |
if ${{ secrets.MUTATION_TOKEN && 'true' || 'false' }}; then
echo "Token available, enabling self mutation"
exit 0
else
echo "Add a MUTATION_TOKEN repository secret with a personal access token to enable self mutation.
It requires private repo read/write permissions." >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Disable Git Hooks
if: steps.download-artifacts.outputs.found_artifact == 'true'
run: |
git config --global core.hooksPath /dev/null
- name: Checkout Workflow Branch
if: steps.download-artifacts.outputs.found_artifact == 'true'
uses: actions/checkout@v3
with:
token: ${{secrets.MUTATION_TOKEN}}
ref: ${{ github.event.workflow_run.head_branch }}
repository: ${{ github.event.workflow_run.head_repository.full_name }}
path: repo
- id: self_mutation
if: steps.download-artifacts.outputs.found_artifact == 'true'
name: Apply downloaded pathes
working-directory: repo
run: |
for f in $(find ../patches/*.diff/*.diff); do
echo "Applying $f"
git apply $f
if [ $? -eq 0 ]; then
echo "Patch applied successfully"
rm $f
else
echo "Patch failed to apply"
cat $f
exit 1
fi
done
- name: Push changes
if: steps.download-artifacts.outputs.found_artifact == 'true'
working-directory: repo
env:
HEAD_REF: ${{ github.event.workflow_run.head_branch }}
run: |
git config user.name "monada-bot[bot]"
git config user.email "[email protected]"
git add --all
git commit -s -m "chore: self mutation"
git push origin HEAD:$HEAD_REF
1 change: 1 addition & 0 deletions .github/workflows/pull-request-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
tutorial
vscode
plugins
console
types: |-
feat
fix
Expand Down
Loading

0 comments on commit ac297b8

Please sign in to comment.