diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd1221c8..2bd78799 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,13 @@ jobs: matrix: deno: ["v1.x", "canary"] os: [macOS-latest, windows-latest, ubuntu-latest] + include: + - os: ubuntu-latest + cache_path: ~/.cache/deno/ + - os: macos-latest + cache_path: ~/Library/Caches/deno/ + - os: windows-latest + cache_path: ~\AppData\Local\deno\ steps: - name: Checkout repo @@ -36,36 +43,13 @@ jobs: if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'canary' uses: crate-ci/typos@master - - name: Type check project - run: deno task check:types - - - name: Cache dependencies - if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'v1.x' - run: deno cache --config=www/deno.json src/dev/deps.ts src/server/deps.ts www/main.ts - - - name: Cache Chrome (Linux) - if: startsWith(matrix.os, 'ubuntu') + - name: Cache dependencies and Chrome uses: actions/cache@v3 with: - path: ~/.cache/deno/deno_puppeteer - key: chrome-1022525-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }} - restore-keys: chrome-1022525-${{ runner.os }}- - - - name: Cache Chrome (macOS) - if: startsWith(matrix.os, 'mac') - uses: actions/cache@v3 - with: - path: ~/Library/Caches/deno/deno_puppeteer - key: chrome-1022525-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }} - restore-keys: chrome-1022525-${{ runner.os }}- - - - name: Cache Chrome (Windows) - if: startsWith(matrix.os, 'win') - uses: actions/cache@v3 - with: - path: "C:\\Users\\RUNNER~1\\AppData\\Local\\deno\\deno_puppeteer" - key: chrome-1022525-${{ runner.os }}-${{ hashFiles('tests/deps.ts') }} - restore-keys: chrome-1022525-${{ runner.os }}- + path: | + ${{ matrix.cache_path }}deps + ${{ matrix.cache_path }}deno_puppeteer + key: ${{ runner.os }}-${{ hashFiles('**/*deps.ts', 'tests/fixture_twind_hydrate/twind.config.ts') }} - name: Install Chromium (Unix) if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'mac') @@ -75,6 +59,9 @@ jobs: if: startsWith(matrix.os, 'windows') run: set "PUPPETEER_PRODUCT=chrome" && deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts + - name: Type check project + run: deno task check:types + - name: Run tests run: deno test -A @@ -87,4 +74,4 @@ jobs: - name: Type check demo run: deno check --remote main.ts dev.ts - working-directory: demo + working-directory: demo \ No newline at end of file diff --git a/plugins/twindv1.ts b/plugins/twindv1.ts index 33d89aa8..042d92c2 100644 --- a/plugins/twindv1.ts +++ b/plugins/twindv1.ts @@ -1,4 +1,4 @@ -import { stringify, virtual } from "https://esm.sh/@twind/core@1.1.3"; +import { stringify, virtual } from "./twindv1_deps.ts"; import { Plugin } from "../server.ts"; import { Options, setup, STYLE_ELEMENT_ID } from "./twindv1/shared.ts"; diff --git a/plugins/twindv1/main.ts b/plugins/twindv1/main.ts index 1d7f0e99..f6f871a6 100644 --- a/plugins/twindv1/main.ts +++ b/plugins/twindv1/main.ts @@ -1,9 +1,4 @@ -import { - cssom, - getSheet, - setup, - TwindConfig, -} from "https://esm.sh/@twind/core@1.1.3"; +import { cssom, getSheet, setup, TwindConfig } from "../twindv1_deps.ts"; import { STYLE_ELEMENT_ID } from "./shared.ts"; export default function hydrate(options: TwindConfig) { diff --git a/plugins/twindv1/shared.ts b/plugins/twindv1/shared.ts index 361b8844..39816353 100644 --- a/plugins/twindv1/shared.ts +++ b/plugins/twindv1/shared.ts @@ -1,10 +1,5 @@ import { JSX, options as preactOptions, VNode } from "preact"; -import { - setup as twSetup, - Sheet, - tw, - TwindConfig, -} from "https://esm.sh/@twind/core@1.1.3"; +import { setup as twSetup, Sheet, tw, TwindConfig } from "../twindv1_deps.ts"; type PreactOptions = typeof preactOptions & { __b?: (vnode: VNode) => void }; diff --git a/plugins/twindv1_deps.ts b/plugins/twindv1_deps.ts new file mode 100644 index 00000000..163f4d42 --- /dev/null +++ b/plugins/twindv1_deps.ts @@ -0,0 +1 @@ +export * from "https://esm.sh/@twind/core@1.1.3"; diff --git a/tests/cli_test.ts b/tests/cli_test.ts index 6f177d77..20ef25a1 100644 --- a/tests/cli_test.ts +++ b/tests/cli_test.ts @@ -1,12 +1,10 @@ import * as path from "$std/path/mod.ts"; -import { - assertMatch, - assertNotMatch, -} from "https://deno.land/std@0.193.0/testing/asserts.ts"; import { Status } from "../src/server/deps.ts"; import { assert, assertEquals, + assertMatch, + assertNotMatch, assertStringIncludes, delay, puppeteer, diff --git a/tests/deps.ts b/tests/deps.ts index f91a8fcd..daa5faec 100644 --- a/tests/deps.ts +++ b/tests/deps.ts @@ -7,6 +7,8 @@ export { assert, assertEquals, + assertMatch, + assertNotMatch, assertStringIncludes, } from "https://deno.land/std@0.193.0/testing/asserts.ts"; export { assertSnapshot } from "https://deno.land/std@0.193.0/testing/snapshot.ts"; @@ -25,3 +27,5 @@ export { HTMLElement, HTMLMetaElement, } from "https://esm.sh/linkedom@0.15.1"; +export { defineConfig, type Preset } from "https://esm.sh/@twind/core@1.1.3"; +export { default as presetTailwind } from "https://esm.sh/@twind/preset-tailwind@1.1.4"; diff --git a/tests/main_test.ts b/tests/main_test.ts index 0008091c..8804a7d6 100644 --- a/tests/main_test.ts +++ b/tests/main_test.ts @@ -2,6 +2,7 @@ import { ServerContext, Status } from "../server.ts"; import { assert, assertEquals, + assertMatch, assertStringIncludes, delay, puppeteer, @@ -16,7 +17,6 @@ import { waitForText, withPageName, } from "./test_utils.ts"; -import { assertMatch } from "https://deno.land/std@0.193.0/testing/asserts.ts"; const ctx = await ServerContext.fromManifest(manifest, options); const handler = ctx.handler(); diff --git a/tests/twind_test.ts b/tests/twind_test.ts index 63f87b6a..741ff8c4 100644 --- a/tests/twind_test.ts +++ b/tests/twind_test.ts @@ -1,5 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.190.0/testing/asserts.ts"; -import { assert, delay, puppeteer } from "./deps.ts"; +import { assert, assertEquals, delay, puppeteer } from "./deps.ts"; import { cmpStringArray } from "./fixture_twind_hydrate/utils/utils.ts"; import { startFreshServer, withPageName } from "./test_utils.ts";