Files
linuxkit/.github/workflows/ci.yml
David Gageot 95d4b34b83 Add a GHA target for darwin/arm64
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-07 10:29:17 +02:00

382 lines
9.7 KiB
YAML

name: LinuxKit CI
on: [push, pull_request]
jobs:
build:
name: Build & Test
strategy:
matrix:
target:
- os: linux
arch: amd64
suffix: amd64-linux
runner: ubuntu-latest
- os: linux
arch: arm64
suffix: arm64-linux
runner: ubuntu-latest
- os: linux
arch: s390x
suffix: s390x-linux
runner: ubuntu-latest
- os: darwin
arch: amd64
suffix: amd64-darwin
runner: macos-latest
- os: darwin
arch: arm64
suffix: arm64-darwin
runner: macos-latest
- os: windows
arch: amd64
suffix: amd64-windows.exe
runner: ubuntu-latest
runs-on: ${{ matrix.target.runner }}
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16.7
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
if command -v sha256sum > /dev/null; then sha256sum linuxkit-${{matrix.target.suffix}} > linuxkit-${{matrix.target.suffix}}.SHA256SUM
else openssl sha256 -r linuxkit-${{matrix.target.suffix}} | tr -d '*' > linuxkit-${{matrix.target.suffix}}.SHA256SUM
fi
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: Set up binfmt
# Only register arm64 as we are on amd64 already. s390x is not reliable
run: docker run --privileged --rm tonistiigi/binfmt --install arm64
- 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
# Skip s390x as emulation is unreliable
run: |
make OPTIONS="-v --skip-platforms linux/s390x" -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