Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

☕ Update CI/CD workflows #14

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: jsr

env:
DENO_VERSION: 1.x

on:
push:
tags:
- "v*"

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Publish
run: |
deno run -A jsr:@david/[email protected]
22 changes: 15 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ on:
branches:
- main
pull_request:
paths:
- "**.md"
- "**.ts"
- ".github/workflows/test.yml"
- "Makefile"
workflow_dispatch:

defaults:
run:
Expand Down Expand Up @@ -90,7 +86,7 @@ jobs:
env:
DENOPS_TEST_NVIM: ${{ steps.nvim.outputs.executable }}
- name: Test
run: deno task test
run: deno task test:coverage
env:
DENOPS_TEST_DENOPS_PATH: "../denops.vim"
DENOPS_TEST_VIM_EXECUTABLE: ${{ steps.vim.outputs.executable }}
Expand All @@ -99,7 +95,19 @@ jobs:
- run: |
deno coverage --unstable .coverage --lcov > coverage.lcov
working-directory: ./repo
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
os: ${{ runner.os }}
files: ./coverage.lcov
token: ${{ secrets.CODECOV_TOKEN }}

jsr-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Publish (dry-run)
run: |
deno publish --dry-run
3 changes: 1 addition & 2 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ jobs:
path: ../body.md
- name: Create a pull request
if: steps.result.outputs.files_exists == 'true'
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PA_TOKEN }}
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
branch: automation/update-dependencies
title: ${{ steps.title.outputs.content }}
Expand Down
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# 📝 denops_test

