github.com/vmware/govmomi@v0.37.1/.github/workflows/govmomi-govc-tests.yaml (about)

     1  #  Copyright (c) 2021 VMware, Inc. All Rights Reserved.
     2  #
     3  #  Licensed under the Apache License, Version 2.0 (the "License");
     4  #  you may not use this file except in compliance with the License.
     5  #  You may obtain a copy of the License at
     6  #
     7  #  http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  #  Unless required by applicable law or agreed to in writing, software
    10  #  distributed under the License is distributed on an "AS IS" BASIS,
    11  #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  #  See the License for the specific language governing permissions and
    13  #  limitations under the License.
    14  
    15  name: govc Tests
    16  
    17  on:
    18    push:
    19      branches: ["main"]
    20  
    21    pull_request:
    22      branches: ["main"]
    23  
    24  concurrency:
    25    group: govmomi-govc-tests-${{ github.head_ref || github.run_id }}
    26    cancel-in-progress: true
    27  
    28  jobs:
    29    govc-tests:
    30      name: Run govc Tests
    31      strategy:
    32        fail-fast: false
    33        matrix:
    34          go-version: ["1.20"]
    35          platform: ["ubuntu-20.04"]
    36          cmd: ["govc-test"]
    37          experimental: [false]
    38          timeout: [20]
    39  
    40      runs-on: ${{ matrix.platform }}
    41      continue-on-error: ${{ matrix.experimental }}
    42      timeout-minutes: ${{ matrix.timeout }}
    43  
    44      steps:
    45        - name: Check out code
    46          uses: actions/checkout@v4
    47  
    48        - name: Set up Go ${{ matrix.go-version }}
    49          uses: actions/setup-go@v5
    50          with:
    51            go-version: ${{ matrix.go-version }}
    52          id: go
    53  
    54        - name: Restore Go cache
    55          uses: actions/cache@v4
    56          with:
    57            path: |
    58              ~/.cache/go-build
    59              ~/go/pkg/mod
    60            key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
    61            restore-keys: |
    62              ${{ runner.os }}-go-${{ matrix.go-version }}-
    63  
    64        - name: Run ${{ matrix.cmd }}
    65          run: |
    66            make ${{ matrix.cmd }}
    67  
    68        - name: Debug with tmate on failure
    69          if: ${{ failure() }}
    70          uses: mxschmitt/action-tmate@v3
    71  
    72    govc-docs:
    73      name: Verify govc docs are up2date
    74      strategy:
    75        matrix:
    76          go-version: ["1.20"]
    77          platform: ["ubuntu-20.04"]
    78      runs-on: ${{ matrix.platform }}
    79      timeout-minutes: 3
    80      steps:
    81        - name: Check out code
    82          uses: actions/checkout@v4
    83  
    84        - name: Set up Go ${{ matrix.go-version }}
    85          uses: actions/setup-go@v5
    86          with:
    87            go-version: ${{ matrix.go-version }}
    88          id: go
    89  
    90        - name: Restore Go cache
    91          uses: actions/cache@v4
    92          with:
    93            path: |
    94              ~/.cache/go-build
    95              ~/go/pkg/mod
    96            key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
    97            restore-keys: |
    98              ${{ runner.os }}-go-${{ matrix.go-version }}-
    99  
   100        - name: Run "make doc"
   101          run: |
   102            make doc
   103            if [ -z "$(git status --porcelain)" ]; then
   104              echo "govc/USAGE.md is up2date..."
   105            else
   106              echo "dirty working directory (diff):"
   107              git --no-pager diff
   108              echo "::error file=govc/USAGE.md::Run make doc to update USAGE.md"
   109              exit 1
   110            fi