github.com/yggdrasil-network/yggdrasil-go@v0.5.6/.github/workflows/ci.yml (about)

     1  name: Yggdrasil
     2  
     3  on:
     4    push:
     5    pull_request:
     6    release:
     7    workflow_dispatch:
     8  
     9  concurrency:
    10    group: ${{ github.workflow }}-${{ github.ref }}
    11    cancel-in-progress: true
    12  
    13  jobs:
    14    lint:
    15      name: Lint
    16      runs-on: ubuntu-latest
    17      steps:
    18        - uses: actions/setup-go@v5
    19          with:
    20            go-version: 1.21
    21        - uses: actions/checkout@v4
    22        - name: golangci-lint
    23          uses: golangci/golangci-lint-action@v3
    24          with:
    25            args: --issues-exit-code=1
    26  
    27    codeql:
    28      name: Analyse
    29      runs-on: ubuntu-latest
    30      permissions:
    31        actions: read
    32        contents: read
    33        security-events: write
    34  
    35      steps:
    36        - name: Checkout repository
    37          uses: actions/checkout@v4
    38  
    39        - name: Initialize CodeQL
    40          uses: github/codeql-action/init@v2
    41          with:
    42            languages: go
    43  
    44        - name: Autobuild
    45          uses: github/codeql-action/autobuild@v2
    46  
    47        - name: Perform CodeQL Analysis
    48          uses: github/codeql-action/analyze@v2
    49  
    50    build-linux:
    51      strategy:
    52        fail-fast: false
    53        matrix:
    54          goversion: ["1.21", "1.22"]
    55  
    56      name: Build & Test (Linux, Go ${{ matrix.goversion }})
    57      needs: [lint]
    58  
    59      runs-on: ubuntu-latest
    60      steps:
    61        - uses: actions/checkout@v4
    62  
    63        - name: Set up Go
    64          uses: actions/setup-go@v5
    65          with:
    66            go-version: ${{ matrix.goversion }}
    67  
    68        - name: Build Yggdrasil
    69          run: go build -v ./...
    70  
    71        - name: Unit tests
    72          run: go test -v ./...
    73  
    74    build-windows:
    75      strategy:
    76        fail-fast: false
    77        matrix:
    78          goversion: ["1.21", "1.22"]
    79  
    80      name: Build & Test (Windows, Go ${{ matrix.goversion }})
    81      needs: [lint]
    82  
    83      runs-on: windows-latest
    84      steps:
    85        - uses: actions/checkout@v4
    86  
    87        - name: Set up Go
    88          uses: actions/setup-go@v5
    89          with:
    90            go-version: ${{ matrix.goversion }}
    91  
    92        - name: Build Yggdrasil
    93          run: go build -v ./...
    94  
    95        - name: Unit tests
    96          run: go test -v ./...
    97  
    98    build-macos:
    99      strategy:
   100        fail-fast: false
   101        matrix:
   102          goversion: ["1.21", "1.22"]
   103  
   104      name: Build & Test (macOS, Go ${{ matrix.goversion }})
   105      needs: [lint]
   106  
   107      runs-on: macos-latest
   108      steps:
   109        - uses: actions/checkout@v4
   110  
   111        - name: Set up Go
   112          uses: actions/setup-go@v5
   113          with:
   114            go-version: ${{ matrix.goversion }}
   115  
   116        - name: Build Yggdrasil
   117          run: go build -v ./...
   118  
   119        - name: Unit tests
   120          run: go test -v ./...
   121  
   122    build-freebsd:
   123      strategy:
   124        fail-fast: false
   125        matrix:
   126          goversion: ["1.21", "1.22"]
   127          goos:
   128            - freebsd
   129            - openbsd
   130  
   131      name: Build (Cross ${{ matrix.goos }}, Go ${{ matrix.goversion }})
   132      needs: [lint]
   133  
   134      runs-on: ubuntu-latest
   135      steps:
   136        - uses: actions/checkout@v4
   137  
   138        - name: Set up Go
   139          uses: actions/setup-go@v5
   140          with:
   141            go-version: ${{ matrix.goversion }}
   142  
   143        - name: Build Yggdrasil
   144          run: go build -v ./...
   145          env:
   146            GOOS: ${{ matrix.goos }}
   147  
   148    tests-ok:
   149      name: All tests passed
   150      needs: [lint, codeql, build-linux, build-windows, build-macos]
   151      runs-on: ubuntu-latest
   152      if: ${{ !cancelled() }}
   153      steps:
   154        - name: Check all tests passed
   155          uses: re-actors/alls-green@release/v1
   156          with:
   157            jobs: ${{ toJSON(needs) }}