Skip to content

Commit

Permalink
Fix docker compose usage in Github Actions (#490)
Browse files Browse the repository at this point in the history
* use docker compose

* fix lint issues with deno lint --fix

* remove obsolete version property from docker-compose.yml

* add casting to prevent docs fail

* add link to type issue

* add link to type issue
  • Loading branch information
bombillazo authored Sep 23, 2024
1 parent a2ee14e commit 21997a7
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ jobs:
uses: actions/checkout@master

- name: Build tests container
run: docker-compose build tests
run: docker compose build tests

- name: Run tests
run: docker-compose run tests
run: docker compose run tests

- name: Run tests without typechecking
id: no_typecheck
uses: mathiasvr/[email protected]
with:
run: docker-compose run no_check_tests
run: docker compose run no_check_tests
continue-on-error: true

- name: Report no typechecking tests status
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_jsr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
run: deno test --doc client.ts mod.ts pool.ts client/ connection/ query/ utils/

- name: Build tests container
run: docker-compose build tests
run: docker compose build tests

- name: Run tests
run: docker-compose run tests
run: docker compose run tests

- name: Publish (dry run)
if: startsWith(github.ref, 'refs/tags/') == false
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ result assertions.

To run the tests, run the following commands:

1. `docker-compose build tests`
2. `docker-compose run tests`
1. `docker compose build tests`
2. `docker compose run tests`

The build step will check linting and formatting as well and report it to the
command line
Expand Down
2 changes: 1 addition & 1 deletion client/error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Notice } from "../connection/message.ts";
import type { Notice } from "../connection/message.ts";

/**
* A connection error
Expand Down
8 changes: 5 additions & 3 deletions connection/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import {
type QueryResult,
ResultType,
} from "../query/query.ts";
import { type ClientConfiguration } from "./connection_params.ts";
import type { ClientConfiguration } from "./connection_params.ts";
import * as scram from "./scram.ts";
import {
ConnectionError,
Expand Down Expand Up @@ -295,7 +295,7 @@ export class Connection {
}

async #openTlsConnection(
connection: Deno.Conn,
connection: Deno.TcpConn,
options: { hostname: string; caCerts: string[] },
) {
this.#conn = await Deno.startTls(connection, options);
Expand Down Expand Up @@ -354,7 +354,9 @@ export class Connection {
// https://www.postgresql.org/docs/14/protocol-flow.html#id-1.10.5.7.11
if (accepts_tls) {
try {
await this.#openTlsConnection(this.#conn, {
// TODO: handle connection type without castinggaa
// https://github.com/denoland/deno/issues/10200
await this.#openTlsConnection(this.#conn as Deno.TcpConn, {
hostname,
caCerts: caCertificates,
});
Expand Down
6 changes: 3 additions & 3 deletions connection/connection_params.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { parseConnectionUri } from "../utils/utils.ts";
import { ConnectionParamsError } from "../client/error.ts";
import { fromFileUrl, isAbsolute } from "../deps.ts";
import { OidType } from "../query/oid.ts";
import { DebugControls } from "../debug.ts";
import { ParseArrayFunction } from "../query/array_parser.ts";
import type { OidType } from "../query/oid.ts";
import type { DebugControls } from "../debug.ts";
import type { ParseArrayFunction } from "../query/array_parser.ts";

/**
* The connection string must match the following URI structure. All parameters but database and user are optional
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

x-database-env:
&database-env
POSTGRES_DB: "postgres"
Expand Down
4 changes: 2 additions & 2 deletions query/decode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Oid, OidType, OidTypes, OidValue } from "./oid.ts";
import { Oid, type OidType, OidTypes, type OidValue } from "./oid.ts";
import { bold, yellow } from "../deps.ts";
import {
decodeBigint,
Expand Down Expand Up @@ -35,7 +35,7 @@ import {
decodeTid,
decodeTidArray,
} from "./decoders.ts";
import { ClientControls } from "../connection/connection_params.ts";
import type { ClientControls } from "../connection/connection_params.ts";
import { parseArray } from "./array_parser.ts";

export class Column {
Expand Down
4 changes: 2 additions & 2 deletions query/query.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { encodeArgument, type EncodedArg } from "./encode.ts";
import { type Column, decode } from "./decode.ts";
import { type Notice } from "../connection/message.ts";
import { type ClientControls } from "../connection/connection_params.ts";
import type { Notice } from "../connection/message.ts";
import type { ClientControls } from "../connection/connection_params.ts";

// TODO
// Limit the type of parameters that can be passed
Expand Down
2 changes: 1 addition & 1 deletion query/transaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type QueryClient } from "../client.ts";
import type { QueryClient } from "../client.ts";
import {
Query,
type QueryArguments,
Expand Down
4 changes: 2 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ From within the project directory, run:
deno test --allow-read --allow-net --allow-env

# run in docker container
docker-compose build --no-cache
docker-compose run tests
docker compose build --no-cache
docker compose run tests
```

## Docker Configuration
Expand Down
2 changes: 1 addition & 1 deletion tests/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
ClientConfiguration,
ClientOptions,
} from "../connection/connection_params.ts";
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Client } from "../client.ts";
import { Pool } from "../pool.ts";
import { type ClientOptions } from "../connection/connection_params.ts";
import type { ClientOptions } from "../connection/connection_params.ts";

export function generateSimpleClientTest(
client_options: ClientOptions,
Expand Down
4 changes: 2 additions & 2 deletions tests/query_client_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
assertThrows,
} from "./test_deps.ts";
import { getMainConfiguration } from "./config.ts";
import { PoolClient, QueryClient } from "../client.ts";
import { ClientOptions } from "../connection/connection_params.ts";
import type { PoolClient, QueryClient } from "../client.ts";
import type { ClientOptions } from "../connection/connection_params.ts";
import { Oid } from "../query/oid.ts";

function withClient(
Expand Down
2 changes: 1 addition & 1 deletion tests/utils_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertEquals, assertThrows } from "./test_deps.ts";
import { parseConnectionUri, Uri } from "../utils/utils.ts";
import { parseConnectionUri, type Uri } from "../utils/utils.ts";
import { DeferredAccessStack, DeferredStack } from "../utils/deferred.ts";

class LazilyInitializedObject {
Expand Down

1 comment on commit 21997a7

@github-actions
Copy link

Choose a reason for hiding this comment

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

No typecheck tests failure

This error was most likely caused by incorrect type stripping from the SWC crate

Please report the following failure to https://github.com/denoland/deno with a reproduction of the current commit

Failure log

Please sign in to comment.