<commit_before>name: CI
on:
  push:
    branches:
      - master
      - 'release/**'
  pull_request:
    branches:
      - master
      - 'release/**'

jobs:
  #
  # golangci-lint
  #
  linters:
    name: Linters
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10

    strategy:
      matrix:
        go-version: [1.16.2]
        os: [ubuntu-18.04, macos-10.15, windows-2019]

    steps:
      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd

      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

      - uses: golangci/golangci-lint-action@v2
        with:
          version: v1.36.0
          working-directory: src/github.com/containerd/containerd
          args: --timeout=5m

  #
  # Project checks
  #
  project:
    name: Project Checks
    runs-on: ubuntu-18.04
    timeout-minutes: 5

    steps:
      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd
          fetch-depth: 100

      - uses: containerd/project-checks@v1
        with:
          working-directory: src/github.com/containerd/containerd

  #
  # Protobuf checks
  #
  protos:
    name: Protobuf
    runs-on: ubuntu-18.04
    timeout-minutes: 5

    defaults:
      run:
        working-directory: src/github.com/containerd/containerd

    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: '1.16.2'

      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd

      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "GO111MODULE=off" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

      - name: Install protobuf
        run: |
          sudo env PATH=$PATH GOPATH=$GOPATH script/setup/install-protobuf
          sudo chmod +x /usr/local/bin/protoc
          sudo chmod og+rx /usr/local/include/google /usr/local/include/google/protobuf /usr/local/include/google/protobuf/compiler
          sudo chmod -R og+r /usr/local/include/google/protobuf/
          protoc --version

      - run: script/setup/install-dev-tools
      - run: make proto-fmt
      - run: make check-protos check-api-descriptors

  man:
    name: Manpages
    runs-on: ubuntu-18.04
    timeout-minutes: 5

    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: '1.16.2'

      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd

      - run: GO111MODULE=on go get github.com/cpuguy83/go-md2man/v2@v2.0.0

      - run: make man
        working-directory: src/github.com/containerd/containerd

  #
  # Build containerd binaries
  #
  binaries:
    name: Binaries
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10
    needs: [project, linters, protos, man]

    strategy:
      matrix:
        os: [ubuntu-18.04, macos-10.15, windows-2019]

    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: '1.16.2'

      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd

      - name: Make
        run: |
          make build
          make binaries
        working-directory: src/github.com/containerd/containerd

      - name: Cross-compile
        if: startsWith(matrix.os, 'ubuntu')
        run : |
          GOOS=freebsd make build
          GOOS=freebsd make binaries
        working-directory: src/github.com/containerd/containerd

  #<commit_msg>Add CI job to cross compile all the things<commit_after>name: CI
on:
  push:
    branches:
      - master
      - 'release/**'
  pull_request:
    branches:
      - master
      - 'release/**'

jobs:
  #
  # golangci-lint
  #
  linters:
    name: Linters
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10

    strategy:
      matrix:
        go-version: [1.16.2]
        os: [ubuntu-18.04, macos-10.15, windows-2019]

    steps:
      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd

      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

      - uses: golangci/golangci-lint-action@v2
        with:
          version: v1.36.0
          working-directory: src/github.com/containerd/containerd
          args: --timeout=5m

  #
  # Project checks
  #
  project:
    name: Project Checks
    runs-on: ubuntu-18.04
    timeout-minutes: 5

    steps:
      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd
          fetch-depth: 100

      - uses: containerd/project-checks@v1
        with:
          working-directory: src/github.com/containerd/containerd

  #
  # Protobuf checks
  #
  protos:
    name: Protobuf
    runs-on: ubuntu-18.04
    timeout-minutes: 5

    defaults:
      run:
        working-directory: src/github.com/containerd/containerd

    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: '1.16.2'

      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd

      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "GO111MODULE=off" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

      - name: Install protobuf
        run: |
          sudo env PATH=$PATH GOPATH=$GOPATH script/setup/install-protobuf
          sudo chmod +x /usr/local/bin/protoc
          sudo chmod og+rx /usr/local/include/google /usr/local/include/google/protobuf /usr/local/include/google/protobuf/compiler
          sudo chmod -R og+r /usr/local/include/google/protobuf/
          protoc --version

      - run: script/setup/install-dev-tools
      - run: make proto-fmt
      - run: make check-protos check-api-descriptors

  man:
    name: Manpages
    runs-on: ubuntu-18.04
    timeout-minutes: 5

    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: '1.16.2'

      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd

      - run: GO111MODULE=on go get github.com/cpuguy83/go-md2man/v2@v2.0.0

      - run: make man
        working-directory: src/github.com/containerd/containerd

  # Make sure binaries compile with other platforms
  crossbuild:
    name: Crossbuild Binaries
    needs: [project, linters, protos, man]
    runs-on: ubuntu-18.04
    timeout-minutes: 10
    strategy:
      fail-fast: false
      matrix:
        include:
          - goos: linux
            goarch: arm64
          - goos: linux
            goarch: arm
            goarm: "7"
          - goos: linux
            goarch: arm
            goarm: "5"
          - goos: freebsd
            goarch: amd64
          - goos: freebsd
            goarch: arm64
          - goos: windows
            goarch: arm
            goarm: "7"

    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: '1.16.2'
      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd
      - run: |
          set -e -x

          packages=""
          platform="${{matrix.goos}}/${{matrix.goarch}}"
          if [ -n "${{matrix.goarm}}" ]; then
            platform+="/v${{matrix.goarm}}"
          fi

          case "${platform}" in
          linux/arm/v5)
            packages+=" crossbuild-essential-armel"
            echo "CGO_ENABLED=1" >> $GITHUB_ENV
            echo "CC=arm-linux-gnueabi-gcc" >> $GITHUB_ENV
            ;;
          linux/arm/v7)
            packages+=" crossbuild-essential-armhf"
            echo "CGO_ENABLED=1" >> $GITHUB_ENV
            echo "CC=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
            ;;
          linux/arm64)
            packages+=" crossbuild-essential-arm64"
            echo "CGO_ENABLED=1" >> $GITHUB_ENV
            echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
            ;;
          windows/arm/v7)
            echo "CGO_ENABLED=0" >> $GITHUB_ENV
            ;;
          esac

          if [ -n "${packages}" ]; then
            sudo apt-get update && sudo apt-get install -y ${packages}
          fi
        name: install deps
      - name: Build
        working-directory: src/github.com/containerd/containerd
        env:
          GOOS: ${{matrix.goos}}
          GOARCH: ${{matrix.goarch}}
          GOARM: ${{matrix.goarm}}
        run: |
          make build
          make binaries

  #
  # Build containerd binaries
  #
  binaries:
    name: Binaries
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10
    needs: [project, linters, protos, man]

    strategy:
      matrix:
        os: [ubuntu-18.04, macos-10.15, windows-2019]

    steps:
      - uses: actions/setup-go@v2
        with:
          go-version: '1.16.2'

      - name: Set env
        shell: bash
        run: |
          echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
          echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

      - uses: actions/checkout@v2
        with:
          path: src/github.com/containerd/containerd

      - name: Make
        run: |
          make build
          make binaries
        working-directory: src/github.com/containerd/containerd

  #
{'fraction_non_alphanumeric': 0.12132244416018892, 'fraction_numerical': 0.021056774574436683, 'mean_word_length': 1.6945917285259808, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6504711', 'n_tokens_mistral': 3545, 'n_tokens_neox': 3296, 'n_words': 687}