| 1 |
on: [push, pull_request] |
| 2 |
name: Test |
| 3 |
jobs: |
| 4 |
test: |
| 5 |
strategy: |
| 6 |
matrix: |
| 7 |
go-version: [1.18.x, oldstable, stable] |
| 8 |
platform: [ubuntu-22.04, ubuntu-24.04, windows-latest, macos-13, macos-14, macos-15] |
| 9 |
runs-on: ${{ matrix.platform }} |
| 10 |
defaults: |
| 11 |
run: |
| 12 |
shell: bash |
| 13 |
steps: |
| 14 |
- name: Checkout code |
| 15 |
uses: actions/checkout@v4 |
| 16 |
- name: Install Go |
| 17 |
uses: actions/setup-go@v5 |
| 18 |
with: |
| 19 |
go-version: ${{ matrix.go-version }} |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
cache: false |
| 24 |
- name: Install golangci-lint |
| 25 |
uses: golangci/golangci-lint-action@v8 |
| 26 |
with: |
| 27 |
version: v2.4 |
| 28 |
|
| 29 |
|
| 30 |
working-directory: ./mountinfo |
| 31 |
- name: Set PACKAGES env |
| 32 |
if: ${{ matrix.go-version == '1.18.x' }} |
| 33 |
run: | |
| 34 |
# Check if the module supports this version of Go. |
| 35 |
go_version="$(go env GOVERSION)" |
| 36 |
go_version="${go_version#go}" |
| 37 |
|
| 38 |
packages="" |
| 39 |
for p in */; do |
| 40 |
[ -f "$p/go.mod" ] || continue |
| 41 |
if ! (cd "$p" && go list -m -f "{{if gt .GoVersion \"$go_version\"}}ko{{end}}" | grep -q ko); then |
| 42 |
packages+="${p%/} " |
| 43 |
else |
| 44 |
echo "::notice::SKIP: github.com/moby/sys/${p%/} requires a more recent version of Go" |
| 45 |
fi |
| 46 |
done |
| 47 |
|
| 48 |
echo "PACKAGES=${packages}" >> "$GITHUB_ENV" |
| 49 |
- name: go mod tidy |
| 50 |
run: | |
| 51 |
make foreach CMD="go mod tidy" |
| 52 |
git diff --exit-code |
| 53 |
- name: go fix |
| 54 |
run: | |
| 55 |
make foreach CMD="go fix" |
| 56 |
git diff --exit-code |
| 57 |
- name: Lint |
| 58 |
run: make lint |
| 59 |
- name: Cross build |
| 60 |
if: ${{ runner.os == 'Linux' }} |
| 61 |
run: make cross |
| 62 |
- name: Test |
| 63 |
run: | |
| 64 |
uname -a |
| 65 |
make test |
| 66 |
- name: Send to Codecov |
| 67 |
uses: codecov/codecov-action@v5 |
| 68 |
with: |
| 69 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 70 |
|
| 71 |
codespell: |
| 72 |
runs-on: ubuntu-24.04 |
| 73 |
steps: |
| 74 |
- uses: actions/checkout@v4 |
| 75 |
- run: pip install --break-system-packages codespell==v2.3.0 |
| 76 |
- run: codespell |