github.com/minio/mc@v0.0.0-20240503112107-b471de8d1882/.github/workflows/go.yml (about)

     1  name: Go
     2  
     3  on:
     4    pull_request:
     5      branches:
     6        - master
     7  
     8  # This ensures that previous jobs for the PR are canceled when the PR is
     9  # updated.
    10  concurrency:
    11    group: ${{ github.workflow }}-${{ github.head_ref }}
    12    cancel-in-progress: true
    13  
    14  jobs:
    15    build:
    16      name: Test on Go ${{ matrix.go-version }} and ${{ matrix.os }}
    17      runs-on: ${{ matrix.os }}
    18      env:
    19        GO111MODULE: on
    20      strategy:
    21        matrix:
    22          go-version: [1.21.x]
    23          os: [ubuntu-latest, macos-latest, windows-latest]
    24      steps:
    25        - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
    26          uses: actions/setup-go@v5
    27          with:
    28            go-version: ${{ matrix.go-version }}
    29          id: go
    30  
    31        - name: Check out code into the Go module directory
    32          uses: actions/checkout@v4
    33  
    34        - name: Build on ${{ matrix.os }}
    35          if: matrix.os == 'windows-latest'
    36          run: |
    37            go build --ldflags="-s -w" -o %GOPATH%\bin\mc.exe
    38            go test -v -race --timeout 30m ./...
    39        - name: Build on ${{ matrix.os }}
    40          if: matrix.os == 'macos-latest'
    41          run: |
    42            go build --ldflags="-s -w" -o %GOPATH%\bin\mc
    43            go test -v -race --timeout 30m ./...
    44        - name: Build on ${{ matrix.os }}
    45          if: matrix.os == 'ubuntu-latest'
    46          env:
    47            ACCESS_KEY: minioadmin
    48            SECRET_KEY: minioadmin
    49            ENABLE_HTTPS: 1
    50            MINIO_CI_CD: 1
    51            SERVER_ENDPOINT: localhost:9000
    52            MC_TEST_ENABLE_HTTPS: true
    53            MC_TEST_SKIP_INSECURE: true
    54            MC_TEST_SKIP_BUILD: true
    55          run: |
    56            wget https://dl.min.io/server/minio/release/linux-amd64/minio && chmod +x minio
    57            mkdir -p ~/.minio/certs/ && cp testdata/localhost.crt ~/.minio/certs/public.crt && cp testdata/localhost.key ~/.minio/certs/private.key
    58            sudo cp testdata/localhost.crt /usr/local/share/ca-certificates/ && sudo update-ca-certificates
    59            ./minio server /tmp/test-xl/{1...4}/ & sleep 10
    60            make
    61            make test-race
    62            make verify
    63            make crosscompile
    64    vetchecks: # Run vet checks against one version.
    65      env:
    66        CGO_ENABLED: 0
    67      runs-on: ubuntu-latest
    68      steps:
    69        - name: Set up Go
    70          uses: actions/setup-go@v2
    71          with:
    72            go-version: 1.21.x
    73  
    74        - name: Checkout code
    75          uses: actions/checkout@v2
    76  
    77        - name: Test 386
    78          run: GOOS=linux GOARCH=386 go test -short ./...
    79  
    80        - name: Staticcheck
    81          # Run with defaults, but allow errors with other formats ST1005
    82          run: go install honnef.co/go/tools/cmd/staticcheck@latest && make lint