From d636c1a2d15277eadca9892fb1372ba24413a358 Mon Sep 17 00:00:00 2001 From: Lorenz Bauer Date: Thu, 14 Sep 2023 11:46:31 +0100 Subject: [PATCH] WIP github actions 2nd try Signed-off-by: Lorenz Bauer --- .github/workflows/ci.yml | 93 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..7e807e180 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,93 @@ +name: CI Build + +on: [ push, pull_request ] + # push: + # branches: [ "main" ] + # pull_request: + # branches: [ "main" ] + +env: + TMPDIR: /tmp + CI_MAX_KERNEL_VERSION: '6.1' + CI_MIN_CLANG_VERSION: '9' + go_version: '~1.21' + prev_go_version: '~1.20' + +jobs: + build-and-lint: + name: Build and Lint + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '${{ env.go_version }}' + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v3.7.0 + + - run: make clean && make container-all + - run: git diff --exit-code || { echo "found unformatted source files, or generated files are not up to date, run 'make'" >&2; false; } + - run: go build -v -o "$(mktemp -d)" ./... + working-directory: ./examples + + cross-build: + name: Cross build + runs-on: ubuntu-latest + strategy: + matrix: + include: + - GOOS: darwin + - GOARCH: arm + GOARM: 6 + - GOARCH: arm64 + env: + GOOS: '${{ matrix.GOOS }}' + GOARCH: '${{ matrix.GOARCH }}' + GOARM: '${{ matrix.GOARM }}' + steps: + - run: go build ./... + - run: for p in $(go list ./...) ; do go test -c $p || exit ; done + + # test-on-prev-go: + # name: Run unit tests on previous stable Go + # runs-on: ubuntu-latest-4cores-16gb + # timeout-minutes: 10 + # steps: + # - uses: actions/checkout@v3 + + # - name: Set up Go + # uses: actions/setup-go@v4 + # with: + # go-version: '${{ env.prev_go_version }}' + + # - name: Install prerequisites + # run: | + # go install gotest.tools/gotestsum@v1.8.1 + # sudo pip3 install https://github.com/amluto/virtme/archive/beb85146cd91de37ae455eccb6ab67c393e6e290.zip + # sudo apt-get install -y --no-install-recommends qemu-system-x86 clang-9 llvm-9 + + # - name: Build + # run: | + # go test -v ./cmd/bpf2go + # gotestsum --raw-command --ignore-non-json-output-lines --junitfile junit.xml -- ./run-tests.sh $CI_MAX_KERNEL_VERSION -short -count 1 -json ./... + + # vmtest: + # runs-on: ubuntu-latest-4cores-16gb + # timeout-minutes: 10 + # steps: + # - uses: actions/checkout@v3 + + # - name: Set up Go + # uses: actions/setup-go@v4 + # with: + # go-version: '${{ env.go_version }}' + + # - name: Build + # run: go build -v ./... + + # - name: Test + # run: go test -v ./... \ No newline at end of file