Skip to content

Commit

Permalink
Switched to matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
matteosz committed May 24, 2024
1 parent 1f8934d commit 39d4745
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 144 deletions.
116 changes: 46 additions & 70 deletions .github/workflows/test_on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,67 +29,74 @@ jobs:
echo "::error:: Could not start CI tests due to missing *safe PR* label."
exit 1
test-mac:
test:
needs: permission
runs-on: macos-latest
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
size: ['64b', '32b']
golang: ['1.18', '1.22']
exclude:
- os: windows-latest
size: '32b'
- os: macos-latest
size: '32b'

runs-on: ${{matrix.os}}
env:
DBGSYNCLOG: trace
DBGSYNCON: true

steps:
- name: Set up Go ^1.13
- name: Matrix is ${{matrix.os}} / ${{matrix.size}} - Go is ${{matrix.golang}}
run: date

- name: Set up Go ^${{matrix.golang}}
uses: actions/setup-go@v3
with:
go-version: ^1.13
go-version: ^${{matrix.golang}}

- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Test without coverage
run: make test

test-windows:
needs: permission
runs-on: windows-latest
env:
DBGSYNCLOG: trace
DBGSYNCON: true
steps:
- name: Set up Go ^1.13
uses: actions/setup-go@v3
- name: Setup Alpine Linux ${{matrix.size}}
uses: jirutka/setup-alpine@v1
if: ${{ matrix.size == '32b' }}
with:
go-version: ^1.13
arch: x86
packages: >
go
make
git
gcc
musl-dev
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: getconf x86
if: ${{ matrix.size == '32b' }}
run: getconf LONG_BIT
shell: alpine.sh {0}

- name: Test without coverage
run: make test
- name: getconf x64
run: getconf LONG_BIT

test-ubuntu:
needs: permission
runs-on: ubuntu-latest
env:
DBGSYNCLOG: trace
DBGSYNCON: true
steps:
- name: Set up Go ^1.13
uses: actions/setup-go@v3
with:
go-version: ^1.13
- name: Test without coverage (Windows, MacOS)
if: ${{matrix.os == 'macos-latest' || matrix.os == 'windows-latest'}}
run: make test

- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Test without coverage (Ubuntu x86)
if: ${{matrix.os == 'ubuntu-latest' && matrix.size == '32b'}}
run: make test
shell: alpine.sh {0}

- name: Test with coverage
if: ${{matrix.platform == 'ubuntu-latest' && matrix.size == '64b'}}
run: make coverage

- name: SonarCloud scan
if: ${{matrix.platform == 'ubuntu-latest' && matrix.size == '64b'}}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -105,35 +112,4 @@ jobs:
-Dsonar.pullrequest.base=${{ github.event.pull_request.base }}
-Dsonar.c.file.suffixes=-
-Dsonar.cpp.file.suffixes=-
-Dsonar.objc.file.suffixes=-
test-ubuntu-x86:
needs: permission
runs-on: ubuntu-latest
env:
DBGSYNCLOG: trace
DBGSYNCON: true
steps:
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
with:
arch: x86
packages: >
go
make
git
gcc
musl-dev
- name: Set up Go ^1.13 for x86
uses: actions/setup-go@v3
with:
go-version: ^1.13

- name: Check out code into the Go module directory for x86
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Test without coverage for x86
run: make test
-Dsonar.objc.file.suffixes=-
120 changes: 46 additions & 74 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,70 +5,73 @@ on:
branches: [ master ]

jobs:
test-mac:
needs: permission
runs-on: macos-latest
test_and_coverage:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
size: ['64b', '32b']
golang: ['1.18', '1.22']
exclude:
- os: windows-latest
size: '32b'
- os: macos-latest
size: '32b'

runs-on: ${{matrix.os}}
env:
DBGSYNCLOG: trace
DBGSYNCON: true

steps:
- name: Set up Go ^1.13
- name: Matrix is ${{matrix.os}} / ${{matrix.size}} - Go is ${{matrix.golang}}
run: date

- name: Set up Go ^${{matrix.golang}}
uses: actions/setup-go@v3
with:
go-version: ^1.13
go-version: ^${{matrix.golang}}

- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Test without coverage
run: make test

test-windows:
needs: permission
runs-on: windows-latest
env:
DBGSYNCLOG: trace
DBGSYNCON: true
steps:
- name: Set up Go ^1.13
uses: actions/setup-go@v3
- name: Setup Alpine Linux ${{matrix.size}}
uses: jirutka/setup-alpine@v1
if: ${{ matrix.size == '32b' }}
with:
go-version: ^1.13
arch: x86
packages: >
go
make
git
gcc
musl-dev
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: getconf x86
if: ${{ matrix.size == '32b' }}
run: getconf LONG_BIT
shell: alpine.sh {0}

- name: Test without coverage
run: make test
- name: getconf x64
run: getconf LONG_BIT

test-ubuntu:
needs: permission
runs-on: ubuntu-latest
env:
DBGSYNCLOG: trace
DBGSYNCON: true
steps:
- name: Set up Go ^1.13
uses: actions/setup-go@v3
with:
go-version: ^1.13
- name: Test without coverage (Windows, MacOS)
if: ${{matrix.os == 'macos-latest' || matrix.os == 'windows-latest'}}
run: make test

- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Test without coverage (Ubuntu x86)
if: ${{matrix.os == 'ubuntu-latest' && matrix.size == '32b'}}
run: make test
shell: alpine.sh {0}

- name: Test with coverage
if: ${{matrix.platform == 'ubuntu-latest' && matrix.size == '64b'}}
run: make coverage

- name: SonarCloud scan
if: ${{matrix.platform == 'ubuntu-latest' && matrix.size == '64b'}}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -87,38 +90,7 @@ jobs:
-Dsonar.objc.file.suffixes=-
- name: Send coverage
if: ${{matrix.platform == 'ubuntu-latest' && matrix.size == '64b'}}
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov

test-ubuntu-x86:
needs: permission
runs-on: ubuntu-latest
env:
DBGSYNCLOG: trace
DBGSYNCON: true
steps:
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
with:
arch: x86
packages: >
go
make
git
gcc
musl-dev
- name: Set up Go ^1.13 for x86
uses: actions/setup-go@v3
with:
go-version: ^1.13

- name: Check out code into the Go module directory for x86
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Test without coverage for x86
run: make test
path-to-profile: profile.cov

0 comments on commit 39d4745

Please sign in to comment.