...

Text file src/github.com/google/pprof/.github/workflows/ci.yaml

Documentation: github.com/google/pprof/.github/workflows

     1name: ci
     2on:
     3  push:
     4    branches:
     5      - main
     6  pull_request:
     7  schedule:
     8    - cron: '0 2 * * *' # Run every day, at 2AM UTC.
     9env:
    10  GOPATH: ${{ github.workspace }}
    11  WORKING_DIR: ./src/github.com/google/pprof/
    12jobs:
    13  test-mac:
    14    runs-on: ${{ matrix.os }}
    15    defaults:
    16      run:
    17        working-directory: ${{ env.WORKING_DIR }}
    18    strategy:
    19      fail-fast: false
    20      matrix:
    21        go: ['1.20', '1.21', 'tip']
    22        # Supported macOS versions can be found in
    23        # https://github.com/actions/virtual-environments#available-environments.
    24        # TODO: Add macos-13. As of now there are build errors when installing graphviz.
    25        os: ['macos-12']
    26        # Supported Xcode versions can be found in:
    27        # - https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md#xcode
    28        # - https://github.com/actions/virtual-environments/blob/main/images/macos/macos-13-Readme.md#xcode
    29        xcode-version: ['14.2', '14.1', '14.0.1', '13.4.1', '13.3.1', '13.2.1', '13.1']
    30    steps:
    31      - name: Update Go version using setup-go
    32        uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
    33        if: matrix.go != 'tip'
    34        with:
    35          go-version: ${{ matrix.go }}
    36
    37      - name: Update Go version manually
    38        if: matrix.go == 'tip'
    39        working-directory: ${{ github.workspace }}
    40        run: |
    41          git clone https://go.googlesource.com/go $HOME/gotip
    42          cd $HOME/gotip/src
    43          ./make.bash
    44          echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
    45          echo "RUN_STATICCHECK=false" >> $GITHUB_ENV
    46          echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
    47          echo "$HOME/gotip/bin:$PATH" >> $GITHUB_PATH
    48
    49      - name: Checkout the repo
    50        uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
    51        with:
    52          path: ${{ env.WORKING_DIR }}
    53
    54      - name: Set up Xcode
    55        uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
    56        with:
    57          xcode-version: ${{ matrix.xcode-version }}
    58
    59      - name: Fetch dependencies
    60        run: |
    61          brew install graphviz
    62          # Do not let tools interfere with the main module's go.mod.
    63          cd && go mod init tools
    64          go install honnef.co/go/tools/cmd/staticcheck@v0.4.6
    65          go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
    66          # Add PATH for installed tools.
    67          echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
    68
    69      - name: Run the script
    70        run: |
    71          go version
    72          ./test.sh
    73
    74      - name: Code coverage
    75        uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0
    76        with:
    77          file: ${{ env.WORKING_DIR }}/coverage.txt
    78
    79  test-linux:
    80    runs-on: ${{ matrix.os }}
    81    defaults:
    82      run:
    83        working-directory: ${{ env.WORKING_DIR }}
    84    strategy:
    85      fail-fast: false
    86      matrix:
    87        go: ['1.20', '1.21', 'tip']
    88        os: ['ubuntu-22.04', 'ubuntu-20.04']
    89    steps:
    90      - name: Update Go version using setup-go
    91        uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
    92        if: matrix.go != 'tip'
    93        with:
    94          go-version: ${{ matrix.go }}
    95
    96      - name: Update Go version manually
    97        if: matrix.go == 'tip'
    98        working-directory: ${{ github.workspace }}
    99        run: |
   100          git clone https://go.googlesource.com/go $HOME/gotip
   101          cd $HOME/gotip/src
   102          ./make.bash
   103          echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
   104          echo "RUN_STATICCHECK=false" >> $GITHUB_ENV
   105          echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
   106          echo "$HOME/gotip/bin" >> $GITHUB_PATH
   107
   108      - name: Checkout the repo
   109        uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
   110        with:
   111          path: ${{ env.WORKING_DIR }}
   112
   113      - name: Check chrome for browser tests
   114        run: |
   115          google-chrome --version
   116
   117      - name: Fetch dependencies
   118        run: |
   119          sudo apt-get install graphviz
   120          # Do not let tools interfere with the main module's go.mod.
   121          cd && go mod init tools
   122          go install honnef.co/go/tools/cmd/staticcheck@v0.4.6
   123          go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
   124          # Add PATH for installed tools.
   125          echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
   126
   127      - name: Run the script
   128        run: |
   129          go version
   130          ./test.sh
   131
   132      - name: Code coverage
   133        uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0
   134        with:
   135          file: ${{ env.WORKING_DIR }}/coverage.txt
   136
   137  test-windows:
   138    runs-on: windows-2019
   139    strategy:
   140      fail-fast: false
   141      matrix:
   142        go: ['1.20', '1.21']
   143    steps:
   144      - name: Update Go version using setup-go
   145        uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
   146        with:
   147          go-version: ${{ matrix.go }}
   148
   149      - name: Checkout the repo
   150        uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
   151        with:
   152          path: ${{ env.WORKING_DIR }}
   153
   154      - name: Fetch Windows dependency
   155        uses: crazy-max/ghaction-chocolatey@0e015857dd851f84fcb7fb53380eb5c4c8202333 # v3.0.0
   156        with:
   157          args: install graphviz llvm
   158
   159      - name: Run the test
   160        run: |
   161          go version
   162          # This is a workaround to make graphviz installed through choco work.
   163          # It generates a config file to tell dot what layout engine and
   164          # format types are available. See
   165          # https://github.com/google/pprof/issues/585 for more details.
   166          dot -c
   167          go env
   168          go build github.com/google/pprof
   169          go test -v ./...
   170        working-directory: ${{ env.WORKING_DIR }}
   171
   172  check:
   173    if: always()
   174    runs-on: ubuntu-latest
   175    needs:
   176    - test-mac
   177    - test-linux
   178    - test-windows
   179    steps:
   180    - name: Decide whether the needed jobs succeeded or failed
   181      uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
   182      with:
   183        jobs: ${{ toJSON(needs) }}

View as plain text