Bump com.google.protobuf:protobuf-java from 3.25.0 to 4.27.3 #363
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
name: Java build EC2 | |
on: [push] | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
start-runner: | |
permissions: write-all | |
name: Start self-hosted EC2 runner | |
runs-on: ubuntu-latest | |
outputs: | |
label: ${{ steps.start-ec2-runner.outputs.label }} | |
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | |
git-tag: ${{ steps.git-tag.outputs.git-tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-central-1 | |
role-to-assume: arn:aws:iam::284098131301:role/github-agoora-agents | |
- name: Start EC2 runner | |
id: start-ec2-runner | |
uses: machulav/ec2-github-runner@v2 | |
with: | |
mode: start | |
github-token: ${{ secrets.REPOS_ACCESS_TOKEN }} | |
ec2-image-id: ${{ vars.EC2_BUILDER_AMI_ID}} | |
# ec2-instance-type: c5a.2xlarge # cost ~0.16 CHF per build (30min build time) | |
ec2-instance-type: c5a.8xlarge # cost ~0.24 CHF per build (20min build time) | |
subnet-id: ${{ vars.EC2_BUILDER_SUBNET_ID}} | |
security-group-id: sg-02302868ae4943d2c | |
aws-resource-tags: > | |
[ | |
{"Key": "Name", "Value": "ec2-github-runner"}, | |
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"} | |
] | |
- name: git tag | |
id: git-tag | |
run: .github/git-tag.sh | |
build: | |
needs: start-runner # required to start the main job when the runner is ready | |
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner | |
env: | |
MAVEN_OPTS: -Xmx4g | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v4 | |
with: | |
maven-version: 3.8.2 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Versions | |
run: | | |
echo "JAVA_HOME: $JAVA_HOME" | |
mvn --v | |
java --version | |
- name: Build with Maven | |
run: mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean package | |
- name: Build native | |
run: mvn --batch-mode package -DskipTests -Pnative | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: maven-output | |
path: | | |
./**/target/*-runner | |
./**/target/quarkus-app/**/* | |
docker-build: | |
needs: | |
- start-runner | |
- build | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_BUILDKIT: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
agents: | |
- agoora-kafka-agent | |
- agoora-mqtt-agent | |
- agoora-openapi-agent | |
- agoora-pgsql-agent | |
- agoora-profiler-service | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: maven-output | |
- name: Check if docker file exist for jar | |
id: dockerfile_jvm_exists | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: "${{ matrix.agents }}/Dockerfile.jvm" | |
- name: Check if docker file exist for native | |
id: dockerfile_native_exists | |
uses: andstor/file-existence-action@v3 | |
with: | |
files: "${{ matrix.agents }}/Dockerfile.native" | |
# restore execute permissions lost in actions/upload-artifact@v4 see https://github.com/actions/upload-artifact/issues/38 | |
- name: restore execute permissions | |
run: | | |
chmod +x ./**/target/*-runner | |
- name: docker build and tag jar | |
if: steps.dockerfile_jvm_exists.outputs.files_exists == 'true' | |
run: | | |
docker build -t spoud/${{ matrix.agents }}:dev -f ./${{ matrix.agents }}/Dockerfile.jvm ./${{ matrix.agents }}/ | |
docker tag spoud/${{ matrix.agents }}:dev spoud/${{ matrix.agents }}:${{ needs.start-runner.outputs.git-tag }} | |
docker tag spoud/${{ matrix.agents }}:dev spoud/${{ matrix.agents }}:latest | |
- name: docker build and tag native | |
if: steps.dockerfile_native_exists.outputs.files_exists == 'true' | |
run: | | |
docker build -t spoud/${{ matrix.agents }}:dev-native -f ./${{ matrix.agents }}/Dockerfile.native ./${{ matrix.agents }}/ | |
docker tag spoud/${{ matrix.agents }}:dev-native spoud/${{ matrix.agents }}:${{ needs.start-runner.outputs.git-tag }}-native | |
docker tag spoud/${{ matrix.agents }}:dev-native spoud/${{ matrix.agents }}:latest-native | |
- name: Login to Docker Hub | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: docker push master | |
if: github.ref == 'refs/heads/master' | |
run: | | |
docker push spoud/${{ matrix.agents }}:${{ needs.start-runner.outputs.git-tag }} || echo "no jar tag to push" | |
docker push spoud/${{ matrix.agents }}:dev || echo "no jar dev to push" | |
docker push spoud/${{ matrix.agents }}:${{ needs.start-runner.outputs.git-tag }}-native || echo "no native tag to push" | |
docker push spoud/${{ matrix.agents }}:dev-native || echo "no native dev to push" | |
- name: docker push tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
docker push spoud/${{ matrix.agents }}:${{ needs.start-runner.outputs.git-tag }} || echo "no jar tag to push" | |
docker push spoud/${{ matrix.agents }}:latest || echo "no jar dev to push" | |
docker push spoud/${{ matrix.agents }}:${{ needs.start-runner.outputs.git-tag }}-native || echo "no native tag to push" | |
docker push spoud/${{ matrix.agents }}:latest-native || echo "no native dev to push" | |
publish-release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: maven-output | |
- name: prepare-binaries | |
run: .github/prepare-binaries.sh | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPOS_ACCESS_TOKEN }} | |
GIT_TAG: ${{ needs.start-runner.outputs.git-tag }} | |
with: | |
body_path: .github/release-body.md | |
files: | | |
README.md | |
LICENCE | |
binaries/* | |
stop-runner: | |
name: Stop self-hosted EC2 runner | |
needs: | |
- start-runner | |
- build | |
runs-on: ubuntu-latest | |
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-central-1 | |
role-to-assume: arn:aws:iam::284098131301:role/github-agoora-agents | |
- name: Stop EC2 runner | |
uses: machulav/ec2-github-runner@v2 | |
with: | |
mode: stop | |
github-token: ${{ secrets.REPOS_ACCESS_TOKEN }} | |
label: ${{ needs.start-runner.outputs.label }} | |
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |