-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): remove invalid properties from force-release workflow (#442)
Unfortunately, the rollout of #437 failed because it turns out there was some invalid syntax in the `force-release` workflow, which the `action-validator` package was failing the build on. This highlighted one flaw of this setup: because the `force-release` workflow doesn't exist in this project, and only in the prebuilt providers / implementers of this project, it wasn't being run through the validation at build/test time here in the source, and so it's possible to write a bad workflow here, publish a release, and break all implementing projects as a result. In order to be a good citizen, I not only fixed the issue with `force-release` itself but also figured out how to add tests for all of the workflows, again using `action-validator`. I manually verified that with the bad syntax still included in `force-release.ts`, the tests were failing (as they should). When I removed the bad syntax, all the tests pass. Win!
- Loading branch information
Showing
6 changed files
with
55 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
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, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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([]); | ||
}); | ||
}); | ||
}); |