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

Breakout unit testing per OS. Issue: #353 #354

Merged
merged 13 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from 11 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
57 changes: 57 additions & 0 deletions .github/workflows/build-test-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: build-and-test-linux
khanhntd marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches: [master, main]

paths-ignore:
- '**.md'
- '.github/**'
- '!.github/workflows/build-*'


pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
linux-unittest:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ~1.15.15

- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'true'

- name: Debug go.mod
khanhntd marked this conversation as resolved.
Show resolved Hide resolved
run: cat go.mod

- name: Cache build output
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Test
run: make test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
verbose: true

- name: Build
run: make build
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: build-and-test
name: build-and-test-macos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need one workflow that uploads test coverage. Can you remove the upload step from this workflow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ok now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can remember, we do need coverage uploads for each OS because some tests don't run on every runner

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no conflict/overriding that happens when we have multiple coverages being published for the same PR? I'll have to look into that again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read up on Codecov and there's no issue: https://docs.codecov.com/docs/merging-reports We should upload coverage from all of the workflows


on:
push:
branches:
- master
branches: [master, main]

paths-ignore:
- '**.md'
Expand All @@ -20,34 +19,14 @@ concurrency:
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
cachepath: |
~/.cache/go-build
~/go/pkg/mod
/home/runner/.cache/go-build
- os: macos-latest
cachepath: |
~/Library/Caches/go-build
~/go/pkg/mod
/Users/runner/Library/Caches/go-build
macos-unittest:
runs-on: macos-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ~1.15.15
id: go

- name: Configure git with longpath enabled (for windows)
run: git config --global core.longpaths true

- name: Check out code
uses: actions/checkout@v2
Expand All @@ -61,10 +40,10 @@ jobs:
- name: Cache build output
uses: actions/cache@v2
with:
path: ${{ matrix.cachepath }}
path: |
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Test
run: make test
Expand All @@ -75,4 +54,4 @@ jobs:
verbose: true

- name: Build
run: make build
run: make build
16 changes: 12 additions & 4 deletions .github/workflows/build-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ jobs:
path: |
%LocalAppData%\go-build
~/go/pkg/mod
C:\Users\runneradmin\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Install make
run: choco install make

- name: Run Unit tests
run: go test ./...
run: make test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
verbose: true

- name: Run build
run: make build