name: Build (Linux)

on:
  pull_request:
    branches:
    - master

# This ensures that previous jobs for the PR are canceled when the PR is
# updated.
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref }}
  cancel-in-progress: true

jobs:
  build:
    name: Test on Go ${{ matrix.go-version }} and ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        go-version: [1.25.x, 1.26.x]
        os: [ubuntu-latest]
    steps:
      - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
        uses: actions/setup-go@v5
        with:
          go-version: ${{ matrix.go-version }}
        id: go

      - name: Check out code into the Go module directory
        uses: actions/checkout@v4

      - name: Build on ${{ matrix.os }}
        env:
          MINT_MODE: full
          SERVER_ENDPOINT: localhost:9000
          ACCESS_KEY: minioadmin
          SECRET_KEY: minioadmin
          ENABLE_HTTPS: 1
          MINIO_KMS_SECRET_KEY: my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=
          SSL_CERT_FILE: /tmp/certs-dir/public.crt
          MINIO_CI_CD: true
          MINT_NO_FULL_OBJECT: true
        run: |
          sudo apt update -y
          sudo apt install devscripts -y
          wget -O /tmp/minio https://dl.minio.io/server/minio/release/linux-amd64/minio
          chmod +x /tmp/minio
          mkdir -p /tmp/certs-dir
          cp testcerts/* /tmp/certs-dir
          /tmp/minio server --quiet -S /tmp/certs-dir /tmp/fs{1...4} &
          make
