github.com/itchyny/rassemble-go@v0.1.1/.github/workflows/ci.yaml (about)

     1  name: CI
     2  
     3  on:
     4    push:
     5      branches:
     6        - main
     7      tags:
     8        - v*
     9    pull_request:
    10  
    11  permissions:
    12    contents: read
    13  
    14  jobs:
    15    build:
    16      name: Build
    17      runs-on: ubuntu-latest
    18      steps:
    19        - name: Checkout code
    20          uses: actions/checkout@v4
    21        - name: Setup Go
    22          uses: actions/setup-go@v5
    23          with:
    24            go-version: 1.x
    25        - name: Build
    26          run: make build
    27        - name: Run command
    28          run: ./rassemble abcd abd acd ad | grep '^ab?c?d$'
    29        - name: Cross build
    30          run: make cross
    31        - name: Upload artifact
    32          uses: actions/upload-artifact@v4
    33          with:
    34            name: goxz
    35            path: goxz
    36        - name: Clean
    37          run: make clean
    38  
    39    test:
    40      name: Test
    41      runs-on: ubuntu-latest
    42      steps:
    43        - name: Checkout code
    44          uses: actions/checkout@v4
    45        - name: Setup Go
    46          uses: actions/setup-go@v5
    47          with:
    48            go-version: 1.x
    49        - name: Test
    50          run: make test
    51        - name: Test Coverage
    52          run: |
    53            go test -cover ./... | grep -F 100.0% || {
    54              go test -cover ./...
    55              echo Coverage decreased!
    56              exit 1
    57            } >&2
    58        - name: Lint
    59          run: make lint
    60  
    61    release:
    62      name: Release
    63      needs: [build, test]
    64      if: startsWith(github.ref, 'refs/tags/v')
    65      permissions:
    66        contents: write
    67      runs-on: ubuntu-latest
    68      steps:
    69        - name: Download artifacts
    70          uses: actions/download-artifact@v4
    71          with:
    72            name: goxz
    73            path: goxz
    74        - name: Create release
    75          uses: ncipollo/release-action@v1
    76          with:
    77            name: Release ${{ github.ref_name }}
    78            artifacts: goxz/*