Skip to content

gha: add codecov

gha: add codecov #629

Workflow file for this run

on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.18.x, 1.22.x, 1.23.x]
platform: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-latest, macos-13, macos-14]
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
# Disable caching as we don't have top-level go.sum needed for
# the cache key, and specifying multiple go.sums is not trivial
# (see https://github.com/moby/sys/pull/160 for details).
cache: false
- name: Set PACKAGES env
if: ${{ matrix.go-version == '1.18.x' }}
run: |
# This corresponds with the list in Makefile:1, but omits the "userns"
# and "capability" modules, which require go1.21 as minimum.
echo 'PACKAGES=mountinfo mount reexec sequential signal symlink user' >> $GITHUB_ENV
- name: go mod tidy
run: |
make foreach CMD="go mod tidy"
git diff --exit-code
- name: go fix
run: |
make foreach CMD="go fix"
git diff --exit-code
- name: Lint
run: make lint
- name: Cross build
if: ${{ runner.os == 'Linux' }}
run: make cross
- name: Test
run: |
uname -a
make test
- name: Send to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }} # used to upload coverage reports: https://github.com/moby/buildkit/pull/4660#issue-2142122533
files: capability/coverage.txt,mount/coverage.txt,mountinfo/coverage.txt,reexec/coverage.txt,sequential/coverage.txt,signal/coverage.txt,symlink/coverage.txt,user/coverage.txt,userns/coverage.txt
codespell:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: pip install --break-system-packages codespell==v2.3.0
- run: codespell