...

Text file src/github.com/opencontainers/runc/.github/workflows/test.yml

Documentation: github.com/opencontainers/runc/.github/workflows

     1# NOTE Github Actions execution environments lack a terminal, needed for
     2# some integration tests. So we use `script` command to fake a terminal.
     3
     4name: ci
     5on:
     6  push:
     7    tags:
     8      - v*
     9    branches:
    10      - master
    11      - release-*
    12  pull_request:
    13
    14env:
    15  # Don't ignore C warnings. Note that the output of "go env CGO_CFLAGS" by default is "-g -O2", so we keep them.
    16  CGO_CFLAGS: -g -O2 -Werror
    17
    18jobs:
    19  test:
    20    runs-on: ubuntu-20.04
    21    strategy:
    22      fail-fast: false
    23      matrix:
    24        go-version: [1.17.x, 1.20.x, 1.21.x]
    25        rootless: ["rootless", ""]
    26        race: ["-race", ""]
    27        criu: [""]
    28        include:
    29          # Also test against latest criu-dev
    30          - go-version: 1.20.x
    31            rootless: ""
    32            race: ""
    33            criu: "criu-dev"
    34
    35    steps:
    36
    37    - name: checkout
    38      uses: actions/checkout@v3
    39
    40    - name: install deps
    41      if: matrix.criu == ''
    42      env:
    43        REPO: https://download.opensuse.org/repositories/devel:/tools:/criu/xUbuntu_20.04
    44      run: |
    45        # criu repo
    46        curl -fSsLl $REPO/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_tools_criu.gpg > /dev/null
    47        echo "deb $REPO/ /" | sudo tee /etc/apt/sources.list.d/criu.list
    48        sudo apt update
    49        sudo apt install libseccomp-dev criu sshfs
    50
    51    - name: install deps (criu ${{ matrix.criu }})
    52      if: matrix.criu != ''
    53      run: |
    54        sudo apt -q update
    55        sudo apt -q install libseccomp-dev sshfs \
    56          libcap-dev libnet1-dev libnl-3-dev \
    57          libprotobuf-c-dev libprotobuf-dev protobuf-c-compiler protobuf-compiler
    58        git clone https://github.com/checkpoint-restore/criu.git ~/criu
    59        (cd ~/criu && git checkout ${{ matrix.criu }} && sudo make install-criu)
    60        rm -rf ~/criu
    61
    62    - name: install go ${{ matrix.go-version }}
    63      uses: actions/setup-go@v4
    64      with:
    65        go-version: ${{ matrix.go-version }}
    66
    67    - name: build
    68      run: sudo -E PATH="$PATH" make EXTRA_FLAGS="${{ matrix.race }}" all
    69
    70    - name: install bats
    71      uses: mig4/setup-bats@v1
    72      with:
    73        bats-version: 1.9.0
    74
    75    - name: unit test
    76      if: matrix.rootless != 'rootless'
    77      run: sudo -E PATH="$PATH" -- make TESTFLAGS="${{ matrix.race }}" localunittest
    78
    79    - name: add rootless user
    80      if: matrix.rootless == 'rootless'
    81      run: |
    82        sudo useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
    83        # Allow root and rootless itself to execute `ssh rootless@localhost` in tests/rootless.sh
    84        ssh-keygen -t ecdsa -N "" -f $HOME/rootless.key
    85        sudo mkdir -m 0700 -p /home/rootless/.ssh
    86        sudo cp $HOME/rootless.key /home/rootless/.ssh/id_ecdsa
    87        sudo cp $HOME/rootless.key.pub /home/rootless/.ssh/authorized_keys
    88        sudo chown -R rootless.rootless /home/rootless
    89
    90    - name: integration test (fs driver)
    91      run: sudo -E PATH="$PATH" script -e -c 'make local${{ matrix.rootless }}integration'
    92
    93    - name: integration test (systemd driver)
    94      # can't use systemd driver with cgroupv1
    95      if: matrix.rootless != 'rootless'
    96      run: sudo -E PATH="$PATH" script -e -c 'make RUNC_USE_SYSTEMD=yes local${{ matrix.rootless }}integration'
    97
    98  # We need to continue support for 32-bit ARM.
    99  # However, we do not have 32-bit ARM CI, so we use i386 for testing 32bit stuff.
   100  # We are not interested in providing official support for i386.
   101  cross-i386:
   102    runs-on: ubuntu-20.04
   103
   104    steps:
   105
   106    - name: checkout
   107      uses: actions/checkout@v3
   108
   109    - name: install deps
   110      run: |
   111        sudo dpkg --add-architecture i386
   112        # add criu repo
   113        sudo add-apt-repository -y ppa:criu/ppa
   114        # apt-add-repository runs apt update so we don't have to.
   115
   116        # Due to a bug in apt, we have to update it first
   117        # (see https://bugs.launchpad.net/ubuntu-cdimage/+bug/1871268)
   118        sudo apt -q install apt
   119        sudo apt -q install libseccomp-dev libseccomp-dev:i386 gcc-multilib criu
   120
   121    - name: install go
   122      uses: actions/setup-go@v4
   123      with:
   124        go-version: 1.x # Latest stable
   125
   126    - name: unit test
   127      run: sudo -E PATH="$PATH" -- make GOARCH=386 localunittest

View as plain text