go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/.github/workflows/pr-test-generated-files.yaml (about)

     1  name: Generated Code Test
     2  
     3  ## Only trigger tests if source is changing
     4  on:
     5    push:
     6      paths:
     7        - '**.proto'
     8        - '**.lr'
     9        - '**.go'
    10  
    11  env:
    12    GO_VERSION: ">=1.21.0"
    13    PROTO_VERSION: "21.7"
    14  
    15  jobs:
    16    # Check if there is any dirty change for generated files
    17    generated-files:
    18      runs-on: self-hosted
    19      steps:
    20        - name: Checkout code
    21          uses: actions/checkout@v4
    22  
    23        - name: Install Go
    24          uses: actions/setup-go@v4
    25          with:
    26            go-version: ${{ env.GO_VERSION }}
    27            cache: false
    28  
    29        # We do not permit sudo on self-hosted runners
    30        - name: "Ensure GCC is installed"
    31          run: |
    32            if gcc --version; then 
    33              echo "Good to go"; 
    34            else 
    35              echo "Install GCC on the runner."; 
    36            fi
    37  
    38        # Note we do not use apt install -y protobuf-compiler` since it is too old
    39        - name: Check generated files
    40          run: |
    41            PB_REL="https://github.com/protocolbuffers/protobuf/releases"
    42            curl -LO $PB_REL/download/v${PROTO_VERSION}/protoc-${PROTO_VERSION}-linux-x86_64.zip
    43            mkdir tools
    44            unzip protoc-${PROTO_VERSION}-linux-x86_64.zip -d ./tools
    45            rm protoc-${PROTO_VERSION}-linux-x86_64.zip
    46            export PATH="$PATH:$(pwd)/tools/bin"
    47            protoc --version
    48            make prep
    49            make cnquery/generate
    50            git diff --exit-code *.go
    51            git diff --exit-code resources/packs/**/*.lr.json