From c176e043209cebc999671d0f33d3c925472f4503 Mon Sep 17 00:00:00 2001 From: Athou Date: Fri, 17 Jan 2025 06:18:53 +0100 Subject: [PATCH] test ubuntu-24.04-arm runner --- .github/workflows/ci.yml | 158 +++++------------- .../src/main/docker/Dockerfile.native | 9 +- 2 files changed, 52 insertions(+), 115 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e737ee4e..3c6ca5af0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,26 +7,24 @@ env: DOCKER_BUILD_SUMMARY: false jobs: - build-linux: - runs-on: ubuntu-latest + build: strategy: matrix: + os: [ "ubuntu-latest", "ubuntu-24.04-arm", "windows-latest" ] database: [ "h2", "postgresql", "mysql", "mariadb" ] + runs-on: ${{ matrix.os }} steps: # Checkout + - name: Configure git to checkout as-is + run: git config --global core.autocrlf false + - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 # Setup - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Set up GraalVM uses: graalvm/setup-graalvm@v1 with: @@ -34,9 +32,13 @@ jobs: distribution: "graalvm" cache: "maven" + - name: Install Playwright dependencies + run: sudo apt-get install -y libgbm1 + if: matrix.os != 'windows-latest' + # Build & Test - name: Build with Maven - run: mvn --batch-mode --no-transfer-progress install -Pnative -P${{ matrix.database }} + run: mvn --batch-mode --no-transfer-progress install -Pnative -P${{ matrix.database }} -DskipTests=${{ matrix.os == 'windows-latest' && matrix.database != 'h2' }} # Upload artifacts - name: Upload cross-platform app @@ -44,140 +46,68 @@ jobs: with: name: commafeed-${{ matrix.database }}-jvm path: commafeed-server/target/commafeed-*.zip + overwrite: true - name: Upload native executable uses: actions/upload-artifact@v4 with: name: commafeed-${{ matrix.database }}-${{ runner.os }}-${{ runner.arch }} - path: commafeed-server/target/commafeed-*-runner - - # Docker - - name: Login to Container Registry - uses: docker/login-action@v3 - if: ${{ github.ref_type == 'tag' || github.ref_name == 'master' }} - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - ## tags - - name: Docker build and push tag - native - uses: docker/build-push-action@v6 - if: ${{ github.ref_type == 'tag' }} - with: - context: . - file: commafeed-server/src/main/docker/Dockerfile.native - push: true - platforms: linux/amd64 - tags: | - athou/commafeed:latest-${{ matrix.database }} - athou/commafeed:${{ github.ref_name }}-${{ matrix.database }} - - - name: Docker build and push tag - jvm - uses: docker/build-push-action@v6 - if: ${{ github.ref_type == 'tag' }} - with: - context: . - file: commafeed-server/src/main/docker/Dockerfile.jvm - push: true - platforms: linux/amd64,linux/arm64/v8 - tags: | - athou/commafeed:latest-${{ matrix.database }}-jvm - athou/commafeed:${{ github.ref_name }}-${{ matrix.database }}-jvm + path: commafeed-server/target/commafeed-*-runner* - ## master - - name: Docker build and push master - native - uses: docker/build-push-action@v6 - if: ${{ github.ref_name == 'master' }} - with: - context: . - file: commafeed-server/src/main/docker/Dockerfile.native - push: true - platforms: linux/amd64 - tags: athou/commafeed:master-${{ matrix.database }} - - - name: Docker build and push master - jvm - uses: docker/build-push-action@v6 - if: ${{ github.ref_name == 'master' }} - with: - context: . - file: commafeed-server/src/main/docker/Dockerfile.jvm - push: true - platforms: linux/amd64,linux/arm64/v8 - tags: athou/commafeed:master-${{ matrix.database }}-jvm + docker: + needs: build + runs-on: ubuntu-latest - build-windows: - runs-on: windows-latest strategy: matrix: database: [ "h2", "postgresql", "mysql", "mariadb" ] steps: # Checkout - - name: Configure git to checkout as-is - run: git config --global core.autocrlf false - - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 # Setup - - name: Set up GraalVM - uses: graalvm/setup-graalvm@v1 - with: - java-version: ${{ env.JAVA_VERSION }} - distribution: "graalvm" - cache: "maven" - - # Build & Test - - name: Build with Maven - run: mvn --batch-mode --no-transfer-progress install -Pnative -P${{ matrix.database }} -DskipTests=${{ matrix.database != 'h2' }} - - # Upload artifacts - - name: Upload native executable - uses: actions/upload-artifact@v4 - with: - name: commafeed-${{ matrix.database }}-${{ runner.os }}-${{ runner.arch }} - path: commafeed-server/target/commafeed-*-runner.exe - - release: - runs-on: ubuntu-latest - needs: - - build-linux - - build-windows - if: github.ref_type == 'tag' + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Download artifacts uses: actions/download-artifact@v4 with: - pattern: commafeed-* + pattern: commafeed-${{ matrix.database }}-* path: ./artifacts merge-multiple: true - - name: Extract Changelog Entry - uses: mindsers/changelog-reader-action@v2 - id: changelog_reader + # Docker + - name: Login to Container Registry + uses: docker/login-action@v3 + # if: ${{ github.ref_type == 'tag' || github.ref_name == 'master' }} with: - version: ${{ github.ref_name }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Create GitHub release - uses: ncipollo/release-action@v1 + ## master + - name: Docker build and push master - native + uses: docker/build-push-action@v6 + # if: ${{ github.ref_name == 'master' }} with: - name: CommaFeed ${{ github.ref_name }} - body: ${{ steps.changelog_reader.outputs.changes }} - artifacts: ./artifacts/* + context: . + file: commafeed-server/src/main/docker/Dockerfile.native + push: true + platforms: linux/amd64,linux/arm64/v8 + tags: athou/commafeed:master-${{ matrix.database }} - - name: Update Docker Hub Description - uses: peter-evans/dockerhub-description@v4 + - name: Docker build and push master - jvm + uses: docker/build-push-action@v6 + # if: ${{ github.ref_name == 'master' }} with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - repository: athou/commafeed - short-description: ${{ github.event.repository.description }} - readme-filepath: commafeed-server/src/main/docker/README.md + context: . + file: commafeed-server/src/main/docker/Dockerfile.jvm + push: true + platforms: linux/amd64,linux/arm64/v8 + tags: athou/commafeed:master-${{ matrix.database }}-jvm diff --git a/commafeed-server/src/main/docker/Dockerfile.native b/commafeed-server/src/main/docker/Dockerfile.native index 80118ad32..e43aba516 100644 --- a/commafeed-server/src/main/docker/Dockerfile.native +++ b/commafeed-server/src/main/docker/Dockerfile.native @@ -1,10 +1,17 @@ FROM debian:12.9 +ARG TARGETPLATFORM + EXPOSE 8082 RUN mkdir -p /commafeed/data VOLUME /commafeed/data -COPY commafeed-server/target/commafeed-*-runner /commafeed/application +RUN case "${TARGETPLATFORM}" in \ + "linux/amd64") cp ./artifacts/commafeed-*-x86_64-runner /commafeed/application ;; \ + "linux/arm64") cp ./artifacts/commafeed-*-aarch_64-runner /commafeed/application ;; \ + *) exit 1 ;; \ + esac + WORKDIR /commafeed CMD ["./application"]