github.com/mholt/caddy-l4@v0.0.0-20241104153248-ec8fae209322/.github/workflows/go.yml (about)

     1  # This workflow will build a golang project
     2  # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
     3  
     4  name: Go
     5  
     6  on:
     7    push:
     8      branches: [ "master" ]
     9    pull_request:
    10      branches: [ "master" ]
    11  
    12  jobs:
    13    build-test-check:
    14      runs-on: ${{ matrix.os }}
    15      strategy:
    16        # Default is true, cancels jobs for other platforms in the matrix if one fails
    17        fail-fast: false
    18        matrix:
    19          os: [macos-latest, windows-latest, ubuntu-latest]
    20          go-version:
    21            - "1.22"
    22            - "1.23"
    23  
    24          include:
    25            - os: ubuntu-latest
    26              urlTemplate: "https://github.com/caddyserver/xcaddy/releases/download/{{version}}/xcaddy_{{rawVersion}}_linux_amd64.tar.gz"
    27              name: "xcaddy"
    28              pathInArchive: "xcaddy"
    29  
    30            - os: "macos-latest"
    31              urlTemplate: "https://github.com/caddyserver/xcaddy/releases/download/{{version}}/xcaddy_{{rawVersion}}_mac_amd64.tar.gz"
    32              name: "xcaddy"
    33              pathInArchive: "xcaddy"
    34  
    35            - os: "windows-latest"
    36              urlTemplate: "https://github.com/caddyserver/xcaddy/releases/download/{{version}}/xcaddy_{{rawVersion}}_windows_amd64.zip"
    37              name: "xcaddy.exe"
    38              pathInArchive: "xcaddy.exe"
    39  
    40      steps:
    41      - uses: actions/checkout@v4
    42  
    43      - name: Set up Go
    44        uses: actions/setup-go@v5
    45        with:
    46          check-latest: true
    47          cache: true
    48          go-version: ${{ matrix.go-version }}
    49  
    50      - name: Set up xcaddy
    51        uses: engineerd/configurator@v0.0.10
    52        with:
    53          name: ${{ matrix.name }}
    54          pathInArchive: ${{ matrix.pathInArchive }}
    55          fromGitHubReleases: "true"
    56          repo: "caddyserver/xcaddy"
    57          version: "latest"
    58          urlTemplate: ${{ matrix.urlTemplate }}
    59          token: ${{ secrets.GITHUB_TOKEN }}
    60  
    61      - name: Build
    62        run: |
    63          xcaddy build master --output ${{ runner.temp }}/${{ matrix.name }} --with github.com/mholt/caddy-l4=./
    64          # smoking test
    65          echo ''
    66          echo '########'
    67          echo "# ${{ runner.temp }}/${{ matrix.name }} version"
    68          ${{ runner.temp }}/${{ matrix.name }} version
    69          echo '########'
    70          echo ''
    71          echo '########'
    72          echo "# ${{ runner.temp }}/${{ matrix.name }} list-modules"
    73          ${{ runner.temp }}/${{ matrix.name }} list-modules
    74          echo '########'
    75          echo ''
    76          echo '########'
    77          echo "# ${{ runner.temp }}/${{ matrix.name }} build-info"
    78          ${{ runner.temp }}/${{ matrix.name }} build-info
    79          echo '########'
    80  
    81      - name: Test
    82        run: |
    83          # TODO:
    84          # github.com/mholt/caddy-l4,
    85          # modules/l4echo,
    86          # modules/l4postgres,
    87          # modules/l4ssh,
    88          # modules/l4subroute,
    89          # modules/l4tee,
    90          # modules/l4throttle,
    91          # modules/l4tls,
    92          # modules/l4xmpp needs their test files.
    93  
    94          go test -v ./...