diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..de07e023d11 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,100 @@ +name: Build +on: + push: + pull_request: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + shellcheck: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Differential ShellCheck + id: ShellCheck + uses: redhat-plumbers-in-action/differential-shellcheck@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifact with ShellCheck defects in SARIF format + uses: actions/upload-artifact@v4 + with: + name: Differential ShellCheck SARIF + path: ${{ steps.ShellCheck.outputs.sarif }} + + build: + strategy: + matrix: + go: + - oldstable + - stable + - tip + runs-on: ubuntu-22.04 + steps: + - name: Install Dependencies + run: | + sudo add-apt-repository ppa:cowsql/stable -y --no-update + sudo apt-get update + + sudo apt-get install --no-install-recommends -y \ + autoconf \ + automake \ + libcowsql-dev \ + libacl1-dev \ + libcap-dev \ + liblxc1 \ + liblz4-dev \ + libsqlite3-dev \ + libudev-dev \ + libuv1-dev \ + lxc-dev \ + make \ + pkg-config + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Go (${{ matrix.go }}) + if: matrix.go != 'tip' + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - name: Install Go (tip) + if: matrix.go == 'tip' + run: | + go install golang.org/dl/gotip@latest + gotip download + ~/sdk/gotip/bin/go version + echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV + + - name: Save Go env + id: go-env + run: go env >> $GITHUB_OUTPUT + + - name: Check compatible min Go version + run: | + go mod tidy + + - name: Download go dependencies + run: | + go mod download + + - name: Run Incus build + run: | + make + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: incus + path: | + ./ + ${{ steps.go-env.GOPATH }}/ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 73d85b24171..259d68ede3b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -389,7 +389,7 @@ jobs: - name: Create build directory run: | - mkdir bin + mkdir bin - name: Build static x86_64 incus env: