github.com/mackerelio/mackerel-agent-plugins@v0.89.3/.github/workflows/test.yml (about)

     1  ---
     2  name: test
     3  
     4  on:
     5    push:
     6      branches:
     7        - master
     8      tags:
     9        - v*
    10    pull_request:
    11  env:
    12    DEBIAN_FRONTEND: noninteractive
    13  jobs:
    14    lint:
    15      uses: mackerelio/workflows/.github/workflows/go-lint.yml@52736435ff08612880b76fd6618ca82ae7bba420 # v1.8.0
    16      with:
    17        os-versions: '["ubuntu-latest", "windows-2025"]'
    18    test:
    19      uses: mackerelio/workflows/.github/workflows/go-test.yml@52736435ff08612880b76fd6618ca82ae7bba420 # v1.8.0
    20      with:
    21        os-versions: '["ubuntu-latest", "windows-2025"]'
    22        pre: |
    23          echo "GOTOOLCHAIN=auto" >> $GITHUB_ENV
    24    integration-test-linux:
    25      uses: mackerelio/workflows/.github/workflows/setup-go-matrix.yml@52736435ff08612880b76fd6618ca82ae7bba420 # v1.8.0
    26      with:
    27        os-versions: '["ubuntu-latest"]'
    28        run: |
    29          export GOTOOLCHAIN=auto
    30          make testconvention
    31          ./test.bash
    32    integration-test-windows:
    33      uses: mackerelio/workflows/.github/workflows/setup-go-matrix.yml@52736435ff08612880b76fd6618ca82ae7bba420 # v1.8.0
    34      with:
    35        os-versions: '["windows-2025"]'
    36        run: |
    37          export GOTOOLCHAIN=auto
    38          go build -o mackerel-plugin-mssql/mackerel-plugin-mssql.exe ./mackerel-plugin-mssql
    39          go build -o mackerel-plugin-windows-server-sessions/mackerel-plugin-windows-server-sessions.exe ./mackerel-plugin-windows-server-sessions
    40    build:
    41      needs: [test, integration-test-linux]
    42      runs-on: ubuntu-latest
    43      if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
    44      steps:
    45        - run: |
    46            sudo apt-get update
    47            sudo apt-get install -y rpm devscripts debhelper fakeroot crossbuild-essential-arm64 build-essential
    48            mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
    49        - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
    50          with:
    51            fetch-depth: 0
    52        - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
    53          with:
    54            go-version: 1.24.x
    55        - run: make clean rpm deb tar
    56        - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
    57          with:
    58            name: linux-build-artifacts
    59            path: |
    60              ~/rpmbuild/RPMS/*/*.rpm
    61              packaging/*.deb
    62              packaging/tar/build/*.tar.gz
    63  
    64    release:
    65      needs: build
    66      runs-on: ubuntu-latest
    67      if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
    68      steps:
    69        - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
    70          with:
    71            name: linux-build-artifacts
    72            path: artifacts/
    73        - uses: mackerelio/staging-release-update-action@bc0e3a9f7bd0d890dc044592a798bc307bacc956 # v0.0.1
    74          if: github.ref == 'refs/heads/master'
    75          with:
    76            directory: artifacts/
    77            github-token: ${{ secrets.GITHUB_TOKEN }}
    78            tag: staging
    79        - uses: mackerelio/create-release-action@5af34070474b72efdb3f5057e50d2f3836453c56 # v0.0.4
    80          if: startsWith(github.ref, 'refs/tags/v')
    81          with:
    82            directory: artifacts/
    83            github-token: ${{ secrets.GITHUB_TOKEN }}
    84            tag-prefix: "refs/tags/v"
    85            bump-up-branch-prefix: "bump-version-"
    86        - uses: 8398a7/action-slack@77eaa4f1c608a7d68b38af4e3f739dcd8cba273e # v3.19.0
    87          with:
    88            status: ${{ job.status }}
    89            fields: repo,message,commit,action,eventName,ref,workflow,job,took
    90            username: mackerel-agent-plugins-release
    91          env:
    92            SLACK_WEBHOOK_URL: ${{ secrets.MACKEREL_SLACK_WEBHOOK_URL }}