File: ci.yaml

package info (click to toggle)
golang-github-wader-gojq 0.0~git20230131.53cfdef-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 960 kB
  • sloc: yacc: 642; makefile: 89
file content (55 lines) | stat: -rw-r--r-- 1,515 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: CI

on:
  push:
    branches:
    - main
  pull_request:

jobs:
  test:
    name: Test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        go: [1.19.x, 1.18.x, 1.17.x]
    steps:
    - name: Checkout code
      uses: actions/checkout@v3
    - name: Setup Go
      uses: actions/setup-go@v3
      with:
        go-version: ${{ matrix.go }}
    - name: Test
      run: make test
    - name: Test with GOARCH=386
      run: env GOARCH=386 go test -v ./...
      if: matrix.os != 'macos-latest'
    - name: Lint
      run: make lint
    - name: Check tools
      run: make check-tools
    - name: Check go generate
      run: go generate && ! git diff | grep ^
      shell: bash
    - name: Check command examples in README.md
      run: |
        ./gojq -Rnr 'reduce inputs as $x (
          {};
          if $x|test("^ [$] .*gojq|^```")
          then
            if .command
            then .results += [{command: .command, output: .output}] | del(.command,.output)
            end | if $x|test("gojq") then .command = $x[3:] end
          elif .command then .output += ($x + "\n" | sub(" +#.*"; ""))
          end
        ) | .results[] |
          "if got=$(diff <(printf %s \(.output | @sh)) \\
            <(\(.command | gsub("gojq"; "./gojq")) 2>&1)); then
            echo ok: \(.command | @sh)
          else
            echo ng: \(.command | @sh); echo \"$got\"; exit 1
          fi"
        ' README.md | bash
      shell: bash