Skip to content

Commit

Permalink
Merge branch 'main' into gary/gcp-schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
garysassano committed Mar 16, 2024
2 parents 99d9e0a + d9beaf1 commit 4545e9f
Show file tree
Hide file tree
Showing 341 changed files with 9,772 additions and 5,995 deletions.
57 changes: 30 additions & 27 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: download-artifacts
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
name: .+\.diff$
name_is_regexp: true
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: marocchino/action-workflow_run-status@54b6e87d6cb552fc5f36dbe9a722a6048725917a
if: steps.download-artifacts.outputs.found_artifact == 'true'
with:
github_token: ${{secrets.GITHUB_TOKEN}}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Token check
if: steps.download-artifacts.outputs.found_artifact == 'true'
Expand All @@ -50,11 +50,33 @@ jobs:
It requires private repo read/write permissions." >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Find associated pull request
id: pr
uses: actions/github-script@v7
with:
script: |
const mainRepo = context.payload.workflow_run.repository.full_name;
const headBranch = context.payload.workflow_run.head_branch;
console.log(`Searching for pull request in ${mainRepo} with head branch ${headBranch}`);
const response = await github.rest.search.issuesAndPullRequests({
q: `repo:${mainRepo} is:pr is:open head:${headBranch}`,
per_page: 1,
});
const prs = response.data.items;
if (prs.length < 1) {
throw new Error('No pull request found for the commit');
}
const prNumber = prs[0].number;
console.log(`Pull request number is ${prNumber}`);
return prNumber;
- name: Unstable mutation comment
if: steps.download-artifacts.outputs.found_artifact == 'true' && startsWith(github.event.workflow_run.head_commit.message, format('chore{0} self mutation', ':'))
uses: thollander/actions-comment-pull-request@v2
with:
pr_number: ${{ steps.pr.outputs.result }}
mode: recreate
message: |
### :x: Unstable Self-Mutation :x:
Expand All @@ -74,8 +96,7 @@ jobs:

- name: Disable Git Hooks
if: steps.download-artifacts.outputs.found_artifact == 'true'
run: |
git config --global core.hooksPath /dev/null
run: git config --global core.hooksPath /dev/null

- name: Update PR Branch
uses: actions/github-script@v7
Expand All @@ -84,27 +105,13 @@ jobs:
with:
github-token: ${{ secrets.MUTATION_TOKEN }}
script: |
// use API to get the PR data since we can't rely on the context across forks
let head = context.payload.workflow_run.head_branch;
if (`${context.repo.owner}/${context.repo.repo}` !== context.payload.workflow_run.head_repository.full_name) {
if (context.payload.workflow_run.head_repository.name === context.repo.repo) {
// head is in the short form since the repo name is the same
head = `${context.payload.workflow_run.head_repository.owner.login}:${head}`;
} else {
head = `${context.payload.workflow_run.head_repository.full_name}:${head}`;
}
}
const pulls = await github.rest.pulls.list({
per_page: 1,
const prContextData = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
head,
pull_number: ${{ steps.pr.outputs.result }}
});
const prContextData = pulls.data[0];
const prNumber = prContextData.number;
const originalSha = prContextData.head.sha;
const prNumber = prContextData.data.number;
const originalSha = prContextData.data.head.sha;
try {
console.log("Updating PR branch");
Expand Down Expand Up @@ -135,8 +142,6 @@ jobs:
console.warn(error);
}
return prNumber;
- name: Checkout Workflow Branch
if: steps.download-artifacts.outputs.found_artifact == 'true'
uses: actions/checkout@v4
Expand Down Expand Up @@ -179,11 +184,9 @@ jobs:
with:
github-token: ${{ secrets.MUTATION_TOKEN }}
script: |
const prNumber = ${{ steps.branch-update.outputs.result }};
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
issue_number: ${{ steps.pr.outputs.result }},
labels: ["⚠️ pr/review-mutation"]
});
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

