Skip to content

Commit

Permalink
Merge branch 'main' into revitalb-range-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
monadabot authored Oct 2, 2023
2 parents da375c2 + 41fabd5 commit cbbbf94
Show file tree
Hide file tree
Showing 232 changed files with 7,785 additions and 1,905 deletions.
5 changes: 4 additions & 1 deletion .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Enhancement 🚀
description: Suggest a new feature or other improvement
labels: ["✨ enhancement"]
labels: ["✨ enhancement","needs-discussion"]
body:
- type: markdown
attributes:
Expand Down Expand Up @@ -65,3 +65,6 @@ body:
<!-- Please keep this note for the community -->
* Please vote by adding a 👍 reaction to the issue to help us prioritize.
* If you are interested to work on this issue, please leave a comment.
* If this issue is labeled **needs-discussion**, it means the spec
has not been finalized yet. Please reach out on the #dev channel
in the [Wing Slack](https://t.winglang.io/slack).
64 changes: 40 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ env:
CARGO_TERM_COLOR: always
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
IS_SAME_REPO_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}

jobs:
build:
Expand Down Expand Up @@ -182,18 +183,20 @@ jobs:
run: pnpm install --ignore-scripts --frozen-lockfile --filter hangar --filter examples-valid --filter examples-invalid

- name: Run E2E Benchmarks
run: pnpm bench
env:
BENCH_FAIL_THRESHOLD_PERCENT: "50"
BENCH_COMPARE_PREVIOUS: "${{ github.event_name == 'pull_request' && 'main' || '' }}"
GITHUB_TOKEN: ${{ env.IS_SAME_REPO_PR == 'true' && secrets.PROJEN_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
BENCH_PR: "${{ env.IS_SAME_REPO_PR == 'true' && github.event.pull_request.number || '' }}"
working-directory: tools/hangar
run: pnpm bench

- name: Upload Report JSON
uses: actions/upload-artifact@v3
with:
name: benchmarks
path: tools/hangar/results/report.json

- name: Create Markdown report
run: scripts/benchmark_json_to_table.mjs

e2e-test:
name: "E2E / ${{ matrix.runner }} + Node${{ matrix.node }} [${{ matrix.shard }}]"
runs-on: "${{ matrix.runner }}-latest"
Expand Down Expand Up @@ -265,6 +268,13 @@ jobs:
name: ${{ steps.diff.outputs.diff_name }}
path: ${{ steps.diff.outputs.diff_name }}

aws-sdk-spec-test:
needs:
- build
if: github.event_name == 'push' && needs.build.outputs.e2e-changed == 'true'
uses: ./.github/workflows/tf-aws-test.yml
secrets: inherit

console-preview:
name: "Console Preview"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -301,14 +311,14 @@ jobs:
flyctl deploy . --config ./apps/wing-console/console/app/preview/fly.toml --app "$APP_NAME" --image-label latest --vm-memory 512 --strategy immediate
flyctl scale count 1 --yes --app "$APP_NAME"
echo "deploytime=$(TZ=UTC date +'%Y-%m-%d %H:%M')" >> $GITHUB_OUTPUT
- name: Post preview comment
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Console preview environment is available at https://${{env.APP_NAME}}.fly.dev :rocket:
*Updated (UTC): ${{steps.deploy-fly.outputs.deploytime }}*
###### Last Updated (UTC) ${{steps.deploy-fly.outputs.deploytime }}
comment_tag: Console preview environment
GITHUB_TOKEN: ${{secrets.PROJEN_GITHUB_TOKEN}}

Expand All @@ -321,9 +331,10 @@ jobs:
- e2e-test
- benchmark
- test
- aws-sdk-spec-test
steps:
- name: Check failure
if: needs.build.result == 'failure' || needs.e2e-test.result == 'failure' || needs.benchmark.result == 'failure' || needs.test.result == 'failure'
if: needs.build.result == 'failure' || needs.e2e-test.result == 'failure' || needs.benchmark.result == 'failure' || needs.test.result == 'failure' || needs.aws-sdk-spec-test.result == 'failure'
run: exit 1
- name: Download patches
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -362,25 +373,30 @@ jobs:
- name: Login to NPM registry
run: npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Publish npm packages
working-directory: dist
- name: Publish NPM packages
uses: nick-fields/retry@v2
env:
PACKAGE_VERSION: ${{ needs.build.outputs.version }}
run: |
PACKAGES=("@winglang/sdk" "@winglang/compiler" "@wingconsole/design-system" "@wingconsole/ui" "@wingconsole/server" "@wingconsole/app" "winglang")
for PACKAGE in "${PACKAGES[@]}"; do
# Check if already published
VERSION_FOUND=$(npm view "$PACKAGE@$PACKAGE_VERSION" version || true)
if [ "$VERSION_FOUND" = "$PACKAGE_VERSION" ]; then
echo "$PACKAGE@$PACKAGE_VERSION already published, skipping"
continue
fi
# remove "@" and replace "/" with "-"
TARBALL=$(echo "$PACKAGE-$PACKAGE_VERSION.tgz" | sed 's/@//g' | sed 's/\//-/g')
npm publish "$TARBALL" --access public
done
with:
max_attempts: 7
retry_on: error
timeout_minutes: 5
command: |
cd dist
PACKAGES=("@winglang/sdk" "@winglang/compiler" "@wingconsole/design-system" "@wingconsole/ui" "@wingconsole/server" "@wingconsole/app" "winglang")
for PACKAGE in "${PACKAGES[@]}"; do
# Check if already published
VERSION_FOUND=$(npm view "$PACKAGE@$PACKAGE_VERSION" version --verbose || true)
if [ "$VERSION_FOUND" = "$PACKAGE_VERSION" ]; then
echo "$PACKAGE@$PACKAGE_VERSION already published, skipping"
continue
fi
# remove "@" and replace "/" with "-"
TARBALL=$(echo "$PACKAGE-$PACKAGE_VERSION.tgz" | sed 's/@//g' | sed 's/\//-/g')
npm publish "$TARBALL" --access public --verbose
done
- name: Publish Extension to Visual Studio Marketplace
if: needs.build.outputs.vscode-wing-changed == 'true'
Expand Down
101 changes: 87 additions & 14 deletions .github/workflows/tf-aws-test.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,63 @@
name: SDK Spec AWS Tests
run-name: SDK Spec AWS Tests (${{ inputs.repo || github.repository }}/${{inputs.ref || github.ref}})
on:
release:
types:
- published
workflow_dispatch: {}
workflow_call: {}
workflow_dispatch:
inputs:
repo:
type: string
default: winglang/wing
description: "Full repo name (owner/name)"
ref:
type: string
default: main
description: "Ref to checkout. Must be present in the repo input."

env:
AWS_REGION: "us-east-1"
NODE_VERSION: "18.16.0"
# this variable indicates wheater to use wing cli from a local version (using the current repo code)
# or use the latest remote npm version
LOCAL_BUILD: ${{ github.workflow == 'build' }}
# indicates if the action triggered from a workflow_dispatch
MANUAL: ${{ github.event_name == 'workflow_dispatch' }}
REPO: ${{ inputs.repo || github.repository }}
REF: ${{ inputs.ref || github.ref }}
PNPM_VERSION: "8.6.3"

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: test if is maintainer
uses: tspascoal/get-user-teams-membership@v2
id: testUserGroup
if: ${{ env.MANUAL == 'true' }}
with:
username: ${{ github.actor }}
team: "maintainers"
GITHUB_TOKEN: ${{ secrets.GH_GROUPS_READ_TOKEN }}
- name: cancel run if not allowed
if: ${{ env.MANUAL == 'true' && steps.testUserGroup.outputs.isTeamMember == 'false' }}
run: |
echo "User ${{github.actor}} is not allowed to dispatch this action."
exit 1
- name: Checkout Repository
uses: actions/checkout@v3
- name: Get list of directories
with:
repository: ${{env.REPO}}
ref: ${{env.REF}}

- name: Get list of directories and save them to the output
id: setdirs
shell: bash
run: |
dirs=$(ls -d examples/tests/sdk_tests/*/ | sed 's/\/$//' | grep -v "external" | jq -R -s -c 'split("\n")[:-1]')
processed_dirs=$(echo "{ \"directory\": $dirs }" | jq -c '[ .directory[] | {directory: ., name: (split("/") | last)}]')
wrapped_dirs=$(echo "{ \"test\": $processed_dirs }" | jq -c .)
echo "DIRS=$wrapped_dirs" >> $GITHUB_ENV
- name: Pass environment variable to output
id: passenv
run: |
echo "::set-output name=dirs::$DIRS"
echo "dirs=$wrapped_dirs" >> $GITHUB_OUTPUT
outputs:
tests: ${{ steps.passenv.outputs.dirs }}
tests: ${{ steps.setdirs.outputs.dirs }}

test-tf-aws:
needs: setup
Expand All @@ -39,21 +69,53 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
repository: ${{env.REPO}}
ref: ${{env.REF}}

- name: Setup pnpm
if: ${{ env.MANUAL == 'true' }}
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}

- name: Setup Node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
node-version: ${{ env.NODE_VERSION }}

##################### install a local wing version #########################
- name: Download Dist Artifacts
if: ${{ env.LOCAL_BUILD == 'true' }}
uses: actions/download-artifact@v3
with:
name: dist
path: dist

- name: Install Wing from Dist
if: ${{ env.LOCAL_BUILD == 'true' }}
run: |
mkdir localwing
cd localwing
npm init --yes
npm install ../dist/*-[0-9]*.[0-9]*.[0-9]*.tgz
./node_modules/.bin/wing --version
#################### install a remote wing version ########################
- name: Install winglang globally
if: ${{ env.LOCAL_BUILD == 'false' && env.MANUAL == 'false'}}
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 5
command: npm install -g winglang
########################################################################
- name: Installing external js modules
run: |
cd examples/tests/sdk_tests
npm install
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
Expand All @@ -68,8 +130,19 @@ jobs:
with:
max_attempts: 3
retry_on: error
timeout_minutes: 20
command: wing test -t tf-aws ${{ matrix.test.directory }}/*.w
timeout_minutes: 30
command: |
if ${{ env.MANUAL == 'true' }}
then
pnpm install
pnpm wing test -t tf-aws ${{ matrix.test.directory }}/*.w
elif ${{ env.LOCAL_BUILD == 'false'}}
then
wing test -t tf-aws ${{ matrix.test.directory }}/*.w
else
./localwing/node_modules/.bin/wing test -t tf-aws ${{ matrix.test.directory }}/*.w
fi
- name: Output Terraform log
if: failure()
run: cat ${{ runner.workspace }}/terraform.log
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ For a more in-depth look at Wing's features and benefits, check out our [documen

## Getting started 🛠️

> 🚧 Wing is still in alpha, and not recommended for production use. But we're excited for anyone to take part in shaping our
> roadmap and contributing in any way. Our [project status](https://www.winglang.io/contributing/status) page includes more information about
> stability and roadmap.
> 🚧 This is a pre-release, please see our [project status](https://www.winglang.io/contributing/status) for more details.
If you'd just like to dip your feet in the water and see what Wing is all about, you can try it out in our [online playground](https://www.winglang.io/play/) or walk through the [interactive tour](https://www.winglang.io/learn/).

Expand Down
7 changes: 2 additions & 5 deletions apps/vscode-wing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
<a href="https://www.winglang.io/contributing/">Contribute 💖</a>
</p>

> **🚧 Alpha Extension 🚧**
>
> Together with the Wing language, this extension is in alpha.
> Please enjoy the ride and feel free to [report any issues you find](https://github.com/winglang/wing/issues/new/choose).
> 🚧 This is a pre-release, please see our [project status](https://www.winglang.io/contributing/status) for more details.
### Features

Expand Down Expand Up @@ -52,4 +49,4 @@ See [issues labeled with `vscode-extension` or `language-server`](https://github

We welcome community contributions and pull requests. Check out the [Contributor's Handbook](https://www.winglang.io/contributing/) for information on how to set up a development environment. A typical flow for working on the extension is [available there](https://www.winglang.io/contributing/start-here/development#-how-do-i-build-the-vscode-extension) as well.

Most of the logic for this extension is found in the Wing Language server. The extension mostly serves as a client to that server, with some additional features. The entrypoint of the server is in the CLI [here](../wing/src/commands/lsp.ts), while the functionality is in the `wingc` Rust module [here](../../libs/wingc/src/lsp).
Most of the logic for this extension is found in the Wing Language server. The extension mostly serves as a client to that server, with some additional features. The entrypoint of the server is in the CLI [here](../wing/src/commands/lsp.ts), while the functionality is in the `wingc` Rust module [here](../../libs/wingc/src/lsp).
4 changes: 1 addition & 3 deletions apps/wing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ For a more in-depth look at Wing's features and benefits, check out our [documen

## Getting started 🛠️

> 🚧 Wing is still in alpha, and not recommended for production use. But we're excited for anyone to take part in shaping our
> roadmap and contributing in any way. Our [project status](https://www.winglang.io/contributing/status) page includes more information about
> stability and roadmap.
> 🚧 This is a pre-release, please see our [project status](https://www.winglang.io/contributing/status) for more details.
If you'd just like to dip your feet in the water and see what Wing is all about, you can try it out in our [online playground](https://www.winglang.io/play/) or walk through the [interactive tour](https://www.winglang.io/learn/).

Expand Down
2 changes: 1 addition & 1 deletion apps/wing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"copy-root-assets": "cp ../../logo/demo.gif ./logo/demo.gif",
"watch": "tsc --watch",
"test": "vitest run",
"dev": "pnpm build && ./bin/wing",
"dev": "./bin/wing",
"package": "bump-pack -b"
},
"dependencies": {
Expand Down
21 changes: 21 additions & 0 deletions apps/wing/src/commands/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Target } from "@winglang/compiler";
import { generateTmpDir } from "src/util";

const exampleDir = resolve("../../examples/tests/valid");
const exampleSmallDir = resolve("../../examples/tests/valid/subdir2");
const exampleFilePath = join(exampleDir, "captures.test.w");

describe(
Expand Down Expand Up @@ -45,6 +46,26 @@ describe(
);
});

test("should be able to compile a directory", async () => {
const artifactDir = await compile(exampleSmallDir, {
target: Target.SIM,
targetDir: `${await generateTmpDir()}/target`,
});

const stats = await stat(artifactDir);
expect(stats.isDirectory()).toBeTruthy();
});

test("should be able to compile a directory to tf-aws", async () => {
const artifactDir = await compile(exampleSmallDir, {
target: Target.TF_AWS,
targetDir: `${await generateTmpDir()}/target`,
});

const stats = await stat(artifactDir);
expect(stats.isDirectory()).toBeTruthy();
});

// https://github.com/winglang/wing/issues/2081
test("should be able to compile extern file from same directory", async () => {
// temporarily change cwd to the example directory
Expand Down
2 changes: 1 addition & 1 deletion apps/wing/src/commands/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function compile(entrypoint: string, options: CompileOptions): Prom
output.push(
"--------------------------------- STACK TRACE ---------------------------------"
);
output.push(error.stack ?? "");
output.push(causedBy.stack ?? "");
}

throw new Error(output.join("\n"));
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/01-start-here/01-contributing-to-wing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ to know to help out with the Wing project.

There are many ways to contribute to Wing:

* Contributing to the [Wing SDK (standard library)](/contributing/start-here/wingsdk)
* Reporting bugs through a [GitHub issue](https://github.com/winglang/wing/issues)
* Writing [documentation and guides](https://github.com/winglang/wing/issues?q=is%3Aissue+is%3Aopen+label%3A%22%F0%9F%93%9A+documentation%22) or adding [examples](/contributing/start-here/docs#%EF%B8%8F-how-do-i-add-an-example)
* Setting up your [development environment](/contributing/start-here/development) and working on the code
* Submitting [pull requests](/contributing/start-here/pull_requests) for new features or helping with [reviews](https://github.com/winglang/wing/pulls)
* Picking up a [good first issue](https://github.com/winglang/wing/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+no%3Aassignee+sort%3Aupdated-desc+) to work on
* Reporting and fixing [bugs](/contributing/start-here/bugs)
* Contributing to the [Wing SDK (standard library)](/contributing/start-here/wingsdk)
* Find solutions to common issues in our [troubleshooting guide](/contributing/start-here/troubleshooting)
* Commenting on [RFCs](/contributing/category/rfcs) or submitting one for major features
* Asking and answering questions in the [Wing Slack](https://t.winglang.io/slack)
Expand Down
Loading

0 comments on commit cbbbf94

Please sign in to comment.