Skip to content

Check code quality #715

Check code quality

Check code quality #715

Workflow file for this run

name: Check code quality
on:
push:
branches:
- main
merge_group:
pull_request:
branches:
- main
schedule:
- cron: '0 4 * * *'
permissions:
contents: read
# We don't want to cancel any redundant runs on main so we use run_id when head_ref is
# not available
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
code_quality_lint:
name: Code Quality, Lint - ${{ matrix.go }}
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
go: ['1.21', '1.22']
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
token: ${{ github.token }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: |
dataset-go/go.sum
opentelemetry-collector-contrib/go.sum
opentelemetry-collector-releases/go.sum
scalyr-opentelemetry-collector-contrib/go.sum
- name: Install Go Dev tools
run: |
./dataset-go/scripts/install-dev-tools.sh
- name: Install pre-commit
run: |
python -m pip install -U pip
python -m pip install pre-commit
- name: Install pre-commit hooks
run: |
pre-commit install
- name: Run pre-commit
run: |
pre-commit run -a
- name: Notify Slack on Failure
if: ${{ failure() && github.ref_name == 'main' }}
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#eng-dataset-o11y'
unit_tests:
name: OTel Unit Tests - ${{ matrix.go }}
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
go: ['1.21', '1.22']
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
token: ${{ github.token }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true
cache-dependency-path: |
dataset-go/go.sum
opentelemetry-collector-contrib/go.sum
opentelemetry-collector-releases/go.sum
scalyr-opentelemetry-collector-contrib/go.sum
- name: Install Go Dev tools
run: |
./dataset-go/scripts/install-dev-tools.sh
- name: OTel Unit Tests
run: |
make test
- name: Code Coverage
run: |
make coverage
- name: Upload coverage reports to Codecov
if: ${{ github.event_name != 'schedule' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./scalyr-opentelemetry-collector-contrib/exporter/datasetexporter/coverage.txt
fail_ci_if_error: true
verbose: true
- name: Notify Slack on Failure
if: ${{ failure() && github.ref_name == 'main' }}
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#eng-dataset-o11y'