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

permission should run on all platforms #478

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Changes from 1 commit
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
49 changes: 34 additions & 15 deletions .github/workflows/go_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ on:

jobs:
permission:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
Copy link
Contributor

Choose a reason for hiding this comment

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

won't this lead to 3 comments being added to the PR ?


runs-on: ${{matrix.platform}}

steps:
- name: Add comment if PR permission failed
if: ${{ !contains(github.event.pull_request.labels.*.name, 'safe PR') }}
Expand All @@ -28,13 +33,9 @@ jobs:
echo "::error:: Could not start CI tests due to missing *safe PR* label."
exit 1

test:
coverage:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe for clarity

Suggested change
coverage:
test_and_coverage:

needs: permission
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{matrix.platform}}
runs-on: ubuntu-latest

steps:
- name: Setup go ^1.13
Expand All @@ -48,16 +49,11 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Test without coverage
if: matrix.platform == 'macos-latest' || matrix.platform == 'windows-latest'
run: go test ./...

- name: Test with coverage
if: matrix.platform == 'ubuntu-latest'
# running 'go test' requires permission
run: go test -json -covermode=count -coverprofile=profile.cov ./... > report.json

- name: Sonarcloud scan
if: matrix.platform == 'ubuntu-latest'
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -76,15 +72,38 @@ jobs:
-Dsonar.pullrequest.base=${{ github.event.pull_request.base }}

- name: Send coverage
if: matrix.platform == 'ubuntu-latest'
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
parallel: true

test:
needs: permission
strategy:
matrix:
platform: [macos-latest, windows-latest]

runs-on: ${{matrix.platform}}

steps:
- name: Setup go ^1.13
uses: actions/setup-go@v3
with:
go-version: ^1.13

- 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
# running 'go test' requires permission
run: go test ./...

# notifies that all test jobs are finished.
finish:
needs: test
needs: [coverage, test]
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
Expand Down