Skip to content

Commit ea6d256

Browse files
[Infra] Avoid interpolation for workflow scripts (#3849)
1 parent 40ed846 commit ea6d256

File tree

4 files changed

+45
-21
lines changed

4 files changed

+45
-21
lines changed

.github/workflows/Component.BuildTest.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
version: net462
5656

5757
runs-on: ${{ matrix.os }}
58+
timeout-minutes: 45
5859

5960
steps:
6061
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -67,6 +68,8 @@ jobs:
6768
- name: Resolve project
6869
id: resolve-project
6970
shell: pwsh
71+
env:
72+
PROJECT_NAME: ${{ inputs.project-name }}
7073
run: |
7174
Import-Module .\build\scripts\build.psm1
7275
@@ -79,7 +82,7 @@ jobs:
7982
$component = '' # Used to tell Component.proj what to build
8083
8184
ResolveProject `
82-
-projectNameOrComponentData '${{ inputs.project-name }}' `
85+
-projectNameOrComponentData ${env:PROJECT_NAME} `
8386
-title ([ref]$title) `
8487
-project ([ref]$project) `
8588
-component ([ref]$component)
@@ -111,43 +114,57 @@ jobs:
111114
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
112115

113116
- name: dotnet restore ${{ steps.resolve-project.outputs.title }}
114-
run: dotnet restore ${{ steps.resolve-project.outputs.project }} -p:EnablePackageValidation=true
117+
run: dotnet restore ${env:PROJECT_PATH} -p:EnablePackageValidation=true
118+
shell: pwsh
119+
env:
120+
PROJECT_PATH: ${{ steps.resolve-project.outputs.project }}
115121

116122
- name: dotnet build ${{ steps.resolve-project.outputs.title }}
117-
run: dotnet build ${{ steps.resolve-project.outputs.project }} --configuration Release --no-restore
123+
run: dotnet build ${env:PROJECT_PATH} --configuration Release --no-restore
124+
shell: pwsh
125+
env:
126+
PROJECT_PATH: ${{ steps.resolve-project.outputs.project }}
118127

119128
- name: dotnet test ${{ steps.resolve-project.outputs.title }}
120-
if: ${{ inputs.run-tests }}
129+
if: inputs.run-tests
130+
shell: pwsh
131+
env:
132+
PROJECT_PATH: ${{ steps.resolve-project.outputs.project }}
133+
TARGET_FRAMEWORK: ${{ matrix.version }}
134+
TEST_FILTER: ${{ inputs.test-case-filter }}
121135
run: >
122136
${{ inputs.test-require-elevated && matrix.os != 'windows-latest' && 'sudo -E' || '' }}
123-
dotnet test ${{ steps.resolve-project.outputs.project }}
137+
dotnet test ${env:PROJECT_PATH}
124138
--collect:"Code Coverage"
125139
--results-directory:TestResults
126-
--framework ${{ matrix.version }}
140+
--framework ${env:TARGET_FRAMEWORK}
127141
--configuration Release
128142
--no-restore
129143
--no-build
130144
--logger:"console;verbosity=detailed"
131145
--logger:"GitHubActions;report-warnings=false"
132146
--logger:"junit;LogFilePath=TestResults/junit.xml"
133-
--filter "${{ inputs.test-case-filter }}"
147+
--filter "${env:TEST_FILTER}"
134148
-- RunConfiguration.DisableAppDomain=true
135149
${{ inputs.test-require-elevated && matrix.os != 'windows-latest' && '&& sudo chmod a+rw ./TestResults' || '' }}
136150
137151
- name: dotnet pack ${{ steps.resolve-project.outputs.title }}
138-
if: ${{ matrix.os == 'windows-latest' && inputs.pack }}
139-
run: dotnet pack ${{ steps.resolve-project.outputs.project }} --configuration Release --no-restore --no-build -p:EnablePackageValidation=true
152+
if: matrix.os == 'windows-latest' && inputs.pack
153+
run: dotnet pack ${env:PROJECT_PATH} --configuration Release --no-restore --no-build -p:EnablePackageValidation=true
154+
shell: pwsh
155+
env:
156+
PROJECT_PATH: ${{ steps.resolve-project.outputs.project }}
140157

141158
- name: Install coverage tool
142-
if: ${{ inputs.run-tests }}
159+
if: inputs.run-tests
143160
run: dotnet tool install -g dotnet-coverage
144161

145162
- name: Merging test results
146-
if: ${{ inputs.run-tests && hashFiles('./TestResults/**/*.coverage') != '' }}
163+
if: inputs.run-tests && hashFiles('./TestResults/**/*.coverage') != ''
147164
run: dotnet-coverage merge -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/**/*.coverage
148165

149166
- name: Upload code coverage ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
150-
if: ${{ inputs.run-tests && hashFiles('./TestResults/Cobertura.xml') != '' }}
167+
if: inputs.run-tests && hashFiles('./TestResults/Cobertura.xml') != ''
151168
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
152169
continue-on-error: true # Note: Don't fail for upload failures
153170
env:
@@ -175,7 +192,7 @@ jobs:
175192
- name: Publish ${{ steps.resolve-project.outputs.name }} NuGet packages to Artifacts
176193
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
177194
# Only publish packages from the first job, which should be net462 for Windows in most cases, which is preferred for .NET Framework support
178-
if: ${{ matrix.os == 'windows-latest' && inputs.pack && strategy.job-index == 0 }}
195+
if: matrix.os == 'windows-latest' && inputs.pack && strategy.job-index == 0
179196
with:
180197
name: ${{ steps.resolve-project.outputs.name }}-packages
181198
path: ./artifacts/package/release

.github/workflows/automation.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ jobs:
2828
outputs:
2929
enabled: ${{ steps.evaluate.outputs.enabled }}
3030

31-
env:
32-
OTELBOT_DOTNET_CONTRIB_PRIVATE_KEY_EXISTS: ${{ secrets.OTELBOT_DOTNET_CONTRIB_PRIVATE_KEY != '' }}
33-
3431
steps:
3532
- id: evaluate
33+
env:
34+
IS_ENABLED: ${{ secrets.OTELBOT_DOTNET_CONTRIB_PRIVATE_KEY != '' }}
3635
run: |
37-
echo "enabled=${{ env.OTELBOT_DOTNET_CONTRIB_PRIVATE_KEY_EXISTS == 'true' }}" >> "$GITHUB_OUTPUT"
36+
echo "enabled=$IS_ENABLED" >> "$GITHUB_OUTPUT"

.github/workflows/integration.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2323

2424
- name: Run redis docker compose
25-
run: docker compose --file=test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build
25+
run: docker compose --file=test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/docker-compose.yml "--file=build/docker-compose.${TARGET_FRAMEWORK}.yml" --project-directory=. up --exit-code-from=tests --build
26+
env:
27+
TARGET_FRAMEWORK: ${{ matrix.version }}
2628

2729
kafka-integration-test:
2830
if: inputs.job == 'all' || inputs.job == 'kafka-integration-test'
@@ -35,7 +37,9 @@ jobs:
3537
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3638

3739
- name: Run kafka docker compose
38-
run: docker compose --file=test/OpenTelemetry.Instrumentation.ConfluentKafka.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build
40+
run: docker compose --file=test/OpenTelemetry.Instrumentation.ConfluentKafka.Tests/docker-compose.yml "--file=build/docker-compose.${TARGET_FRAMEWORK}.yml" --project-directory=. up --exit-code-from=tests --build
41+
env:
42+
TARGET_FRAMEWORK: ${{ matrix.version }}
3943

4044
cassandra-integration-test:
4145
if: inputs.job == 'all' || inputs.job == 'cassandra-integration-test'
@@ -48,4 +52,6 @@ jobs:
4852
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4953

5054
- name: Run cassandra docker compose
51-
run: docker compose --file=test/OpenTelemetry.Instrumentation.Cassandra.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build
55+
run: docker compose --file=test/OpenTelemetry.Instrumentation.Cassandra.Tests/docker-compose.yml "--file=build/docker-compose.${TARGET_FRAMEWORK}.yml" --project-directory=. up --exit-code-from=tests --build
56+
env:
57+
TARGET_FRAMEWORK: ${{ matrix.version }}

.github/workflows/verifyaotcompat.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ jobs:
2424

2525
- name: publish AOT testApp, assert static analysis warning count, and run the app
2626
shell: pwsh
27-
run: .\build\scripts\test-aot-compatibility.ps1 ${{ matrix.version }}
27+
run: .\build\scripts\test-aot-compatibility.ps1 ${env:TARGET_FRAMEWORK}
28+
env:
29+
TARGET_FRAMEWORK: ${{ matrix.version }}

0 commit comments

Comments
 (0)