|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + merge_group: |
| 7 | + |
| 8 | +# limit the access of the generated GITHUB_TOKEN |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + lint: |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [windows-2022, windows-latest] |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + # See https://github.com/actions/setup-go/pull/515 |
| 21 | + - uses: antontroshin/setup-go@bda02de8887c9946189f81e7e59512914aeb9ea4 |
| 22 | + with: |
| 23 | + go-version-file: go.mod |
| 24 | + cache: true |
| 25 | + - name: install mage |
| 26 | + run: go install github.com/magefile/mage |
| 27 | + - run: | |
| 28 | + mage -debug check |
| 29 | + go vet ./... |
| 30 | +
|
| 31 | + update: |
| 32 | + strategy: |
| 33 | + matrix: |
| 34 | + os: [ windows-2022, windows-latest ] |
| 35 | + runs-on: ${{ matrix.os }} |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + # See https://github.com/actions/setup-go/pull/515 |
| 39 | + - uses: antontroshin/setup-go@bda02de8887c9946189f81e7e59512914aeb9ea4 |
| 40 | + with: |
| 41 | + go-version-file: go.mod |
| 42 | + cache: true |
| 43 | + - name: install mage |
| 44 | + run: go install github.com/magefile/mage |
| 45 | + - name: install protoc |
| 46 | + run: | |
| 47 | + #curl -sSfL -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip |
| 48 | + #mkdir -p $GITHUB_WORKSPACE/.protoc |
| 49 | + #unzip -o protoc.zip -d $GITHUB_WORKSPACE/.protoc |
| 50 | + #echo "$GITHUB_WORKSPACE/.protoc/bin" >> $GITHUB_PATH |
| 51 | + |
| 52 | + $destination = "$GITHUB_WORKSPACE\protoc" |
| 53 | + $protoUri = "https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-win64.zip |
| 54 | + if (-Not (Test-Path -Path $destination)) { |
| 55 | + New-Item -ItemType Directory -Path $destination | Out-Null |
| 56 | + } |
| 57 | +
|
| 58 | + Invoke-WebRequest -Uri $protoUri -OutFile protoc.zip |
| 59 | + Expand-Archive -Path "protoc.zip" -DestinationPath $destination -Force |
| 60 | +
|
| 61 | + $protocBinPath = Join-Path $destination "bin" |
| 62 | + if (-Not ($ENV:Path -contains $protocBinPath)) { |
| 63 | + $ENV:Path += ";$protocBinPath" |
| 64 | + } |
| 65 | +
|
| 66 | + mage -debug update |
| 67 | + go test -v -race ./... |
| 68 | +# - run: mage -debug update |
| 69 | +# - run: go test -v -race ./... |
0 commit comments