[![Test](https://github.com/vim-denops/deno-denops-test/actions/workflows/test.yml/badge.svg)](https://github.com/vim-denops/deno-denops-test/actions/workflows/test.yml)
[![jsr](https://jsr.io/badges/@denops/test)](https://jsr.io/@denops/test)
[![denoland](https://img.shields.io/github/v/release/vim-denops/deno-denops-test?logo=deno&label=denoland)](https://deno.land/x/denops_test)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_test/mod.ts)
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x/denops__test-lightgrey.svg?logo=deno)](https://deno.land/x/denops_test)
[![test](https://github.com/vim-denops/deno-denops-test/actions/workflows/test.yml/badge.svg)](https://github.com/vim-denops/deno-denops-test/actions/workflows/test.yml)
[![codecov](https://codecov.io/github/vim-denops/deno-denops-test/branch/main/graph/badge.svg?token=X9O5XB4O1S)](https://codecov.io/github/vim-denops/deno-denops-test)

A [Deno] module designed for testing [denops.vim]. This module is intended to be
Expand All @@ -29,12 +30,8 @@ If you want to test denops plugins with a real Vim and/or Neovim process, use
the `test` function to define a test case, as shown below:

```typescript
import {
assert,
assertEquals,
assertFalse,
} from "https://deno.land/[email protected]/assert/mod.ts";
import { test } from "https://deno.land/x/denops_test@$MODULE_VERSION/mod.ts";
import { assert, assertEquals, assertFalse } from "jsr:@std/assert";
import { test } from "jsr:@denops/test";

test(
"vim",
Expand Down Expand Up @@ -74,8 +71,8 @@ the `DenopsStub` class to create a stub instance of the `Denops` interface, as
shown below:

```typescript
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
import { DenopsStub } from "https://deno.land/x/denops_test@$MODULE_VERSION/mod.ts";
import { assertEquals } from "jsr:@std/assert";
import { DenopsStub } from "jsr:@denops/test";

Deno.test("denops.call", async () => {
const denops = new DenopsStub({
Expand Down
2 changes: 1 addition & 1 deletion conf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve } from "https://deno.land/std@0.210.0/path/mod.ts";
import { resolve } from "jsr:@std/path@^0.210.0";

let conf: Config | undefined;

Expand Down
11 changes: 7 additions & 4 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"lock": false,
"name": "@denops/test",
"version": "0.0.0",
"exports": "./mod.ts",
"imports": {
"https://deno.land/x/denops_test@$MODULE_VERSION/": "./"
"jsr:@denops/test": "./mod.ts"
},
"tasks": {
"test": "deno test -A --doc --parallel --shuffle --coverage=.coverage",
"check": "deno check $(find . -name '*.ts')",
"check": "deno check **/*.ts",
"test": "deno test -A --doc --parallel --shuffle",
"test:coverage": "deno task test --coverage=.coverage",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The verification process has revealed that the .coverage directory does not exist. This could indicate a potential issue with the setup of the test:coverage task in the deno.jsonc file, as the directory is expected to be present or automatically created when running the coverage tests. It is recommended to ensure that the directory is either pre-created or the task command is adjusted to handle the creation of the directory if it does not exist.

Analysis chain

Validate the new test:coverage task setup for correct coverage directory specification.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Ensure the coverage directory is correctly specified and accessible
test -d .coverage || echo "Coverage directory .coverage does not exist"

Length of output: 116

"coverage": "deno coverage .coverage",
"upgrade": "deno run -q -A https://deno.land/x/[email protected]/cli.ts ./**/*.ts",
"upgrade:commit": "deno task -q upgrade --commit --prefix :package: --pre-commit=fmt"
Expand Down
4 changes: 2 additions & 2 deletions denops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {
Denops,
Dispatcher,
Meta,
} from "https://deno.land/x/denops_core@v6.0.2/mod.ts";
import { Client } from "https://deno.land/x/[email protected]/mod.ts";
} from "jsr:@denops/core@^6.0.6";
import type { Client } from "jsr:@lambdalisue/messagepack-rpc@^2.1.1";

export class DenopsImpl implements Denops {
readonly name: string;
Expand Down
4 changes: 2 additions & 2 deletions error.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { is } from "https://deno.land/x/unknownutil@v3.11.0/mod.ts";
import { is } from "jsr:@core/unknownutil@^3.17.3";
import {
fromErrorObject,
isErrorObject,
toErrorObject,
tryOr,
} from "https://deno.land/x/errorutil@v0.1.1/mod.ts";
} from "jsr:@lambdalisue/errorutil@^1.0.0";

export function errorSerializer(err: unknown): unknown {
if (err instanceof Error) {
Expand Down
8 changes: 4 additions & 4 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
* assert,
* assertEquals,
* assertFalse,
* } from "https://deno.land/[email protected]/assert/mod.ts";
* import { test } from "https://deno.land/x/denops_test@$MODULE_VERSION/mod.ts";
* } from "jsr:@std/assert";
* import { test } from "jsr:@denops/test";
Comment on lines +30 to +31
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The attempt to verify the compatibility and functionality of the new module versions by accessing their documentation pages resulted in a "Page Not Found" error for both URLs. This indicates that the documentation for these modules is either not available at the specified URLs or there might be an issue with the URL structure itself.

Given this outcome, it's clear that we cannot confirm whether the updated import paths in the mod.ts file are pointing to valid and functional modules. This raises concerns about the reliability of these imports in the codebase.

Since the URLs provided did not lead to valid documentation pages, and no alternative URLs or methods to verify the module compatibility were provided, we are unable to conclusively verify the functionality and compatibility of the new module versions based on the current information.

Therefore, the appropriate course of action is to flag this issue and recommend manual verification or further investigation to ensure that the modules are correctly integrated and functional.

Analysis chain

Updated import paths to use the jsr: scheme for assertion and testing modules. Verify that the new module versions are compatible and provide all necessary functionality.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the new module versions are compatible and provide all necessary functionality
curl https://jsr.dev/std/assert/docs
curl https://jsr.dev/denops/test/docs

Length of output: 6955

*
* test(
* "vim",
Expand Down Expand Up @@ -68,8 +68,8 @@
* shown below:
*
* ```typescript
* import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
* import { DenopsStub } from "https://deno.land/x/denops_test@$MODULE_VERSION/mod.ts";
* import { assertEquals } from "jsr:@std/assert";
* import { DenopsStub } from "jsr:@denops/test";
*
* Deno.test("denops.call", async () => {
* const denops = new DenopsStub({
Expand Down
13 changes: 3 additions & 10 deletions plugin.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import type { Denops } from "https://deno.land/x/[email protected]/mod.ts";
import {
assert,
ensure,
is,
} from "https://deno.land/x/[email protected]/mod.ts";
import {
Client,
Session,
} from "https://deno.land/x/[email protected]/mod.ts";
import type { Denops } from "jsr:@denops/core@^6.0.6";
import { assert, ensure, is } from "jsr:@core/[email protected]";
import { Client, Session } from "jsr:@lambdalisue/messagepack-rpc@^2.1.1";
import { errorDeserializer, errorSerializer } from "./error.ts";

export async function main(denops: Denops): Promise<void> {
Expand Down
6 changes: 3 additions & 3 deletions runner.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { is } from "https://deno.land/x/unknownutil@v3.11.0/mod.ts";
import { unreachable } from "https://deno.land/x/errorutil@v0.1.1/mod.ts";
import { Config, getConfig } from "./conf.ts";
import { is } from "jsr:@core/unknownutil@^3.17.3";
import { unreachable } from "jsr:@lambdalisue/errorutil@^1.0.0";
import { type Config, getConfig } from "./conf.ts";

/**
* Represents the mode in which the runner operates.
Expand Down
4 changes: 2 additions & 2 deletions stub.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
import type {
Context,
Denops,
Dispatcher,
Meta,
} from "https://deno.land/x/denops_core@v6.0.2/mod.ts";
} from "jsr:@denops/core@^6.0.6";

/**
* Represents a stubber object for `Denops`.
Expand Down
9 changes: 3 additions & 6 deletions stub_test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import {
assertSpyCall,
spy,
} from "https://deno.land/[email protected]/testing/mock.ts";
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
import { Denops } from "https://deno.land/x/[email protected]/mod.ts";
import { assertSpyCall, spy } from "jsr:@std/testing@^0.222.1/mock";
import { assertEquals } from "jsr:@std/assert@^0.222.1";
import type { Denops } from "jsr:@denops/core@^6.0.6";
import { DenopsStub } from "./stub.ts";

Deno.test("`DenopsStub`", async (t) => {
Expand Down
12 changes: 6 additions & 6 deletions tester.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sample } from "https://deno.land/std@0.210.0/collections/sample.ts";
import type { Denops } from "https://deno.land/x/denops_core@v6.0.2/mod.ts";
import { sample } from "jsr:@std/collections@^0.222.1";
import type { Denops } from "jsr:@denops/core@^6.0.6";
import type { RunMode } from "./runner.ts";
import { withDenops } from "./with.ts";

Expand Down Expand Up @@ -45,8 +45,8 @@ export interface TestDefinition extends Omit<Deno.TestDefinition, "fn"> {
* tests by passing a `denops` instance to the registered test function.
*
* ```ts
* import { assert, assertFalse } from "https://deno.land/[email protected]/assert/mod.ts";
* import { test } from "https://deno.land/x/denops_test@$MODULE_VERSION/mod.ts";
* import { assert, assertFalse } from "jsr:@std/assert";
* import { test } from "jsr:@denops/test";
*
* test("vim", "Test with Vim", async (denops) => {
* assertFalse(await denops.call("has", "nvim"));
Expand Down Expand Up @@ -74,8 +74,8 @@ export function test(
* tests by passing a `denops` instance to the registered test function.
*
* ```ts
* import { assert, assertFalse } from "https://deno.land/[email protected]/assert/mod.ts";
* import { test } from "https://deno.land/x/denops_test@$MODULE_VERSION/mod.ts";
* import { assert, assertFalse } from "jsr:@std/assert";
* import { test } from "jsr:@denops/test";
*
* test({
* mode: "nvim",
Expand Down
6 changes: 1 addition & 5 deletions tester_test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
assert,
assertEquals,
assertFalse,
} from "https://deno.land/[email protected]/assert/mod.ts";
import { assert, assertEquals, assertFalse } from "jsr:@std/assert@^0.222.1";
import { test } from "./tester.ts";

test({
Expand Down
20 changes: 7 additions & 13 deletions with.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { deadline } from "https://deno.land/[email protected]/async/mod.ts";
import { assert, is } from "https://deno.land/x/[email protected]/mod.ts";
import {
Client,
Session,
} from "https://deno.land/x/[email protected]/mod.ts";
import type {
Denops,
Meta,
} from "https://deno.land/x/[email protected]/mod.ts";
import { deadline } from "jsr:@std/async@^0.222.1";
import { assert, is } from "jsr:@core/unknownutil@^3.17.3";
import { Client, Session } from "jsr:@lambdalisue/messagepack-rpc@^2.1.1";
import type { Denops, Meta } from "jsr:@denops/core@^6.0.6";
import { getConfig } from "./conf.ts";
import { run, RunMode } from "./runner.ts";
import { run, type RunMode } from "./runner.ts";
import { DenopsImpl } from "./denops.ts";
import { errorDeserializer, errorSerializer } from "./error.ts";

Expand Down Expand Up @@ -44,8 +38,8 @@ export interface WithDenopsOptions {
* internally spawns a Vim/Neovim sub-process, which performs the tests.
*
* ```ts
* import { assert, assertFalse } from "https://deno.land/[email protected]/assert/mod.ts";
* import { withDenops } from "https://deno.land/x/denops_test@$MODULE_VERSION/mod.ts";
* import { assert, assertFalse } from "jsr:@std/assert";
* import { withDenops } from "jsr:@denops/test";
*
* Deno.test("Test Denops (Vim)", async () => {
* await withDenops("vim", async (denops) => {
Expand Down
5 changes: 1 addition & 4 deletions with_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
assert,
assertFalse,
} from "https://deno.land/[email protected]/assert/mod.ts";
import { assert, assertFalse } from "jsr:@std/assert@^0.222.1";
import { withDenops } from "./with.ts";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The attempt to verify the availability of assertion functions in the specified module version jsr:@std/assert@^0.222.1 resulted in a "Page Not Found" error. This suggests that the URL or the resource does not exist, which raises concerns about the validity of the module version or the correctness of the URL used in the import statement. Further investigation or correction might be necessary to ensure the module and its functions are correctly referenced and accessible.

Analysis chain

Updated import path for assertions to use the jsr: scheme. Confirm that the new module version provides all necessary assertion functions.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the new module version includes all necessary assertion functions
curl https://jsr.dev/std/[email protected]/docs

Length of output: 3445


Deno.test(
Expand Down
Loading