Skip to content

Logr Interoperability #57

Logr Interoperability

Logr Interoperability #57

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Tests
on:
push:
tags:
branches:
- main
pull_request:
branches:
# Declare default permissions as read only.
permissions: read-all
jobs:
build-and-test-individually:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.21' ]
go-module: [ '.', './otel', './examples']
defaults:
run:
working-directory: ${{ matrix.go-module }}
steps:
- uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }} ${{ matrix.go-module }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version ${{ matrix.go-version }} ${{ matrix.go-module }}
run: go version
- name: Install dependencies ${{ matrix.go-version }} ${{ matrix.go-module }}
run: |
go get -t -u golang.org/x/tools/cmd/cover
go mod download
- name: Build ${{ matrix.go-version }} ${{ matrix.go-module }}
run: go build -v ./...
- name: Test ${{ matrix.go-version }} ${{ matrix.go-module }}
run: go test -v ./...
# Build and Test as a workspace, create unified test coverage file
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.21' ]
steps:
- uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version ${{ matrix.go-version }}
run: go version
- name: Create workspace ${{ matrix.go-version }}
run: |
go work init .
go work use ./examples
go work use ./otel
- name: Install dependencies ${{ matrix.go-version }}
run: |
go get -t -u golang.org/x/tools/cmd/cover
go mod download
- name: Build ${{ matrix.go-version }}
run: go build -v ./... ./otel/... ./examples/...
- name: Test ${{ matrix.go-version }}
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... ./otel/... ./examples/...
- name: Upload coverage reports to Codecov ${{ matrix.go-version }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}