temp #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Java CI with Maven | |
on: | |
workflow_dispatch: | |
inputs: | |
run-tests: | |
description: 'Should run tests?' | |
required: true | |
default: 'Yes' | |
type: choice | |
options: | |
- Yes | |
- No | |
push: | |
branches: [ main-test ] | |
pull_request: | |
branches: [ main-test ] | |
jobs: | |
build-java: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
platform: linux/amd64 | |
- os: macos-14 | |
platform: linux/arm64 | |
- os: macos-13 | |
platform: linux/arm/v7 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check build version | |
run: make check-build-version | |
- name: Check space before free up the space | |
run: df -h | |
- name: Free up space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /usr/local/.ghcup | |
sudo rm -rf /usr/share/swift | |
- name: Setup containerd driver type | |
run: | | |
echo '{ "features": { "containerd-snapshotter": true } }' | sudo tee /etc/docker/daemon.json | |
export BUILDX_EXPERIMENTAL=1 | |
sudo systemctl restart docker | |
docker info -f '{{ .DriverStatus }}' | |
docker info | |
- name: Install Docker Compose | |
run: | | |
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
docker-compose --version | |
- name: Cache Maven dependencies | |
uses: actions/cache@v4 | |
id: maven-cache | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('java/pom.xml','**/pom.xml', 'services/*/pom.xml', 'java/*/pom.xml', 'java/*/*/pom.xml', 'java/*/*/*/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/docker-layer-cache | |
key: ${{ runner.os }}-docker-cache-registry-claims | |
restore-keys: | | |
${{ runner.os }}-docker-cache-registry-claims | |
- name: Check space before tests | |
run: df -h | |
- name: Login to Docker Registry | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up properties | |
run: sh configure-dependencies.sh | |
- name: Build Java Services | |
env: | |
CACHE_SRC: type=local,src=/tmp/docker-layer-cache | |
CACHE_DST: type=local,dest=/tmp/docker-layer-cache | |
PLATFORM: ${{ matrix.platform }} | |
MAVEN_CACHE: ${{ steps.maven-cache.outputs.cache-hit }} | |
run: make build-java | |
- name: Publish build artifacts | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
run: make publish-builds | |
- name: Check space after tests | |
run: | | |
df -h | |
docker image ls | |
build-services: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
name: encryption-service | |
platform: linux/amd64 | |
type: maven | |
- os: ubuntu-latest | |
name: id-gen-service | |
platform: linux/amd64 | |
type: maven | |
- os: ubuntu-latest | |
name: notification-service | |
platform: linux/amd64 | |
- os: ubuntu-latest | |
name: metrics | |
platform: linux/amd64 | |
- os: ubuntu-latest | |
name: identity-service | |
platform: linux/amd64 | |
- os: ubuntu-latest | |
name: credential-schema | |
platform: linux/amd64 | |
- os: ubuntu-latest | |
name: credentials-service | |
platform: linux/amd64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup containerd driver type | |
run: | | |
echo '{ "features": { "containerd-snapshotter": true } }' | sudo tee /etc/docker/daemon.json | |
export BUILDX_EXPERIMENTAL=1 | |
sudo systemctl restart docker | |
docker info -f '{{ .DriverStatus }}' | |
docker info | |
- name: Install Docker Compose | |
run: | | |
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
docker-compose --version | |
docker system df | |
- name: Login to Docker Registry | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Cache Maven dependencies | |
if: matrix.type == 'maven' | |
uses: actions/cache@v4 | |
id: maven-cache | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('java/pom.xml','**/pom.xml', 'services/*/pom.xml', 'java/*/pom.xml', 'java/*/*/pom.xml', 'java/*/*/*/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/docker-layer-cache | |
key: ${{ runner.os }}-docker-cache-${{ matrix.name }} | |
restore-keys: | | |
${{ runner.os }}-docker-cache-${{ matrix.name }} | |
- name: Build Node Services | |
env: | |
CACHE_SRC: type=local,src=/tmp/docker-layer-cache | |
CACHE_DST: type=local,dest=/tmp/docker-layer-cache | |
PLATFORM: ${{ matrix.platform }} | |
run: make -C services/${{ matrix.name }}/ docker | |
- name: Publish build artifacts | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
run: make publish-builds | |
- name: Check space after tests | |
run: | | |
df -h | |
docker image ls | |
docker system df | |
test-builds-2: | |
if: github.event.inputs['run-tests'] == 'Yes' | |
needs: | |
- build-java | |
- build-services | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
name: test-node-1 | |
- os: ubuntu-latest | |
name: test-node-2 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check build version | |
run: make check-build-version | |
- name: Install Docker Compose | |
run: | | |
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
docker-compose --version | |
- name: Login to Docker Registry | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Pull docker builds | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
run: make pull-builds | |
- name: Test builds - ${{ matrix.name }} | |
run: make ${{ matrix.name }} | |
# test-builds: | |
# runs-on: ubuntu-latest | |
# needs: | |
# - build-java | |
# - build-go | |
# - build-node | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Check build version | |
# run: make check-build-version | |
# - name: Install Docker Compose | |
# run: | | |
# curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
# chmod +x /usr/local/bin/docker-compose | |
# docker-compose --version | |
# - name: Login to Docker Registry | |
# uses: docker/login-action@v1 | |
# with: | |
# username: ${{ secrets.DOCKER_USERNAME }} | |
# password: ${{ secrets.DOCKER_PASSWORD }} | |
# - name: Pull docker builds | |
# run: make pull-builds | |
# - name: Test builds | |
# run: make test | |
# - name: Setup upterm session | |
# uses: lhotari/action-upterm@v1 | |
# with: | |
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow ie holashchand | |
# limit-access-to-actor: true | |
# test: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Run all the containers and test | |
# run : make test |