# Copyright 2025 The go-yaml Project Contributors # SPDX-License-Identifier: Apache-2.0 name: Go on: push: branches: [ main, v3, v2, v1 ] pull_request: branches: [ main, v3, v2, v1 ] permissions: read-all jobs: test: runs-on: ubuntu-latest needs: go-versions continue-on-error: true # make sure to run all versions, even if one fails strategy: fail-fast: false matrix: go-version: ${{ fromJSON(needs.go-versions.outputs.versions) }} steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: {persist-credentials: false} - name: Run all unit tests w/ -cover, all YTS tests and go lint run: make test lint v=1 cover=1 GO-VERSION=${{ matrix.go-version }} test-cross-platform: name: Test on ${{ matrix.GOOS }}/${{ matrix.GOARCH }} runs-on: ${{ matrix.os }} continue-on-error: true # make sure to run all platforms, even if one fails strategy: fail-fast: false matrix: include: - os: macos-latest GOOS: darwin GOARCH: amd64 test-args: -race - os: macos-latest GOOS: darwin GOARCH: arm64 test-args: -race - os: windows-latest GOOS: windows GOARCH: amd64 test-args: -race - os: ubuntu-latest GOOS: linux GOARCH: 386 test-args: '' # race is not available on 32 bits architecture - os: windows-latest GOOS: windows GOARCH: 386 test-args: '' # race is not available on 32 bits architecture env: GOARCH: ${{ matrix.GOARCH }} GOOS: ${{ matrix.GOOS }} steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: {persist-credentials: false} - name: Run tests run: | bash -c 'echo + $OSTYPE + $MACHTYPE +' make test-main test-internal v=1 o=${{ matrix.test-args }} go-versions: name: Lookup Go versions runs-on: ubuntu-latest outputs: versions: ${{ steps.latest-patch-versions.outputs.matrix }} steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - name: Get latest patch for each minor version # yamllint disable-line rule:line-length uses: arnested/go-version-action@6343454db06c63467680c5dc1f4f382fe9fe6303 # v2.1.2 id: latest-patch-versions with: latest-patches-only: true patch-level: true