Skip to content

Commit

Permalink
Merge branch 'main' into rybickic/enable-sim-updates-default
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr authored Jun 14, 2024
2 parents a4fd22e + 6f4236b commit f378556
Show file tree
Hide file tree
Showing 613 changed files with 17,699 additions and 6,984 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ jobs:
flyctl launch --no-deploy --copy-config --name "$APP_NAME" --image-label latest -o personal
popd
fi
flyctl deploy . --config ./apps/wing-console/console/app/preview/fly.toml --app "$APP_NAME" --image-label latest --vm-memory 512 --strategy immediate
flyctl deploy . --config ./apps/wing-console/console/app/preview/fly.toml --app "$APP_NAME" --image-label latest --vm-memory 1024 --strategy immediate
flyctl scale count 1 --yes --app "$APP_NAME"
echo "deploytime=$(TZ=UTC date +'%Y-%m-%d %H:%M')" >> $GITHUB_OUTPUT
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/periodic-azure-clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Periodic Azure cleanup

on:
schedule:
- cron: "0 0 * * 1" # Every Saturday at midnight UTC, I assume the main build won't be triggered right before this one
workflow_dispatch: {}

env:
MANUAL: ${{ github.event_name == 'workflow_dispatch' }}

jobs:
azure-cleanup:
runs-on: ubuntu-latest
steps:
- name: test if is maintainer
uses: tspascoal/get-user-teams-membership@v3
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: Configure azure credentials
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Remove all resources
run: |
for rg in $(az group list --query "[].name" -o tsv); do
az group delete --name $rg --yes --no-wait
done
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions apps/wing-console/console/app/demo/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class myBucket {
}

let myB = new myBucket() as "MyUIComponentBucket";

let putfucn = new cloud.Function(inflight () => {
myB.put("test", "Test");
}) as "PutFileInCustomBucket";
Expand Down Expand Up @@ -106,6 +107,7 @@ let table = new ex.Table(
let rateSchedule = new cloud.Schedule(cloud.ScheduleProps{
rate: 5m
}) as "Rate Schedule";
nodeof(rateSchedule).expanded = true;

rateSchedule.onTick(inflight () => {
log("Rate schedule ticked!");
Expand Down Expand Up @@ -165,10 +167,12 @@ test "Add fixtures" {
class WidgetService {
data: cloud.Bucket;
counter: cloud.Counter;
bucket: myBucket;

new() {
this.data = new cloud.Bucket();
this.counter = new cloud.Counter();
this.bucket = new myBucket() as "MyInternalBucket";

// a field displays a labeled value, with optional refreshing
new ui.Field(
Expand Down
10 changes: 8 additions & 2 deletions apps/wing-console/console/app/test/describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@ import { createConsoleApp } from "../dist/index.js";
* `describe(wingfile, callback)`. Any tests added in
* this callback will belong to the group.
*/
export const describe = (wingfile: string, callback: () => void) => {
export const describe = (
wingfile: string,
callback: () => void,
options?: {
requireSignIn?: boolean;
},
) => {
let server: { port: number; close: () => void } | undefined;

test.beforeEach(async ({ page }) => {
server = await createConsoleApp({
wingfile: path.resolve(__dirname, wingfile),
requireSignIn: false,
requireSignIn: options?.requireSignIn ?? false,
});

await page.goto(`http://localhost:${server.port}/`);
Expand Down
40 changes: 40 additions & 0 deletions apps/wing-console/console/app/test/login/login.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { expect, test } from "@playwright/test";

import { describe } from "../describe.js";

describe(
`${__dirname}/main.w`,
() => {
test("Sign in modal is visible when required", async ({ page }) => {
const signinModal = page.getByTestId("signin-modal");
await expect(signinModal).toBeVisible();
});
},
{ requireSignIn: true },
);

describe(
`${__dirname}/main.w`,
() => {
test("GitHub button is clickable", async ({ page }) => {
const githubLoginButton = page.getByTestId("signin-github-button");
await expect(githubLoginButton).toBeVisible();
await expect(githubLoginButton).toBeEnabled();
await githubLoginButton.click();
});
},
{ requireSignIn: true },
);

describe(
`${__dirname}/main.w`,
() => {
test("Google button is clickable", async ({ page }) => {
const googleSignInButton = page.getByTestId("signin-google-button");
await expect(googleSignInButton).toBeVisible();
await expect(googleSignInButton).toBeEnabled();
await googleSignInButton.click();
});
},
{ requireSignIn: true },
);
2 changes: 2 additions & 0 deletions apps/wing-console/console/app/test/login/main.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bring cloud;

Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ export const TreeItem = ({
});
const canBeExpanded = !!children;

useEffect(() => {
if (selected) {
ref.current?.scrollIntoView();
}
}, [selected, ref]);

return (
<li
ref={ref}
Expand Down
Loading

0 comments on commit f378556

Please sign in to comment.