-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GHA to run TeamCity config tests on PRs editing .teamcity
#9954
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: TeamCity Configuration Tests | ||
permissions: read-all | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/teamcity-pr-checks.yml' | ||
- 'mmv1/third_party/terraform/!.teamcity' | ||
|
||
|
||
jobs: | ||
teamcity-config-tests: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 | ||
with: | ||
distribution: zulu | ||
java-version: 17 | ||
java-package: jdk | ||
|
||
- name: Cache Maven files | ||
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
|
||
- name: Download TeamCity Tools | ||
run : | | ||
cd mmv1/third_party/terraform/.teamcity | ||
make tools | ||
|
||
# Running the tests twice ensures that the tests are discovered and run | ||
- name: Run TeamCity Tests | ||
run : | | ||
cd mmv1/third_party/terraform/.teamcity | ||
make test | ||
make test | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the exact reason why, but if you only run this command once the tests aren't detected and the test runner reports
[INFO] No tests to run.
:Instead the logs should show something like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can see the TESTS output in the GHA run for 1bf8b76 in this line here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the basis of this behaviour is the pom.xml file, maybe this section, but I'm really not an experienced Kotlin/Java developer. Given that the pom.xml file we use strongly resembles the Azure provider team's pom.xml file, who are the SMEs for TeamCity in HashiCorp, I'd like to avoid digging into this solo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, but it works fine locally, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It behaves the same way locally if I make my laptop's state match a GHA running in a fresh container. I do that by deleting the (gitignored) mmv1/third_party/terraform/.teamcity/target folder from my local copy of MM, a folder made in the process of running
make test
.If I run
make test
after deleting the target folder the target folder is remade and populated and then I see the 'No tests to run' message. If I runmake test
a second time, when target is present from the first run, I see the expected test pass/fail output.It's very weird but at least shows it's not a problem with GHAs vs using these files during development.