Skip to content

Commit

Permalink
chore: setup workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed Jul 28, 2024
1 parent b34e85d commit 76826b5
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 26 deletions.
86 changes: 73 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,79 @@ on:
permissions:
contents: read

defaults:
run:
shell: bash

jobs:
test:
name: Test
uses: hasundue/actions/.github/workflows/test-deno.yml@main
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
task: test:unit
submodules: true

integration:
name: Integration
uses: hasundue/actions/.github/workflows/integration-deno.yml@main
with:
task: test:integration
submodules: true

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Setup Deno
uses: denoland/setup-deno@v1

- name: Setup actions/cache for Deno
uses: actions/cache@v4
with:
path: |
~/.cache/deno
~/Library/Caches/deno
~/AppData/Local/deno
key: ${{ matrix.os }}-deno-${{ hashFiles('./deno.lock') }}
restore-keys: ${{ matrix.os }}-deno

- name: Setup actions/cache for Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo
./core/deno_lockfile/target
key: ${{ matrix.os }}-cargo-${{ hashFiles('./**/Cargo.lock') }}
restore-keys: ${{ matrix.os }}-cargo

- name: Build core/deno_lockfile
run: |
cd core/deno_lockfile
deno task build
- name: Check format
if: matrix.os == 'ubuntu-latest'
run: deno fmt --check

- name: Cache dependencies
run: deno task cache

- name: Check lint
if: matrix.os == 'ubuntu-latest'
run: deno lint

- name: Run tests
run: deno test -A --unstable-kv --parallel --shuffle --coverage=./coverage_profile
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Create coverage report
run: deno coverage ./coverage_profile --lcov --output=./coverage.lcov

- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
directory: ./
file: ./coverage.lcov
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion core/bumps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { increase } from "@molt/lib/constraints";
import { DependencyState, DependencyUpdate } from "./updates.ts";
import type { DependencyState, DependencyUpdate } from "./updates.ts";
import * as SemVer from "@std/semver";

export interface DependencyBump {
Expand Down
2 changes: 1 addition & 1 deletion core/deno_lockfile
Submodule deno_lockfile updated 1 files
+1 −1 deno.json
2 changes: 1 addition & 1 deletion core/locks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
type NpmPackageInfo,
} from "./deno_lockfile/js/mod.ts";
import {
DependencySpec,
type DependencySpec,
identify,
isDependencySpec,
isRemote,
Expand Down
2 changes: 1 addition & 1 deletion core/locks_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from "@chiezo/amber/fs";
import { assertEquals } from "@std/assert";
import { afterEach, beforeEach, describe, it } from "@std/testing/bdd";
import { parse } from "./specs.ts";
import { create, extract, LockfileJson, query } from "./locks.ts";
import { create, extract, type LockfileJson, query } from "./locks.ts";

export const LOCKFILE: LockfileJson = JSON.parse(`{
"version": "3",
Expand Down
2 changes: 1 addition & 1 deletion core/specs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from "@std/assert";
import { is, Predicate } from "@core/unknownutil";
import { is, type Predicate } from "@core/unknownutil";

export type DependencyKind = "jsr" | "npm" | "http" | "https";

Expand Down
2 changes: 1 addition & 1 deletion core/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DependencyKind } from "./specs.ts";
import type { DependencyKind } from "./specs.ts";

export type { DependencyBump } from "./bumps.ts";
export type { LockfileJson } from "./locks.ts";
Expand Down
2 changes: 1 addition & 1 deletion core/updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ensure, is } from "@core/unknownutil";
import { filterValues, mapNotNullish, maxWith } from "@std/collections";
import * as SemVer from "@std/semver";
import {
DependencyKind,
type DependencyKind,
type DependencySpec,
stringify,
tryParse,
Expand Down
5 changes: 1 addition & 4 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
"pre-commit": "deno fmt && deno lint && deno task -q check && deno task -q test:unit",
"run": "deno run -A --env --unstable-kv ./cli/main.ts",
"test": "deno test -A --unstable-kv --no-check",
"test:integration": "deno task test ./integration ./cli",
"test:unit": "deno task test ./lib ./core",
"update": "deno task -q run",
"update:commit": "deno task -q update --commit --prefix 'chore:' --pre-commit=check,test:unit"
"update:commit": "deno task -q run --commit --prefix 'chore:' --pre-commit=check,test:unit"
},
"imports": {
"@chiezo/amber": "jsr:@chiezo/amber@^0.0.8",
Expand Down
2 changes: 1 addition & 1 deletion integration/packages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { match, placeholder as _ } from "@core/match";
import type { DependencySpec } from "@molt/core/types";
import type { DependencySpec } from "@molt/core/specs";
import * as Spec from "@molt/core/specs";
import type { Repository } from "./repository.ts";
import * as github from "./github.ts";
Expand Down
2 changes: 1 addition & 1 deletion integration/registries_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parse, tryParse } from "@molt/core/specs";
import { tryParse } from "@molt/core/specs";
import { get as getUpdate } from "@molt/core/updates";
import { assertEquals, assertFalse } from "@std/assert";

Expand Down

0 comments on commit 76826b5

Please sign in to comment.