Skip to content

Commit

Permalink
ci: Better dependency management, run tests against high and low vers…
Browse files Browse the repository at this point in the history
…ion of deno (#79)

* Move script-only dependencies into their own deps file under the scripts/src directory. Comment at the top of deps.ts and dev_deps.ts to guide what version of deno std we should use.

run tests against most recent stable deno as well as minimum deno version used internally

Move import map helper scripts (for use with sample app integration testing) under scripts/src, add comments to scripts/deps.ts to explain stdlib versioning strategy.

Run both CI workflows against most recent stable deno as well as version of deno used by Run on Slack.

Name deno CI workflow more specifically

Set min deno version to 1.31.1 (version Run on Slack uses), set deno stdlib version to 0.178.0 (recommended for deno v1.31.1), update tests as a result of assertion method changes in 0.178.0.

* Ensure exception is thrown in a couple of API tests.

* Added comments and minor tweaks that arose from review.

* fixes

* bump deno version for samples integration

* axe doubled up code
  • Loading branch information
Fil Maj authored Aug 27, 2024
1 parent 0a7a819 commit 3d2507e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deno
name: Deno Format, Lint and Unit Tests

on:
push:
Expand All @@ -9,13 +9,18 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# we test on both most recent stable version of deno (v1.x) as well as
# the version of deno used by Run on Slack (as noted in https://api.slack.com/slackcli/metadata.json)
deno-version: [v1.x, v1.45.4]
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: ${{ matrix.deno-version }}
- name: Run formatter, linter and tests
run: deno task test
- name: Generate CodeCov-friendly coverage report
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ jobs:
- slack-samples/deno-message-translator
- slack-samples/deno-request-time-off
- slack-samples/deno-simple-survey
# we test on both most recent stable version of deno (v1.x) as well as
# the version of deno used by Run on Slack (as noted in https://api.slack.com/slackcli/metadata.json)
deno-version: [v1.x, v1.45.4]

steps:
- name: Setup Deno
- name: Setup Deno ${{ matrix.deno-version }}
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: ${{ matrix.deno-version }}

- name: Checkout the api
uses: actions/checkout@v4
Expand All @@ -37,10 +40,10 @@ jobs:
path: ./sample

- name: Set imports.deno-slack-api/ to ../deno-slack-api/src/ in import_map.json
run: >
run: >
deno run
--allow-read --allow-write --allow-net
deno-slack-api/scripts/import_map/update.ts
deno-slack-api/scripts/src/import_map/update.ts
--import-map "./sample/import_map.json"
--parent-import-map "./deno-slack-api/deno.jsonc"
--api "../deno-slack-api/src/"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isHttpError } from "@std/http/http-errors";
import { mf } from "../../src/dev_deps.ts";
import { mf } from "../../../src/dev_deps.ts";
import { assertEquals, assertRejects } from "@std/assert";
import { afterEach, beforeAll } from "@std/testing/bdd";
import { apiDepsIn } from "./update.ts";
Expand Down
6 changes: 2 additions & 4 deletions src/typed-method-types/workflows/triggers/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@ type InputSchema<Params extends InputParameterSchema> = Params extends
type WorkflowInputsType<Params extends InputParameterSchema> =
// This intentionally avoids Distributive Conditional Types, so be careful removing any of the following square brackets
// See https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types for more details
[keyof Params["properties"]] extends [string]
// Since never extends string, must check for no properties
[keyof Params["properties"]] extends [string] // Since never extends string, must check for no properties
? [keyof Params["properties"]] extends [never] ? EmptyInputs
: Params["required"] extends Array<infer T> ? [T] extends [never]
// If there are no required properties, inputs are optional
: Params["required"] extends Array<infer T> ? [T] extends [never] // If there are no required properties, inputs are optional
? PopulatedInputs<Params>
// If there are required params, inputs are required
: Required<PopulatedInputs<Params>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ Deno.test("Mock call for webhook", async (t) => {
);
}
mf.reset();

mf.reset();
},
);
});
Expand Down

0 comments on commit 3d2507e

Please sign in to comment.