github.com/daixiang0/gci@v0.13.0/.github/workflows/gci.yml (about)

     1  name: gci
     2  
     3  on:
     4    pull_request:
     5  
     6  jobs:
     7    build:
     8      name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries
     9      runs-on: ${{ matrix.os }}
    10      env:
    11        GOVER: 1.18
    12        GOOS: ${{ matrix.target_os }}
    13        GOARCH: ${{ matrix.target_arch }}
    14        GOPROXY: https://proxy.golang.org
    15        ARCHIVE_OUTDIR: dist/archives
    16        TEST_OUTPUT_FILE_PREFIX: test_report
    17      strategy:
    18        matrix:
    19          os: [ubuntu-latest, windows-2019, macOS-latest]
    20          target_arch: [arm, arm64, amd64]
    21          include:
    22            - os: ubuntu-latest
    23              target_os: linux
    24            - os: windows-2019
    25              target_os: windows
    26            - os: macOS-latest
    27              target_os: darwin
    28          exclude:
    29            - os: windows-2019
    30              target_arch: arm
    31            - os: windows-2019
    32              target_arch: arm64
    33            - os: macOS-latest
    34              target_arch: arm
    35      steps:
    36        - name: Set up Go ${{ env.GOVER }}
    37          uses: actions/setup-go@v2
    38          with:
    39            go-version: ${{ env.GOVER }}
    40        - name: Check out code into the Go module directory
    41          uses: actions/checkout@v2
    42        - name: Cache Go modules (Linux)
    43          if: matrix.target_os == 'linux'
    44          uses: actions/cache@v3
    45          with:
    46            path: |
    47              ~/.cache/go-build
    48              ~/go/pkg/mod
    49            key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-${{ hashFiles('**/go.sum') }}
    50            restore-keys: |
    51              ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-
    52        - name: Cache Go modules (Windows)
    53          if: matrix.target_os == 'windows'
    54          uses: actions/cache@v3
    55          with:
    56            path: |
    57              ~\AppData\Local\go-build
    58              ~\go\pkg\mod
    59            key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-${{ hashFiles('**/go.sum') }}
    60            restore-keys: |
    61              ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-
    62        - name: Cache Go modules (macOS)
    63          if: matrix.target_os == 'darwin'
    64          uses: actions/cache@v3
    65          with:
    66            path: |
    67              ~/Library/Caches/go-build
    68              ~/go/pkg/mod
    69            key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-${{ hashFiles('**/go.sum') }}
    70            restore-keys: |
    71              ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-
    72        - name: golangci-lint
    73          if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux'
    74          uses: golangci/golangci-lint-action@v3.2.0
    75          with:
    76            version: ${{ env.GOLANGCILINT_VER }}
    77        - name: Run make test
    78          env:
    79            COVERAGE_OPTS: "-coverprofile=coverage.txt -covermode=atomic"
    80          if: matrix.target_arch == 'amd64'
    81          run: make test
    82