Files
sweet/.github/workflows/ci.yml
T

98 lines
3.1 KiB
YAML

name: ci
on:
push:
branches: [main]
paths-ignore: [www/**]
pull_request:
branches: [main]
paths-ignore: [www/**]
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
# TODO(kt3k): Change this back to ["v1.x", "canary"]
# when denoland/deno#18572 is released.
# Note: v1.32.2 and v1.32.3 are not compatible with Fresh.
deno: ["v1.32.1", "canary"]
os: [macOS-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno }}
- name: Verify formatting
if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'v1.x'
run: deno fmt --check
- name: Run linter
if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'canary'
run: deno lint
- name: Cache dependencies
if: startsWith(matrix.os, 'ubuntu') && matrix.deno == 'v1.x'
run: deno cache --no-check --import-map=./www/import_map.json src/dev/deps.ts src/server/deps.ts www/main.ts
- name: Cache Chrome (Linux)
if: startsWith(matrix.os, 'ubuntu')
uses: actions/cache@v2
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@v2
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@v2
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 }}-
- name: Install Chromium (Unix)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'mac')
run: PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts
- name: Install Chromium (Windows)
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: Run tests
run: deno test -A
- name: Type check init script
run: deno check --remote init.ts
- name: Type check website
run: deno check main.ts dev.ts
working-directory: www/
- name: Type check examples/counter
run: deno check --remote main.ts dev.ts
working-directory: examples/counter
- name: Type check tests/fixture
run: deno check main.ts dev.ts
working-directory: tests/fixture/
- name: Type check tests/fixture_error
run: deno check main.ts dev.ts
working-directory: tests/fixture_error/