[![Register](https://github.com/winglang/wing/assets/66887028/5647156b-3823-4ae3-939c-6e7d4405cc60)](https://wingla.ng/wing-cloud-early-access)



<div align="center">
Expand Down
2 changes: 1 addition & 1 deletion apps/wing-console/console/app/test/cloud.api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const runApiTest = async (
route: string,
response: string,
) => {
await getResourceNode(page, "root/Default/cloud.Api").click();
await getResourceNode(page, "root/Default/Api").click();

await page.getByTestId("cloud.api:method-toggle").click();
await page.getByTestId(`cloud.api:method-entry-${method}`).click();
Expand Down
4 changes: 2 additions & 2 deletions apps/wing-console/console/app/test/cloud.bucket/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("opens file preview", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Bucket").click();
await getResourceNode(page, "root/Default/Bucket").click();

await page.getByTestId("cloud.bucket:files-entry-test.txt").click();

Expand All @@ -15,7 +15,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("deletes a file", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Bucket").click();
await getResourceNode(page, "root/Default/Bucket").click();

const file = page.getByTestId("cloud.bucket:files-entry-test.txt");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("increase counter", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Counter").click();
await getResourceNode(page, "root/Default/Counter").click();

const currentValue = page.getByTestId("cloud.counter:current-value");

Expand All @@ -17,7 +17,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("decreases counter", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Counter").click();
await getResourceNode(page, "root/Default/Counter").click();

const currentValue = page.getByTestId("cloud.counter:current-value");

Expand All @@ -29,7 +29,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("resets counter", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Counter").click();
await getResourceNode(page, "root/Default/Counter").click();

const currentValue = page.getByTestId("cloud.counter:current-value");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { describe } from "../describe.js";
import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test("executes function and shows response", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Function").click();
test.skip("executes function and shows response", async ({ page }) => {
await getResourceNode(page, "root/Default/Function").click();

await page.getByTestId("cloud.function:invoke").click();

Expand Down
4 changes: 2 additions & 2 deletions apps/wing-console/console/app/test/cloud.queue/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("pushes message", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Queue").click();
await getResourceNode(page, "root/Default/Queue").click();

await page.getByTestId("cloud.queue:message").fill("Hello world!");

Expand All @@ -17,7 +17,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("purges message", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Queue").click();
await getResourceNode(page, "root/Default/Queue").click();

await page.getByTestId("cloud.queue:message").fill("Hello world!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("publishes message", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Topic").click();
await getResourceNode(page, "root/Default/Topic").click();

await page.getByTestId("cloud.topic:message").fill("Hello world!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("open website", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Website").click();
await getResourceNode(page, "root/Default/Website").click();

// not working when app mode is not "local"
// const url = await page.getByTestId("cloud.website:url").inputValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const addRow = async (page: Page, data?: Record<string, any>) => {

describe(`${__dirname}/main.w`, () => {
test.skip("adds new item", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.DynamodbTable").click();
await getResourceNode(page, "root/Default/DynamodbTable").click();

await addRow(page, { id: "1", key1: "value1", key2: "value2" });
});

test.skip("removes row", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.DynamodbTable").click();
await getResourceNode(page, "root/Default/DynamodbTable").click();

await addRow(page, { id: "1", key1: "value1", key2: "value2" });

Expand Down
4 changes: 2 additions & 2 deletions apps/wing-console/console/app/test/ex.redis/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("opens redis help", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Redis").click();
await getResourceNode(page, "root/Default/Redis").click();

const input = page.getByTestId("ex.redis:input");

Expand All @@ -40,7 +40,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("navigates history", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Redis").click();
await getResourceNode(page, "root/Default/Redis").click();

const input = page.getByTestId("ex.redis:input");

Expand Down
6 changes: 3 additions & 3 deletions apps/wing-console/console/app/test/ex.table/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ const addRow = async (

describe(`${__dirname}/main.w`, () => {
test.skip("adds new row", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Table").click();
await getResourceNode(page, "root/Default/Table").click();

await addRow(page, "Hello World!");
});

test.skip("edits row", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Table").click();
await getResourceNode(page, "root/Default/Table").click();

const rowId = "Hello World!";

Expand All @@ -55,7 +55,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("removes row", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Table").click();
await getResourceNode(page, "root/Default/Table").click();

const rowId = "Hello World!";

Expand Down
10 changes: 10 additions & 0 deletions apps/wing-console/console/app/test/health/health.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { expect, test } from "@playwright/test";

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

describe(`${__dirname}/main.w`, () => {
test("Health check", async ({ page }) => {
const appState = page.getByTestId("app-state");
await expect(appState).toContainText("success");
});
});
2 changes: 2 additions & 0 deletions apps/wing-console/console/app/test/health/main.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bring cloud;

3 changes: 3 additions & 0 deletions apps/wing-console/console/design-system/src/attribute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface AttributeProps {
noLeftPadding?: boolean;
centerLabel?: boolean;
dataTestId?: string;
className?: string;
}

export const Attribute = ({
Expand All @@ -24,6 +25,7 @@ export const Attribute = ({
noLeftPadding = false,
centerLabel = true,
dataTestId,
className,
}: PropsWithChildren<AttributeProps>) => {
const { theme } = useTheme();
const id = useId();
Expand All @@ -33,6 +35,7 @@ export const Attribute = ({
"flex flex-row",
!noLeftPadding && "pl-4",
centerLabel && "items-center",
className,
)}
>
<label htmlFor={id} className={classNames(theme.text2, "min-w-[100px]")}>
Expand Down
12 changes: 12 additions & 0 deletions apps/wing-console/console/design-system/src/utils/colors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export type Colors =
| "orange"
| "sky"
| "emerald"
| "lime"
| "pink"
| "amber"
| "cyan"
| "purple"
| "red"
| "violet"
| "slate";
Loading

0 comments on commit 4545e9f

Please sign in to comment.