Skip to content

Commit

Permalink
Merge pull request containerd#165 from estesp/move-to-ghactions
Browse files Browse the repository at this point in the history
Migrate CI to GitHub Actions
  • Loading branch information
estesp committed Jun 9, 2020
2 parents 56813a8 + 1388c90 commit 07e657c
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 46 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: CI
on:
push:
branches:
- master
- 'release/**'
pull_request:
branches:
- master
- 'release/**'

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

steps:
#
# Install Go
#
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.13.11'

- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
#
# Checkout repos
#
- name: Checkout cgroups
uses: actions/checkout@v2
with:
path: src/github.com/containerd/cgroups
fetch-depth: 25

- name: Checkout common project repo
uses: actions/checkout@v2
with:
repository: containerd/project
path: src/github.com/containerd/project

#
# Go get dependencies
#
- name: Install dependencies
env:
GO111MODULE: off
run: |
go get -u github.com/vbatts/git-validation
go get -u github.com/kunalkushwaha/ltag
#
# DCO / File headers
#
- name: DCO
env:
GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }}
DCO_VERBOSITY: "-q"
DCO_RANGE: ""
working-directory: src/github.com/containerd/cgroups
run: |
set -x
if [ -z "${GITHUB_COMMIT_URL}" ]; then
DCO_RANGE=$(jq -r '.after + "..HEAD"' ${GITHUB_EVENT_PATH})
else
DCO_RANGE=$(curl ${GITHUB_COMMIT_URL} | jq -r '.[0].parents[0].sha +".."+ .[-1].sha')
fi
../project/script/validate/dco
- name: Headers
run: ../project/script/validate/fileheader ../project/
working-directory: src/github.com/containerd/cgroups

test-v1:
name: Test cgroups v1
runs-on: ubuntu-18.04
timeout-minutes: 15
needs: [project]

steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: '1.13.11'

- name: Set env
shell: bash
run: |
echo "::set-env name=GOPATH::${{ github.workspace }}"
echo "::add-path::${{ github.workspace }}/bin"
- name: Checkout cgroups
uses: actions/checkout@v2
with:
path: src/github.com/containerd/cgroups

- name: Run cgroup v1 tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
working-directory: src/github.com/containerd/cgroups

test-v2:
name: Test cgroups v2
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 20
needs: [project]

steps:
- name: Checkout cgroups
uses: actions/checkout@v2

- name: Start vagrant
run: vagrant up

- name: Run cgroups v2 tests
run: vagrant ssh default -- sudo -i /test.sh
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

35 changes: 28 additions & 7 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,34 @@ Vagrant.configure("2") do |config|
v.cpus = 2
end
config.vm.provision "shell", inline: <<-SHELL
cat << EOF | dnf -y shell
config exclude kernel,kernel-core
config install_weak_deps false
update
install git golang-go
ts run
set -eux -o pipefail
# configuration
GO_VERSION="1.13.11"
# install gcc and Golang
dnf -y install gcc
curl -fsSL "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar Cxz /usr/local
# setup env vars
cat >> /etc/profile.d/sh.local <<EOF
PATH=/usr/local/go/bin:$PATH
GO111MODULE=on
export PATH GO111MODULE
EOF
source /etc/profile.d/sh.local
# enter /root/go/src/github.com/containerd/cgroups
mkdir -p /root/go/src/github.com/containerd
ln -s /vagrant /root/go/src/github.com/containerd/cgroups
cd /root/go/src/github.com/containerd/cgroups
# create /test.sh
cat > /test.sh <<EOF
#!/bin/bash
set -eux -o pipefail
cd /root/go/src/github.com/containerd/cgroups
go test -v ./...
EOF
dnf clean all
chmod +x /test.sh
SHELL
end

0 comments on commit 07e657c

Please sign in to comment.