diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e34ed90..00f9f402 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,10 @@ concurrency: group: pr-${{ github.event.number }} cancel-in-progress: true +env: + OPENSUSE_UNOFFICIAL_LIBCONTAINERS_KEY_URL: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/Release.key" + OPENSUSE_UNOFFICIAL_LIBCONTAINERS_SOURCE_URL: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04" + on: pull_request_target: types: @@ -17,6 +21,7 @@ on: - v[0-9]+ - v[0-9]+.[0-9]+ - cryostat-v[0-9]+.[0-9]+ + - cryostat3 jobs: check-before-build: @@ -101,6 +106,79 @@ jobs: name: cryostat-${{ matrix.arch }} path: ${{ github.workspace }}/cryostat-${{ matrix.arch }}.tar + build-cryostat3: + needs: [build-core] + runs-on: ubuntu-latest + strategy: + matrix: + java: ['17', '21'] + env: + cache-name: cache-yarn + name: Build Java ${{ matrix.java }} + permissions: + packages: write + contents: read + pull-requests: write + statuses: write + steps: + - uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-build- + ${{ runner.os }}- + - uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/cryostat3 + ref: main + submodules: true + fetch-depth: 0 + - uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: 'maven' + - name: maven-settings + uses: s4u/maven-settings-action@v2 + with: + servers: '[{"id": "github", "username": "dummy", "password": "${{ secrets.GITHUB_TOKEN }}"}]' + githubServer: false + - run: git submodule init && git submodule update + - name: Cache yarn packages + uses: actions/cache@v3 + with: + path: "./src/main/webui/.yarn/cache" + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Initialize web assets + run: | + cd src/main/webui + yarn install && yarn yarn:frzinstall + cd - + - name: Install podman v4 + run: | + echo "deb $OPENSUSE_UNOFFICIAL_LIBCONTAINERS_SOURCE_URL/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list + curl -fsSL $OPENSUSE_UNOFFICIAL_LIBCONTAINERS_KEY_URL | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null + sudo apt -y purge podman + sudo apt update && sudo apt -y install podman + - name: Emulate docker with podman + run: | + mkdir -p $HOME/.bin + cat <(echo '#!/usr/bin/env bash') <(echo 'exec podman "$@"') > $HOME/.bin/docker + chmod +x $HOME/.bin/docker + echo "PATH=$HOME/.bin:$PATH" >> "$GITHUB_ENV" + - name: Start Podman API + run: systemctl --user enable --now podman.socket + - name: Set DOCKER_HOST environment variable + run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV" + - name: Build cryostat3 + run: ./mvnw -B -U -Dbuild.java=${{ matrix.java }} -Dio.cryostat.core.version=${{ needs.build-core.outputs.core_version }} clean package + continue-on-error: ${{ matrix.java != '17' }} + push-to-ghcr: runs-on: ubuntu-latest needs: [build-cryostat]