Credit card #90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will build a golang project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
| name: Go | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| # Restrict jobs in this workflow to have no permissions by default; permissions | |
| # should be granted per job as needed using a dedicated `permissions` block | |
| permissions: {} | |
| jobs: | |
| linelint: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: fernandrone/linelint@7907a5dca0c28ea7dd05c6d8d8cacded713aca11 # v0.0.6 | |
| filenames: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - run: | | |
| find . -mindepth 1 ! -regex '.*/[#@A-Za-z0-9._-]*' -print0 \ | |
| | xargs -0 -I{} bash -c \ | |
| 'printf "::error file=%q::This filename contains undesired characters\n" "$1" && false' _ {} | |
| tidy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.x | |
| - run: go mod tidy -diff | |
| lint: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| steps: | |
| # gofmt and goimports expect that files on Window use \r\n | |
| # so we need git to not automatically translate between \n | |
| - run: git config --global core.autocrlf false | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.x | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 | |
| with: | |
| version-file: .golangci-lint-version | |
| args: --timeout=5m | |
| tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.x | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: "23.x" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up protoc-gen-go | |
| run: go install google.golang.org/protobuf/cmd/protoc-gen-go | |
| - name: Build | |
| run: make | |
| - name: Test | |
| run: make test |