-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Chore] add cgo test for macos-12 and macos-13 (#34741)
**Description:** <Describe what has changed.> In order to add CGO support, add compatibility test for old macos versions. Due macos-12 and macos-13 are using amd64 instead of arm64, cross compiling is used. **Link to tracking Issue:** <Issue number if applicable> #33393 **Testing:** <Describe what testing was performed and which tests were added.> Added tests for hostmetrics receiver for macos-12 and macos-13 **Documentation:** <Describe the documentation added.> --------- Co-authored-by: Sean Marciniak <30928402+MovieStoreGuy@users.noreply.github.com>
- Loading branch information
1 parent
f4a4206
commit 8786312
Showing
3 changed files
with
128 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: build-and-test-darwin | ||
on: | ||
push: | ||
branches: [main] | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+*" | ||
merge_group: | ||
pull_request: | ||
types: [opened, synchronize, reopened, labeled, unlabeled] | ||
branches: | ||
- main | ||
env: | ||
TEST_RESULTS: testbed/tests/results/junit/results.xml | ||
# Make sure to exit early if cache segment download times out after 2 minutes. | ||
# We limit cache download as a whole to 5 minutes. | ||
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2 | ||
GOPROXY: https://goproxy1.cncf.selfactuated.dev,direct | ||
|
||
# Do not cancel this workflow on main. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16616 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
darwin-build-unittest-binary: | ||
if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Darwin') || github.event_name == 'push' || github.event_name == 'merge_group') }} | ||
runs-on: macos-14 | ||
timeout-minutes: 120 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "~1.22.5" | ||
cache: false | ||
- name: Cache Go | ||
id: go-cache | ||
timeout-minutes: 5 | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/go/bin | ||
~/go/pkg/mod | ||
key: go-build-cache-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
- name: Install dependencies | ||
if: steps.go-cache.outputs.cache-hit != 'true' | ||
run: make -j2 gomoddownload | ||
- name: Install Tools | ||
if: steps.go-cache.outputs.cache-hit != 'true' | ||
run: make install-tools | ||
- name: Build test binaries | ||
env: | ||
GOTESTARCH: amd64 | ||
run: make gobuildtest GROUP=cgo | ||
- name: Zip test binaries | ||
run: zip -r testbinaries.zip . --include \*builtunitetest.test | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: testbinaries | ||
path: ./testbinaries.zip | ||
retention-days: 1 | ||
darwin-unittest-matrix: | ||
if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Darwin') || github.event_name == 'push' || github.event_name == 'merge_group') }} | ||
needs: [darwin-build-unittest-binary] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-12, macos-13] | ||
timeout-minutes: 30 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "~1.22.5" | ||
cache: false | ||
- name: Install Tools | ||
if: steps.go-cache.outputs.cache-hit != 'true' | ||
run: make install-tools | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: testbinaries | ||
- name: Unzip binaries to each module | ||
run: unzip testbinaries.zip | ||
- name: Run Unit Tests | ||
run: make -j2 gorunbuilttest GROUP=cgo | ||
darwin-unittest: | ||
if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Darwin') || github.event_name == 'push' || github.event_name == 'merge_group') }} | ||
runs-on: macos-latest | ||
needs: [darwin-unittest-matrix] | ||
steps: | ||
- name: Print result | ||
run: echo ${{ needs.darwin-unittest-matrix.result }} | ||
- name: Interpret result | ||
run: | | ||
if [[ success == ${{ needs.darwin-unittest-matrix.result }} ]] | ||
then | ||
echo "All matrix jobs passed!" | ||
else | ||
echo "One or more matrix jobs failed." | ||
false | ||
fi |
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
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