Skip to content

Commit

Permalink
fix(ci): remove invalid properties from force-release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehan committed Aug 27, 2024
1 parent 8e090f7 commit bee7e66
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 36 deletions.
2 changes: 0 additions & 2 deletions src/force-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ export class ForceRelease {
workflowDispatch: {
inputs: {
sha: {
name: "sha",
type: "string",
required: true,
description: "The sha of the commit to release",
},
publish_to_go: {
name: "publish_to_go",
type: "boolean",
required: true,
description: "Whether to publish to Go Repository",
Expand Down
10 changes: 1 addition & 9 deletions test/__snapshots__/index.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 4 additions & 25 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,8 @@
* SPDX-License-Identifier: MPL-2.0
*/

import { synthSnapshot } from "./utils";
import { CdktfProviderProject, CdktfProviderProjectOptions } from "../src";

const getProject = (
opts: Partial<CdktfProviderProjectOptions> = {}
): CdktfProviderProject =>
new CdktfProviderProject({
terraformProvider: "random@~>2.0",
cdktfVersion: "0.10.3",
constructsVersion: "10.0.0",
jsiiVersion: "~5.2.0",
typescriptVersion: "~5.2.0", // NOTE: this should be the same major/minor version as JSII
devDeps: ["@cdktf/provider-project@^0.0.0"],
// NOTE: the below options aren't required to be passed in practice and only need to be here for the test
// This is because JSII prevents us from declaring the options as a Partial<cdk.JsiiProjectOptions>
name: "test",
author: "cdktf-team",
authorAddress: "https://github.com/cdktf",
defaultReleaseBranch: "main",
repositoryUrl: "github.com/cdktf/cdktf",
forceMajorVersion: 42,
...opts,
});
import { synthSnapshot } from "./util/synth";
import { getProject } from "./util/test-project";

test("synths with minimal options", () => {
const snapshot = synthSnapshot(getProject());
Expand Down Expand Up @@ -194,7 +173,7 @@ test("override maven group id", () => {

test("with minNodeVersion", () => {
const snapshot = synthSnapshot(
new CdktfProviderProject({
getProject({
useCustomGithubRunner: false,
terraformProvider: "vancluever/acme@~> 2.10",
cdktfVersion: "^0.20.0",
Expand All @@ -204,7 +183,7 @@ test("with minNodeVersion", () => {
typescriptVersion: "~5.3.0", // NOTE: this should be the same major/minor version as JSII
devDeps: ["@cdktf/provider-project@^0.5.0"],
isDeprecated: false,
} as any)
})
);

expect(snapshot).toMatchSnapshot();
Expand Down
File renamed without changes.
22 changes: 22 additions & 0 deletions test/util/test-project.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { CdktfProviderProject, CdktfProviderProjectOptions } from "../../src";

export const getProject = (
opts: Partial<CdktfProviderProjectOptions> = {}
): CdktfProviderProject =>
new CdktfProviderProject({
terraformProvider: "random@~>2.0",
cdktfVersion: "0.10.3",
constructsVersion: "10.0.0",
jsiiVersion: "~5.2.0",
typescriptVersion: "~5.2.0", // NOTE: this should be the same major/minor version as JSII
devDeps: ["@cdktf/provider-project@^0.0.0"],
// NOTE: the below options aren't required to be passed in practice and only need to be here for the test
// This is because JSII prevents us from declaring the options as a Partial<cdk.JsiiProjectOptions>
name: "test",
author: "cdktf-team",
authorAddress: "https://github.com/cdktf",
defaultReleaseBranch: "main",
repositoryUrl: "github.com/cdktf/cdktf",
forceMajorVersion: 42,
...opts,
});
23 changes: 23 additions & 0 deletions test/workflows.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/

import { validateWorkflow } from "@action-validator/core";
import { GithubWorkflow } from "projen/lib/github";
import { synthSnapshot } from "./util/synth";
import { getProject } from "./util/test-project";

const project = getProject();

describe("GitHub Actions validation", () => {
const snapshot = synthSnapshot(getProject());

project.github!.workflows.forEach((workflow: GithubWorkflow) => {
test(workflow.file!.path, () => {
const state = validateWorkflow(snapshot[workflow.file!.path]);

expect(state.errors).toEqual([]);
});
});
});

0 comments on commit bee7e66

Please sign in to comment.