<commit_before>name: Go-related checks

on:
  pull_request: {}
  push:
    branches:
      - master

jobs:
  go-mod:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.15.5
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Check module vendoring
        run: |
          go mod tidy
          go mod vendor
          git diff --exit-code || (echo "please run 'go mod tidy && go mod vendor', and submit your changes"; exit 1)

  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.31

  precheck:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.15.5
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          # hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
          path: src/github.com/cilium/cilium
      - name: Go code prechecks
        run: |
          cd src/github.com/cilium/cilium
          make precheck

  generate-api:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.15.5
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          # hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
          path: src/github.com/cilium/cilium
      - name: Check api generated files
        run: |
          cd src/github.com/cilium/cilium
          contrib/scripts/check-api-code-gen.sh

  generate-k8s-api:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.15.5
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          # hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
          path: src/github.com/cilium/cilium
      - name: Install protobuf dependencies
        env:
          PROTOBUF_VERSION: 3.12.4
        run: |
          curl -Lo protoc-$PROTOBUF_VERSION-linux-x86_64.zip https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip
          unzip protoc-$PROTOBUF_VERSION-linux-x86_64.zip
          sudo chmod +x bin/protoc && sudo cp bin/protoc /usr/local/bin
      - name: Set GOPATH
        run: |
          echo "##[set-env name=GOPATH;]$GITHUB_WORKSPACE"
        shell: bash
      - name: Check k8s generated files
        run: |
          cd src/github.com/cilium/cilium
          contrib/scripts/check-k8s-code-gen.sh<commit_msg>ci/github: Replace set-env command by echo<commit_after>name: Go-related checks

on:
  pull_request: {}
  push:
    branches:
      - master

jobs:
  go-mod:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.15.5
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Check module vendoring
        run: |
          go mod tidy
          go mod vendor
          git diff --exit-code || (echo "please run 'go mod tidy && go mod vendor', and submit your changes"; exit 1)

  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.31

  precheck:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.15.5
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          # hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
          path: src/github.com/cilium/cilium
      - name: Go code prechecks
        run: |
          cd src/github.com/cilium/cilium
          make precheck

  generate-api:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.15.5
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          # hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
          path: src/github.com/cilium/cilium
      - name: Check api generated files
        run: |
          cd src/github.com/cilium/cilium
          contrib/scripts/check-api-code-gen.sh

  generate-k8s-api:
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.15.5
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          # hard-code the path instead of using ${{ github.repository }} to make sure it works for forked repo as well
          path: src/github.com/cilium/cilium
      - name: Install protobuf dependencies
        env:
          PROTOBUF_VERSION: 3.12.4
        run: |
          curl -Lo protoc-$PROTOBUF_VERSION-linux-x86_64.zip https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip
          unzip protoc-$PROTOBUF_VERSION-linux-x86_64.zip
          sudo chmod +x bin/protoc && sudo cp bin/protoc /usr/local/bin
      - name: Set GOPATH
        run: |
          echo "GOPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
        shell: bash
      - name: Check k8s generated files
        run: |
          cd src/github.com/cilium/cilium
          contrib/scripts/check-k8s-code-gen.sh
{'fraction_non_alphanumeric': 0.09527085124677558, 'fraction_numerical': 0.016852966466036113, 'mean_word_length': 1.8096618357487924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5084999', 'n_tokens_mistral': 1917, 'n_tokens_neox': 1819, 'n_words': 482}