Skip to content

Commit

Permalink
chore(repo): set up canary (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr authored Feb 9, 2024
1 parent f720491 commit 836ffe3
Show file tree
Hide file tree
Showing 3 changed files with 280 additions and 4 deletions.
215 changes: 215 additions & 0 deletions .github/workflows/canary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
name: Canary Workflow
on:
schedule:
- cron: 0 * * * *
jobs:
canary-bedrock:
name: Test bedrock
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: bedrock
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: bedrock
- name: Test
run: wing test
working-directory: bedrock
canary-checks:
name: Test checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: checks
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: checks
- name: Test
run: wing test
working-directory: checks
canary-containers:
name: Test containers
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: containers
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: containers
- name: Test
run: wing test
working-directory: containers
canary-fifoqueue:
name: Test fifoqueue
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: fifoqueue
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: fifoqueue
- name: Test
run: wing test
working-directory: fifoqueue
canary-github:
name: Test github
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: github
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: github
- name: Test
run: wing test
working-directory: github
canary-ngrok:
name: Test ngrok
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: ngrok
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: ngrok
- name: Test
run: wing test
working-directory: ngrok
canary-postgres:
name: Test postgres
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: postgres
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: postgres
- name: Test
run: wing test
working-directory: postgres
canary-redis:
name: Test redis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: redis
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: redis
- name: Test
run: wing test
working-directory: redis
canary-sagemaker:
name: Test sagemaker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: sagemaker
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: sagemaker
- name: Test
run: wing test
working-directory: sagemaker
canary-websockets:
name: Test websockets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: websockets
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
- name: Install dependencies
run: npm install --include=dev
working-directory: websockets
- name: Test
run: wing test
working-directory: websockets
58 changes: 58 additions & 0 deletions canary.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
bring fs;

pub class CanaryWorkflow {
new(workflowdir: str, libs: Array<str>) {
let testLibSteps = (lib: str): Array<Json> => {
return [
{
name: "Checkout",
uses: "actions/checkout@v3",
with: {
"sparse-checkout": lib
}
},
{
name: "Setup Node.js",
uses: "actions/setup-node@v3",
with: {
"node-version": "18.x",
"registry-url": "https://registry.npmjs.org",
},
},
{
name: "Install winglang",
run: "npm i -g winglang",
},
{
name: "Install dependencies",
run: "npm install --include=dev",
"working-directory": lib,
},
{
name: "Test",
run: "wing test",
"working-directory": lib,
},
];
};

let jobs = MutJson {};
for lib in libs {
jobs.set("canary-{lib}", {
name: "Test {lib}",
"runs-on": "ubuntu-latest",
steps: testLibSteps(lib),
});
}

fs.writeYaml("{workflowdir}/canary.yaml", {
name: "Canary Workflow",
on: {
schedule: [{
cron: "0 * * * *"
}],
},
jobs: Json.deepCopy(jobs),
});
}
}
11 changes: 7 additions & 4 deletions generate-workflows.main.w
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
bring fs;
bring "./canary.w" as canary;
bring "./library.w" as l;
bring "./stale.w" as stale;
bring "./mergify.w" as mergify;
bring "./pr-lint.w" as prlint;
bring "./stale.w" as stale;

// clean up
let workflowdir = ".github/workflows";
fs.remove(".github/workflows");
fs.mkdir(".github/workflows");

// clean up
fs.remove(workflowdir);
fs.mkdir(workflowdir);

let libs = MutArray<str>[];

Expand All @@ -24,3 +26,4 @@ for file in fs.readdir(".") {
new stale.StaleWorkflow(workflowdir);
new mergify.MergifyWorkflow(libs.copy());
new prlint.PullRequestLintWorkflow(workflowdir);
new canary.CanaryWorkflow(workflowdir, libs.copy());

0 comments on commit 836ffe3

Please sign in to comment.