Use nhatthm/gh-actions
#218
Workflow file for this run
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
name: test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
go-latest-version: ${{ steps.find-go-version.outputs.go-latest-version }} | |
go-supported-versions: ${{ steps.find-go-version.outputs.go-supported-versions }} | |
steps: | |
- name: Checkout code | |
uses: nhatthm/gh-actions/checkout@master | |
- id: find-go-version | |
name: Find Go version | |
uses: nhatthm/gh-actions/find-go-version@master | |
test-macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: ${{ fromJson(needs.setup.outputs.go-supported-versions) }} | |
runs-on: macos-latest | |
needs: [setup] | |
env: | |
GO_LATEST_VERSION: ${{ needs.setup.outputs.go-latest-version }} | |
steps: | |
- name: Checkout code | |
uses: nhatthm/gh-actions/checkout@master | |
- name: Install Go | |
uses: nhatthm/gh-actions/setup-go@master | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Test | |
run: | | |
make test | |
- name: Upload code coverage (unit) | |
if: matrix.go-version == env.GO_LATEST_VERSION | |
uses: nhatthm/gh-actions/codecov@master | |
with: | |
files: ./unit.coverprofile | |
flags: unittests-${{ runner.os }} | |
- name: Upload code coverage (features) | |
if: matrix.go-version == env.GO_LATEST_VERSION | |
uses: nhatthm/gh-actions/codecov@master | |
with: | |
files: ./features.coverprofile | |
flags: featurestests-${{ runner.os }} | |
test-linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: ${{ fromJson(needs.setup.outputs.go-supported-versions) }} | |
runs-on: ubuntu-latest | |
needs: [setup] | |
env: | |
GO_LATEST_VERSION: ${{ needs.setup.outputs.go-latest-version }} | |
container: | |
image: nhatthm/ubuntu-keyring:20.04 | |
options: --privileged | |
steps: | |
- name: Checkout code | |
uses: nhatthm/gh-actions/checkout@master | |
- name: Install Go | |
uses: nhatthm/gh-actions/setup-go@master | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Test | |
run: | | |
mkdir -p /github/home/.cache/ | |
mkdir -p /github/home/.local/share/keyrings/ | |
chmod 700 -R /github/home/.local/ | |
echo 'somecredstorepass' | gnome-keyring-daemon --unlock | |
make test | |
shell: dbus-run-session -- bash --noprofile --norc -eo pipefail {0} | |
- name: Upload code coverage (unit) | |
if: matrix.go-version == env.GO_LATEST_VERSION | |
uses: nhatthm/gh-actions/codecov@master | |
with: | |
files: ./unit.coverprofile | |
flags: unittests-${{ runner.os }} | |
- name: Upload code coverage (features) | |
if: matrix.go-version == env.GO_LATEST_VERSION | |
uses: nhatthm/gh-actions/codecov@master | |
with: | |
files: ./features.coverprofile | |
flags: featurestests-${{ runner.os }} |