git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/cobra/.github/workflows/test.yml (about)

     1  name: Test
     2  
     3  on:
     4    push:
     5    pull_request:
     6    workflow_dispatch:
     7  
     8  env:
     9    GO111MODULE: on
    10  
    11  permissions:
    12    contents: read
    13  
    14  jobs:
    15  
    16  
    17    lic-headers:
    18      runs-on: ubuntu-latest
    19      steps:
    20  
    21        - uses: actions/checkout@v3
    22  
    23        - run: >-
    24            docker run
    25            -v $(pwd):/wrk -w /wrk
    26            ghcr.io/google/addlicense
    27            -c 'The Cobra Authors'
    28            -y '2013-2022'
    29            -l apache
    30            -ignore '.github/**'
    31            -check
    32            .
    33  
    34  
    35    golangci-lint:
    36      permissions:
    37        contents: read  # for actions/checkout to fetch code
    38        pull-requests: read  # for golangci/golangci-lint-action to fetch pull requests
    39      runs-on: ubuntu-latest
    40      steps:
    41  
    42        - uses: actions/checkout@v3
    43  
    44        - uses: actions/setup-go@v3
    45          with:
    46            go-version: '^1.19'
    47            check-latest: true
    48            cache: true
    49  
    50        - uses: actions/checkout@v3
    51  
    52        - uses: golangci/golangci-lint-action@v3.2.0
    53          with:
    54            version: latest
    55            args: --verbose
    56  
    57  
    58    test-unix:
    59      strategy:
    60        fail-fast: false
    61        matrix:
    62          platform:
    63          - ubuntu
    64          - macOS
    65          go:
    66          - 15
    67          - 16
    68          - 17
    69          - 18
    70          - 19
    71      name: '${{ matrix.platform }} | 1.${{ matrix.go }}.x'
    72      runs-on: ${{ matrix.platform }}-latest
    73      steps:
    74  
    75      - uses: actions/checkout@v3
    76  
    77      - uses: actions/setup-go@v3
    78        with:
    79          go-version: 1.${{ matrix.go }}.x
    80          cache: true
    81  
    82      - run: |
    83          export GOBIN=$HOME/go/bin
    84          case "${{ matrix.go }}" in
    85            14|15) _version='';;
    86            *) _version='@latest';;
    87          esac
    88          go install github.com/kyoh86/richgo"${_version}"
    89          go install github.com/mitchellh/gox"${_version}"
    90  
    91      - run: RICHGO_FORCE_COLOR=1 PATH=$HOME/go/bin/:$PATH make test
    92  
    93  
    94    test-win:
    95      name: MINGW64
    96      defaults:
    97        run:
    98          shell: msys2 {0}
    99      runs-on: windows-latest
   100      steps:
   101  
   102      - shell: bash
   103        run: git config --global core.autocrlf input
   104  
   105      - uses: msys2/setup-msys2@v2
   106        with:
   107          msystem: MINGW64
   108          update: true
   109          install: >
   110            git
   111            make
   112            unzip
   113            mingw-w64-x86_64-go
   114  
   115      - uses: actions/checkout@v3
   116  
   117      - uses: actions/cache@v3
   118        with:
   119          path: ~/go/pkg/mod
   120          key: ${{ runner.os }}-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
   121          restore-keys: ${{ runner.os }}-${{ matrix.go }}-
   122  
   123      - run: |
   124          export GOBIN=$HOME/go/bin
   125          go install github.com/kyoh86/richgo@latest
   126          go install github.com/mitchellh/gox@latest
   127  
   128      - run: RICHGO_FORCE_COLOR=1 PATH=$HOME/go/bin:$PATH make test