mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-25 07:12:34 +00:00
This commit adds the default linuxkit cache directory to the GitHub Actions cache. This will ensure that we don't pull images that already exist in the cache, or build them if we've already done so. It should speed up CI. Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
365 lines
9.0 KiB
YAML
365 lines
9.0 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=$(pwd)/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: Cache Packages
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.linuxkit/cache/
|
|
key: ${{ runner.os }}-linuxkit-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-linuxkit-
|
|
|
|
- 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: Restore Package Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.linuxkit/cache/
|
|
key: ${{ runner.os }}-linuxkit-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-linuxkit-
|
|
|
|
- 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
|