@tahminator/pipeline 1.0.104 → 1.0.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/postgres/client.d.ts +2 -0
- package/dist/postgres/client.js +14 -1
- package/dist/postgres/types.d.ts +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -552,6 +552,15 @@ With `INSTALL_PNPM: "true"`, set `PNPM_CACHE: "true"` to cache the pnpm store. `
|
|
|
552
552
|
INSTALL_MIGRATE: "true"
|
|
553
553
|
```
|
|
554
554
|
|
|
555
|
+
`INSTALL_GOLANGCI_LINT: "true"` installs the [golangci-lint](https://golangci-lint.run) linux-amd64 release binary to `/usr/local/bin`. Pin the version with `GOLANGCI_LINT_VERSION` (default `2.15.0`, without the `v` prefix).
|
|
556
|
+
|
|
557
|
+
```yaml
|
|
558
|
+
- uses: tahminator/pipeline/actions/setup@<version>
|
|
559
|
+
with:
|
|
560
|
+
INSTALL_GOLANGCI_LINT: "true"
|
|
561
|
+
GOLANGCI_LINT_VERSION: "2.15.0"
|
|
562
|
+
```
|
|
563
|
+
|
|
555
564
|
### `NPMClient`
|
|
556
565
|
|
|
557
566
|
Interface with NPM registry in order to publish packages to `npmjs.com`
|
|
@@ -765,12 +774,15 @@ Spin up a disposable local Postgres instance via Docker. Useful for running migr
|
|
|
765
774
|
|
|
766
775
|
Each call to `create()` gets a unique container name and a Docker-assigned host port, so multiple instances can coexist without conflict.
|
|
767
776
|
|
|
777
|
+
The container runs `postgres:16-alpine` by default. Pass `version` to choose another image, either a major (`18`) or a major.minor (`"18.1"`); versions below 16 are rejected.
|
|
778
|
+
|
|
768
779
|
```ts
|
|
769
780
|
import { $ } from "bun";
|
|
770
781
|
|
|
771
782
|
async function main() {
|
|
772
783
|
await using pgClient = await LocalPostgresClient.create({
|
|
773
784
|
database: "instalock-server-acceptance",
|
|
785
|
+
version: 18,
|
|
774
786
|
});
|
|
775
787
|
|
|
776
788
|
// get credentials
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PostgresInternalState, PostgresState } from "./types";
|
|
2
2
|
export declare class LocalPostgresClient {
|
|
3
3
|
private readonly iState;
|
|
4
|
+
private static readonly MIN_VERSION;
|
|
4
5
|
private constructor();
|
|
5
6
|
/**
|
|
6
7
|
* Spin up a local Postgres instance via Docker.
|
|
@@ -29,6 +30,7 @@ export declare class LocalPostgresClient {
|
|
|
29
30
|
* ```
|
|
30
31
|
*/
|
|
31
32
|
static create(state: PostgresState): Promise<LocalPostgresClient>;
|
|
33
|
+
private static resolveVersion;
|
|
32
34
|
private static launch;
|
|
33
35
|
private static waitUntilReady;
|
|
34
36
|
get state(): PostgresInternalState;
|
package/dist/postgres/client.js
CHANGED
|
@@ -2,6 +2,7 @@ import { $, randomUUIDv7 } from "bun";
|
|
|
2
2
|
import { Utils } from "../utils";
|
|
3
3
|
export class LocalPostgresClient {
|
|
4
4
|
iState;
|
|
5
|
+
static MIN_VERSION = 16;
|
|
5
6
|
constructor(iState) {
|
|
6
7
|
this.iState = iState;
|
|
7
8
|
}
|
|
@@ -34,6 +35,7 @@ export class LocalPostgresClient {
|
|
|
34
35
|
static async create(state) {
|
|
35
36
|
const iState = {
|
|
36
37
|
...state,
|
|
38
|
+
version: this.resolveVersion(state.version),
|
|
37
39
|
user: "postgres",
|
|
38
40
|
password: "postgres",
|
|
39
41
|
port: 5432,
|
|
@@ -45,6 +47,17 @@ export class LocalPostgresClient {
|
|
|
45
47
|
await this.waitUntilReady(iState);
|
|
46
48
|
return new this(iState);
|
|
47
49
|
}
|
|
50
|
+
static resolveVersion(version) {
|
|
51
|
+
if (version === undefined) {
|
|
52
|
+
return String(this.MIN_VERSION);
|
|
53
|
+
}
|
|
54
|
+
const resolved = String(version);
|
|
55
|
+
const match = resolved.match(/^(\d+)(\.\d+)?$/);
|
|
56
|
+
if (!match || Number(match[1]) < this.MIN_VERSION) {
|
|
57
|
+
throw new Error(`Unsupported Postgres version "${resolved}": expected a major or major.minor version of ${this.MIN_VERSION} or newer.`);
|
|
58
|
+
}
|
|
59
|
+
return resolved;
|
|
60
|
+
}
|
|
48
61
|
static async launch(iState) {
|
|
49
62
|
await $ `docker run -d \
|
|
50
63
|
--name ${iState.dockerName} \
|
|
@@ -52,7 +65,7 @@ export class LocalPostgresClient {
|
|
|
52
65
|
-e POSTGRES_PASSWORD=${iState.password} \
|
|
53
66
|
-e POSTGRES_DB=${iState.database} \
|
|
54
67
|
-p 5432 \
|
|
55
|
-
mirror.gcr.io/library/postgres
|
|
68
|
+
mirror.gcr.io/library/postgres:${iState.version}-alpine`;
|
|
56
69
|
const raw = (await $ `docker port ${iState.dockerName} 5432/tcp`.text()).trim();
|
|
57
70
|
const match = raw.match(/:(\d+)/);
|
|
58
71
|
if (!match) {
|
package/dist/postgres/types.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export interface PostgresState {
|
|
2
2
|
database: string;
|
|
3
|
+
/**
|
|
4
|
+
* Postgres image version, either a major (`18`) or a major.minor (`"18.1"`).
|
|
5
|
+
* Must be 16 or newer. Defaults to 16.
|
|
6
|
+
*/
|
|
7
|
+
version?: number | string;
|
|
3
8
|
}
|
|
4
9
|
export interface PostgresInternalState extends PostgresState {
|
|
10
|
+
version: string;
|
|
5
11
|
port: number;
|
|
6
12
|
host: string;
|
|
7
13
|
user: string;
|