@intentius/chant-lexicon-gitlab 0.0.16 → 0.0.22
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/dist/integrity.json +17 -4
- package/dist/manifest.json +1 -1
- package/dist/rules/wgl016.ts +82 -0
- package/dist/rules/wgl017.ts +54 -0
- package/dist/rules/wgl018.ts +39 -0
- package/dist/rules/wgl019.ts +44 -0
- package/dist/rules/wgl020.ts +56 -0
- package/dist/rules/wgl021.ts +62 -0
- package/dist/rules/wgl022.ts +44 -0
- package/dist/rules/wgl023.ts +51 -0
- package/dist/rules/wgl024.ts +46 -0
- package/dist/rules/wgl025.ts +49 -0
- package/dist/rules/wgl026.ts +67 -0
- package/dist/rules/wgl027.ts +54 -0
- package/dist/rules/wgl028.ts +67 -0
- package/dist/rules/yaml-helpers.ts +82 -0
- package/dist/skills/chant-gitlab.md +2 -2
- package/package.json +20 -2
- package/src/codegen/fetch.test.ts +30 -0
- package/src/codegen/generate.test.ts +65 -0
- package/src/codegen/idempotency.test.ts +28 -0
- package/src/codegen/naming.test.ts +93 -0
- package/src/codegen/snapshot.test.ts +28 -19
- package/src/composites/composites.test.ts +160 -0
- package/src/coverage.test.ts +15 -7
- package/src/import/roundtrip.test.ts +132 -0
- package/src/lint/post-synth/wgl016.test.ts +72 -0
- package/src/lint/post-synth/wgl016.ts +82 -0
- package/src/lint/post-synth/wgl017.test.ts +53 -0
- package/src/lint/post-synth/wgl017.ts +54 -0
- package/src/lint/post-synth/wgl018.test.ts +69 -0
- package/src/lint/post-synth/wgl018.ts +39 -0
- package/src/lint/post-synth/wgl019.test.ts +76 -0
- package/src/lint/post-synth/wgl019.ts +44 -0
- package/src/lint/post-synth/wgl020.test.ts +54 -0
- package/src/lint/post-synth/wgl020.ts +56 -0
- package/src/lint/post-synth/wgl021.test.ts +62 -0
- package/src/lint/post-synth/wgl021.ts +62 -0
- package/src/lint/post-synth/wgl022.test.ts +86 -0
- package/src/lint/post-synth/wgl022.ts +44 -0
- package/src/lint/post-synth/wgl023.test.ts +88 -0
- package/src/lint/post-synth/wgl023.ts +51 -0
- package/src/lint/post-synth/wgl024.test.ts +77 -0
- package/src/lint/post-synth/wgl024.ts +46 -0
- package/src/lint/post-synth/wgl025.test.ts +85 -0
- package/src/lint/post-synth/wgl025.ts +49 -0
- package/src/lint/post-synth/wgl026.test.ts +87 -0
- package/src/lint/post-synth/wgl026.ts +67 -0
- package/src/lint/post-synth/wgl027.test.ts +84 -0
- package/src/lint/post-synth/wgl027.ts +54 -0
- package/src/lint/post-synth/wgl028.test.ts +95 -0
- package/src/lint/post-synth/wgl028.ts +67 -0
- package/src/lint/post-synth/yaml-helpers.ts +82 -0
- package/src/lsp/completions.test.ts +16 -6
- package/src/lsp/hover.test.ts +18 -7
- package/src/plugin.test.ts +14 -1
- package/src/plugin.ts +20 -3
- package/src/testdata/pipelines/deploy-envs.gitlab-ci.yml +60 -0
- package/src/testdata/pipelines/docker-build.gitlab-ci.yml +41 -0
- package/src/testdata/pipelines/includes-templates.gitlab-ci.yml +52 -0
- package/src/testdata/pipelines/monorepo.gitlab-ci.yml +51 -0
- package/src/testdata/pipelines/multi-stage.gitlab-ci.yml +56 -0
- package/src/testdata/pipelines/simple.gitlab-ci.yml +9 -0
- package/src/validate.test.ts +12 -6
- package/src/variables.test.ts +58 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- build
|
|
3
|
+
- test
|
|
4
|
+
- deploy
|
|
5
|
+
|
|
6
|
+
build-app:
|
|
7
|
+
stage: build
|
|
8
|
+
image: node:22-alpine
|
|
9
|
+
script:
|
|
10
|
+
- npm ci
|
|
11
|
+
- npm run build
|
|
12
|
+
artifacts:
|
|
13
|
+
paths:
|
|
14
|
+
- dist/
|
|
15
|
+
expire_in: 1 hour
|
|
16
|
+
cache:
|
|
17
|
+
key:
|
|
18
|
+
files:
|
|
19
|
+
- package-lock.json
|
|
20
|
+
paths:
|
|
21
|
+
- .npm/
|
|
22
|
+
|
|
23
|
+
lint:
|
|
24
|
+
stage: test
|
|
25
|
+
image: node:22-alpine
|
|
26
|
+
needs:
|
|
27
|
+
- build-app
|
|
28
|
+
script:
|
|
29
|
+
- npm ci
|
|
30
|
+
- npm run lint
|
|
31
|
+
|
|
32
|
+
unit-tests:
|
|
33
|
+
stage: test
|
|
34
|
+
image: node:22-alpine
|
|
35
|
+
needs:
|
|
36
|
+
- build-app
|
|
37
|
+
script:
|
|
38
|
+
- npm ci
|
|
39
|
+
- npm test -- --coverage
|
|
40
|
+
artifacts:
|
|
41
|
+
reports:
|
|
42
|
+
junit: junit.xml
|
|
43
|
+
coverage_report:
|
|
44
|
+
coverage_format: cobertura
|
|
45
|
+
path: coverage/cobertura-coverage.xml
|
|
46
|
+
|
|
47
|
+
deploy-staging:
|
|
48
|
+
stage: deploy
|
|
49
|
+
needs:
|
|
50
|
+
- lint
|
|
51
|
+
- unit-tests
|
|
52
|
+
script:
|
|
53
|
+
- deploy.sh staging
|
|
54
|
+
environment:
|
|
55
|
+
name: staging
|
|
56
|
+
url: https://staging.example.com
|
package/src/validate.test.ts
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import { describe, test, expect } from "bun:test";
|
|
2
|
-
import {
|
|
3
|
-
import { dirname } from "path";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { join, dirname } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
|
|
6
6
|
const basePath = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
7
|
+
const lexiconPath = join(basePath, "src", "generated", "lexicon-gitlab.json");
|
|
8
|
+
const hasGenerated = existsSync(lexiconPath);
|
|
7
9
|
|
|
8
10
|
describe("validate", () => {
|
|
9
|
-
test("runs validation checks on current generated artifacts", async () => {
|
|
11
|
+
test.skipIf(!hasGenerated)("runs validation checks on current generated artifacts", async () => {
|
|
12
|
+
const { validate } = await import("./validate");
|
|
10
13
|
const result = await validate({ basePath });
|
|
11
14
|
expect(result.checks.length).toBeGreaterThan(0);
|
|
12
15
|
});
|
|
13
16
|
|
|
14
|
-
test("checks lexicon JSON exists and parses", async () => {
|
|
17
|
+
test.skipIf(!hasGenerated)("checks lexicon JSON exists and parses", async () => {
|
|
18
|
+
const { validate } = await import("./validate");
|
|
15
19
|
const result = await validate({ basePath });
|
|
16
20
|
const jsonCheck = result.checks.find((c) => c.name === "lexicon-json-exists");
|
|
17
21
|
expect(jsonCheck).toBeDefined();
|
|
18
22
|
expect(jsonCheck?.ok).toBe(true);
|
|
19
23
|
});
|
|
20
24
|
|
|
21
|
-
test("checks types exist", async () => {
|
|
25
|
+
test.skipIf(!hasGenerated)("checks types exist", async () => {
|
|
26
|
+
const { validate } = await import("./validate");
|
|
22
27
|
const result = await validate({ basePath });
|
|
23
28
|
const typesCheck = result.checks.find((c) => c.name === "types-exist");
|
|
24
29
|
expect(typesCheck).toBeDefined();
|
|
25
30
|
expect(typesCheck?.ok).toBe(true);
|
|
26
31
|
});
|
|
27
32
|
|
|
28
|
-
test("checks required names are present", async () => {
|
|
33
|
+
test.skipIf(!hasGenerated)("checks required names are present", async () => {
|
|
34
|
+
const { validate } = await import("./validate");
|
|
29
35
|
const result = await validate({ basePath });
|
|
30
36
|
const requiredCheck = result.checks.find((c) => c.name === "required-names");
|
|
31
37
|
expect(requiredCheck).toBeDefined();
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, test, expect } from "bun:test";
|
|
2
|
+
import { CI } from "./variables";
|
|
3
|
+
|
|
4
|
+
describe("CI variables", () => {
|
|
5
|
+
test("all values start with $CI_", () => {
|
|
6
|
+
for (const [key, value] of Object.entries(CI)) {
|
|
7
|
+
expect(value).toMatch(/^\$CI_/);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test("all values are non-empty strings", () => {
|
|
12
|
+
for (const [key, value] of Object.entries(CI)) {
|
|
13
|
+
expect(typeof value).toBe("string");
|
|
14
|
+
expect(value.length).toBeGreaterThan(0);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("contains expected commit variables", () => {
|
|
19
|
+
expect(CI.CommitBranch).toBe("$CI_COMMIT_BRANCH");
|
|
20
|
+
expect(CI.CommitRef).toBe("$CI_COMMIT_REF_NAME");
|
|
21
|
+
expect(CI.CommitRefSlug).toBe("$CI_COMMIT_REF_SLUG");
|
|
22
|
+
expect(CI.CommitSha).toBe("$CI_COMMIT_SHA");
|
|
23
|
+
expect(CI.CommitTag).toBe("$CI_COMMIT_TAG");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test("contains expected project variables", () => {
|
|
27
|
+
expect(CI.ProjectDir).toBe("$CI_PROJECT_DIR");
|
|
28
|
+
expect(CI.ProjectId).toBe("$CI_PROJECT_ID");
|
|
29
|
+
expect(CI.ProjectName).toBe("$CI_PROJECT_NAME");
|
|
30
|
+
expect(CI.ProjectPath).toBe("$CI_PROJECT_PATH");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("contains expected pipeline variables", () => {
|
|
34
|
+
expect(CI.PipelineId).toBe("$CI_PIPELINE_ID");
|
|
35
|
+
expect(CI.PipelineSource).toBe("$CI_PIPELINE_SOURCE");
|
|
36
|
+
expect(CI.JobId).toBe("$CI_JOB_ID");
|
|
37
|
+
expect(CI.JobName).toBe("$CI_JOB_NAME");
|
|
38
|
+
expect(CI.JobStage).toBe("$CI_JOB_STAGE");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("contains expected registry variables", () => {
|
|
42
|
+
expect(CI.Registry).toBe("$CI_REGISTRY");
|
|
43
|
+
expect(CI.RegistryImage).toBe("$CI_REGISTRY_IMAGE");
|
|
44
|
+
expect(CI.RegistryUser).toBe("$CI_REGISTRY_USER");
|
|
45
|
+
expect(CI.RegistryPassword).toBe("$CI_REGISTRY_PASSWORD");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("contains environment variables", () => {
|
|
49
|
+
expect(CI.Environment).toBe("$CI_ENVIRONMENT_NAME");
|
|
50
|
+
expect(CI.EnvironmentSlug).toBe("$CI_ENVIRONMENT_SLUG");
|
|
51
|
+
expect(CI.DefaultBranch).toBe("$CI_DEFAULT_BRANCH");
|
|
52
|
+
expect(CI.MergeRequestIid).toBe("$CI_MERGE_REQUEST_IID");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("exports at least 20 variables", () => {
|
|
56
|
+
expect(Object.keys(CI).length).toBeGreaterThanOrEqual(20);
|
|
57
|
+
});
|
|
58
|
+
});
|