This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git


The following commit(s) were added to refs/heads/master by this push:
     new aae46923 Separate cross-build and test (#272)
aae46923 is described below

commit aae4692333413717235d1a876cf4e58178d73d1a
Author: sebbASF <[email protected]>
AuthorDate: Thu Nov 16 22:05:56 2023 +0000

    Separate cross-build and test (#272)
---
 .github/workflows/docker_images.yml   | 74 +++++++++++++++++++++++++++++++++++
 .github/workflows/maven_crosstest.yml | 56 ++++++++++++++++++++++++++
 src/docker/docker-compose-gh.yaml     | 42 ++++++++++++++++++++
 3 files changed, 172 insertions(+)

diff --git a/.github/workflows/docker_images.yml 
b/.github/workflows/docker_images.yml
new file mode 100644
index 00000000..bbde7a41
--- /dev/null
+++ b/.github/workflows/docker_images.yml
@@ -0,0 +1,74 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: Create Docker cross-build images
+
+on:
+  # allow direct trigger
+  workflow_dispatch:
+  # only rarely needs to run
+  push:
+    paths:
+      - '**/docker_images.yml'
+      - 'src/docker/Dockerfile*'
+
+env:
+  REGISTRY: ghcr.io
+
+jobs:
+  docker:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+    steps:
+      - name: Image prefix (lower case)
+        run: |
+          echo "IMAGE_PREFIX=$(echo ${{ env.REGISTRY }}/${{ github.repository 
}} | tr '[A-Z]' '[a-z]')" >>$GITHUB_ENV
+      - name: Checkout
+        uses: actions/checkout@v4
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v3
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v3
+      - name: Login to Docker Hub
+        uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - name: Build and push main image
+        uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
+        with:
+          context: src/docker
+          file: src/docker/Dockerfile
+          push: true
+          tags: ${{ env.IMAGE_PREFIX }}:latest
+      - name: Build and push aarch64
+        uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
+        with:
+          context: src/docker
+          file: src/docker/Dockerfile.aarch64
+          platforms: linux/aarch64
+          push: true
+          tags: ${{ env.IMAGE_PREFIX }}-aarch64:latest
+      - name: Build and push riscv64
+        uses: docker/build-push-action@v5
+        with:
+          context: src/docker
+          file: src/docker/Dockerfile.riscv64
+          platforms: linux/riscv64
+          push: true
+          tags: ${{ env.IMAGE_PREFIX }}-riscv64:latest
diff --git a/.github/workflows/maven_crosstest.yml 
b/.github/workflows/maven_crosstest.yml
new file mode 100644
index 00000000..9b3f43f1
--- /dev/null
+++ b/.github/workflows/maven_crosstest.yml
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: Java Cross Test
+
+on:
+  # allow direct trigger
+  workflow_dispatch:
+  push:
+    paths:
+      - '**/native/**'
+      - '**/maven_crosstest.yml'
+      - 'src/docker/*'
+
+permissions:
+  contents: read
+
+env:
+  REGISTRY: ghcr.io
+
+jobs:
+  test-cross:
+    strategy:
+      matrix:
+        include:
+          - platform: aarch64
+          - platform: riscv64
+            jna_override: "-Djna.version=5.12.0" # See 
https://github.com/java-native-access/jna/issues/1557
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 
v4.1.1
+        with:
+          persist-credentials: false
+      - uses: 
docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
+      - name: Image prefix (lower case)
+        run: |
+          echo "IMAGE_PREFIX=$(echo ${{ env.REGISTRY }}/${{ github.repository 
}} | tr '[A-Z]' '[a-z]')" >>$GITHUB_ENV
+      - name: Build package
+        run: |
+          IMAGE_PREFIX=${IMAGE_PREFIX} docker compose -f 
src/docker/docker-compose-gh.yaml run crypto-gh src/docker/build.sh
+      - name: Run on platform
+        run: |
+          IMAGE_PREFIX=${IMAGE_PREFIX} docker compose -f 
src/docker/docker-compose-gh.yaml run crypto-${{ matrix.platform }}-gh \
+            mvn -V -B -ntp surefire:test ${{ matrix.jna_override }}
diff --git a/src/docker/docker-compose-gh.yaml 
b/src/docker/docker-compose-gh.yaml
new file mode 100644
index 00000000..453381ff
--- /dev/null
+++ b/src/docker/docker-compose-gh.yaml
@@ -0,0 +1,42 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Version of docker-compose for use with Github actions
+# References remote images and excludes build info
+
+version: '3'
+services:
+  crypto-gh:
+    image: ${IMAGE_PREFIX}:latest
+    # mount the source and Maven repo
+    volumes:
+      - ../..:/home/crypto
+      - ~/.m2/repository:/root/.m2/repository
+
+  crypto-aarch64-gh:
+    image: ${IMAGE_PREFIX}-aarch64:latest
+    platform: linux/arm64/v8
+    # mount the source and Maven repo
+    volumes:
+      - ../..:/home/crypto
+      - ~/.m2/repository:/root/.m2/repository
+
+  crypto-riscv64-gh:
+    image: ${IMAGE_PREFIX}-riscv64:latest
+    platform: linux/riscv64
+    # mount the source and Maven repo
+    volumes:
+      - ../..:/home/crypto
+      - ~/.m2/repository:/root/.m2/repository

Reply via email to