Files
linuxkit/.github/workflows/ci.yml
Rolf Neugebauer ffe5dedb0a ci: Fix multi-arch builds
- Introduce separate os/arch to the matrix
- Pass os/arch to the local build
- Switch to upload-artifact@v0 and cache@v2
- Fetch linuxkit binary from artefacts rather than using cache
- Add some debug (print file and hashes)

While at it, add some debug for the generated artefacts.

fixes https://github.com/linuxkit/linuxkit/issues/3522

Signed-off-by: Rolf Neugebauer <rn@rneugeba.io>
2021-04-04 10:46:07 +01:00

349 lines
8.5 KiB
YAML

name: LinuxKit CI
on: [push, pull_request]
jobs:
build:
name: Build & Test
strategy:
matrix:
target:
- os: linux
arch: amd64
suffix: amd64-linux
- os: linux
arch: arm64
suffix: arm64-linux
- os: linux
arch: s390x
suffix: s390x-linux
- os: darwin
arch: amd64
suffix: amd64-darwin
- os: windows
arch: amd64
suffix: amd64-windows.exe
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v2
with:
go-version: 1.13.4
id: go
- name: Check out code
uses: actions/checkout@v1
with:
path: ./src/github.com/linuxkit/linuxkit
- name: Set path
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
env:
GOPATH: ${{runner.workspace}}
- name: Get pre-requisites
run: |
go get -u golang.org/x/lint/golint
go get -u github.com/gordonklaus/ineffassign
env:
GOPATH: ${{runner.workspace}}
- name: Lint
run: |
make local-check
env:
GOPATH: ${{runner.workspace}}
- name: Build
run: |
make GOARCH=${{matrix.target.arch}} GOOS=${{matrix.target.os}} LOCAL_TARGET=bin/linuxkit-${{matrix.target.suffix}} local-build
file bin/linuxkit-${{matrix.target.suffix}}
env:
GOPATH: ${{runner.workspace}}
- name: Checksum
run: |
cd bin && sha256sum linuxkit-${{matrix.target.suffix}} > linuxkit-${{matrix.target.suffix}}.SHA256SUM
cat linuxkit-${{matrix.target.suffix}}.SHA256SUM
- name: Test
run: make local-test
env:
GOPATH: ${{runner.workspace}}
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: linuxkit-${{matrix.target.suffix}}
path: |
bin/linuxkit-${{matrix.target.suffix}}
bin/linuxkit-${{matrix.target.suffix}}.SHA256SUM
if-no-files-found: error
build_packages:
name: Build Packages
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
with:
path: ./src/github.com/linuxkit/linuxkit
- name: Download linuxkit
uses: actions/download-artifact@v2
with:
name: linuxkit-amd64-linux
path: bin
- name: Symlink Linuxkit
run: |
chmod ugo+x bin/linuxkit-amd64-linux
sudo ln -s $(pwd)/bin/linuxkit-amd64-linux /usr/local/bin/linuxkit
/usr/local/bin/linuxkit version
- name: Build Packages
run: |
make -C pkg build
test_packages:
name: Packages Tests
needs: [ build_packages, build ]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
with:
path: ./src/github.com/linuxkit/linuxkit
- name: Install Pre-Requisites
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -qy qemu-utils qemu-system-x86 expect
- name: Restore RTF From Cache
id: cache-rtf
uses: actions/cache@v2
with:
path: bin
key: rtf-${{hashFiles('Makefile')}}
- name: Build RTF
if: steps.cache-rtf.outputs.cache-hit != 'true'
run: make bin/rtf
- name: Symlink RTF
run: |
sudo ln -s $(pwd)/bin/rtf /usr/local/bin/rtf
- name: Download linuxkit
uses: actions/download-artifact@v2
with:
name: linuxkit-amd64-linux
path: bin
- name: Symlink Linuxkit
run: |
chmod ugo+x bin/linuxkit-amd64-linux
sudo ln -s $(pwd)/bin/linuxkit-amd64-linux /usr/local/bin/linuxkit
/usr/local/bin/linuxkit version
- name: Run Tests
run: |
cd test
rtf -l build -v run -x linuxkit.packages
test_kernel:
name: Kernel Tests
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
with:
path: ./src/github.com/linuxkit/linuxkit
- name: Install Pre-Requisites
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -qy qemu-utils qemu-system-x86 expect
- name: Restore RTF From Cache
id: cache-rtf
uses: actions/cache@v2
with:
path: bin
key: rtf-${{hashFiles('Makefile')}}
- name: Build RTF
if: steps.cache-rtf.outputs.cache-hit != 'true'
run: make bin/rtf
- name: Symlink RTF
run: |
sudo ln -s $(pwd)/bin/rtf /usr/local/bin/rtf
- name: Download linuxkit
uses: actions/download-artifact@v2
with:
name: linuxkit-amd64-linux
path: bin
- name: Symlink Linuxkit
run: |
chmod ugo+x bin/linuxkit-amd64-linux
sudo ln -s $(pwd)/bin/linuxkit-amd64-linux /usr/local/bin/linuxkit
/usr/local/bin/linuxkit version
- name: Run Tests
run: |
cd test
rtf -l build -v run -x linuxkit.kernel
test_linuxkit:
name: LinuxKit Build Tests
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
with:
path: ./src/github.com/linuxkit/linuxkit
- name: Install Pre-Requisites
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -qy qemu-utils qemu-system-x86 expect
- name: Restore RTF From Cache
id: cache-rtf
uses: actions/cache@v2
with:
path: bin
key: rtf-${{hashFiles('Makefile')}}
- name: Build RTF
if: steps.cache-rtf.outputs.cache-hit != 'true'
run: make bin/rtf
- name: Symlink RTF
run: |
sudo ln -s $(pwd)/bin/rtf /usr/local/bin/rtf
- name: Download linuxkit
uses: actions/download-artifact@v2
with:
name: linuxkit-amd64-linux
path: bin
- name: Symlink Linuxkit
run: |
chmod ugo+x bin/linuxkit-amd64-linux
sudo ln -s $(pwd)/bin/linuxkit-amd64-linux /usr/local/bin/linuxkit
/usr/local/bin/linuxkit version
- name: Run Tests
run: |
cd test
rtf -l build -v run -x linuxkit.build
test_platforms:
name: Platform Tests
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
with:
path: ./src/github.com/linuxkit/linuxkit
- name: Install Pre-Requisites
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -qy qemu-utils qemu-system-x86 expect
- name: Restore RTF From Cache
id: cache-rtf
uses: actions/cache@v2
with:
path: bin
key: rtf-${{hashFiles('Makefile')}}
- name: Build RTF
if: steps.cache-rtf.outputs.cache-hit != 'true'
run: make bin/rtf
- name: Symlink RTF
run: |
sudo ln -s $(pwd)/bin/rtf /usr/local/bin/rtf
- name: Download linuxkit
uses: actions/download-artifact@v2
with:
name: linuxkit-amd64-linux
path: bin
- name: Symlink Linuxkit
run: |
chmod ugo+x bin/linuxkit-amd64-linux
sudo ln -s $(pwd)/bin/linuxkit-amd64-linux /usr/local/bin/linuxkit
/usr/local/bin/linuxkit version
- name: Run Tests
run: |
cd test
rtf -l build -v run -x linuxkit.platforms
test_security:
name: Security Tests
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
with:
path: ./src/github.com/linuxkit/linuxkit
- name: Install Pre-Requisites
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -qy qemu-utils qemu-system-x86 expect
- name: Restore RTF From Cache
id: cache-rtf
uses: actions/cache@v2
with:
path: bin
key: rtf-${{hashFiles('Makefile')}}
- name: Build RTF
if: steps.cache-rtf.outputs.cache-hit != 'true'
run: make bin/rtf
- name: Symlink RTF
run: |
sudo ln -s $(pwd)/bin/rtf /usr/local/bin/rtf
- name: Download linuxkit
uses: actions/download-artifact@v2
with:
name: linuxkit-amd64-linux
path: bin
- name: Symlink Linuxkit
run: |
chmod ugo+x bin/linuxkit-amd64-linux
sudo ln -s $(pwd)/bin/linuxkit-amd64-linux /usr/local/bin/linuxkit
/usr/local/bin/linuxkit version
- name: Run Tests
run: |
cd test
rtf -l build -v run -x linuxkit.security