Skip to content
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

DEBUGINFRA-861: Run tests on Arm-based Macs #252

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/code-climate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Code Climate

on:
workflow_run:
workflows: ["Test"]
# avoid running once merged on main branch, this should be run only on PRs
branches-ignore: ["main"]
# run this once one of the workflow is triggered.
types:
- requested

jobs:
code-climate:
name: Set up
runs-on: ubuntu-22.04
steps:
- name: Checkout PR head commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true

- name: Install code climate cli
run: |
curl -L https://github.com/codeclimate/codeclimate/archive/master.tar.gz | tar xvz
cd codeclimate-* && sudo make install
ls -la

- name: Run unit tests
run: |
mkdir -p build
make test > build/cpackgettests-linux-amd64.txt

50 changes: 29 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test

on:
workflow_dispatch:
push:
push:
branches: [main]
pull_request:
paths:
Expand Down Expand Up @@ -85,20 +85,27 @@ jobs:
run: |
make test-xmllint-localrepository

test-amd64:
test-native:
strategy:
matrix:
# Tests on Mac are currently broken
# Runners
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
goos: [windows, linux, darwin]
include:
- goos: windows
runs-on: windows-latest
arch: amd64
- goos: linux
runs-on: ubuntu-latest
arch: amd64
- goos: darwin
runs-on: macos-latest
arch: amd64
- goos: darwin
runs-on: macos-14
arch: arm64

name: "${{ matrix.goos }} | amd64"
name: "${{ matrix.goos }} | ${{ matrix.arch }} native"
runs-on: ${{ matrix.runs-on }}
steps:
- name: Check out repository code
Expand All @@ -116,32 +123,33 @@ jobs:
- name: Run unit tests
run: |
mkdir -p build
make test > build/cpackgettests-${{ matrix.goos }}-amd64.txt
make test > build/cpackgettests-${{ matrix.goos }}-${{ matrix.arch }}.txt

- name: Generate JUnit test report
if: always()
run: |
go-junit-report -set-exit-code -in build/cpackgettests-${{ matrix.goos }}-amd64.txt -iocopy -out build/cpackget-testreport-${{ matrix.goos }}-amd64.xml

- name: Publish coverage report to Code Climate
if: ${{ startsWith(matrix.runs-on, 'ubuntu') && (github.workflow != 'Release') }}
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
debug: true
coverageLocations: ./cover.out:gocov
prefix: github.com/open-cmsis-pack/cpackget
go-junit-report -set-exit-code -in build/cpackgettests-${{ matrix.goos }}-${{ matrix.arch }}.txt -iocopy -out build/cpackget-testreport-${{ matrix.goos }}-${{ matrix.arch }}.xml

# - name: Publish coverage report to Code Climate
# if: ${{ startsWith(matrix.runs-on, 'ubuntu') && (github.workflow != 'Release') }}
# uses: paambaati/[email protected]
# env:
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# with:
# debug: true
# coverageLocations: ./cover.out:gocov
# prefix: github.com/open-cmsis-pack/cpackget


- name: Archive unit test results
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.goos }}-amd64
path: ./build/cpackget-testreport-${{ matrix.goos }}-amd64.xml
name: test-results-${{ matrix.goos }}-${{ matrix.arch }}
path: ./build/cpackget-testreport-${{ matrix.goos }}-${{ matrix.arch }}.xml
if-no-files-found: error

test-linux-arm64:
name: "linux | arm64"
test-linux-arm64-emulated:
name: "linux | arm64 emulated"
runs-on: ubuntu-latest
steps:
- name: Unit testing
Expand Down Expand Up @@ -183,7 +191,7 @@ jobs:
- name: Generate JUnit test report
run: |
go-junit-report -set-exit-code -in ${PWD}/artifacts/cpackgettests-linux-arm64.txt -iocopy -out ./cpackget-testreport-linux-arm64.xml

- name: Archive unit test results
uses: actions/upload-artifact@v4
with:
Expand Down
Loading