Skip to content

Commit

Permalink
Adding dev flows
Browse files Browse the repository at this point in the history
  • Loading branch information
mirzakaracic committed Nov 22, 2024
1 parent 3977e29 commit 1c5685f
Show file tree
Hide file tree
Showing 13 changed files with 356 additions and 26 deletions.
44 changes: 44 additions & 0 deletions .github/actions/run-ee-server/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Run EE Server"
description: "Run EE server. Returns once server is ready. Only tested on Linux and macOS"

inputs:
# All inputs in composite actions are strings
use-server-rc:
description: Flag for rc candidates
required: true
default: "false"
server-tag:
description: Server version to use
required: true
default: "latest"
# Github Composite Actions can't access secrets
# so we need to pass them in as inputs
docker-hub-username:
description: Dockerhub username
required: false
docker-hub-password:
description: Dockerhub password
required: false
container-repo-url:
required: false
description: Container repo url
default: aerospike.jfrog.io/docker/

runs:
using: "composite"
steps:
- name: Log into Docker Hub to get server RC
if: ${{ inputs.use-server-rc == 'true' }}
run: docker login ${{ inputs.container-repo-url }} --username ${{ inputs.docker-hub-username }} --password ${{ inputs.docker-hub-password }}
shell: bash

- run: echo IMAGE_NAME=${{ inputs.use-server-rc == 'true' && inputs.container-repo-url || '' }}aerospike/aerospike-server-enterprise${{ inputs.use-server-rc == 'true' && '-rc' || '' }}:${{ inputs.server-tag }} >> $GITHUB_ENV
shell: bash

- run: docker run -d --name aerospike -p 3000:3000 ${{ env.IMAGE_NAME }}
shell: bash

- uses: ./.github/actions/wait-for-as-server-to-start
with:
container-name: aerospike
is-security-enabled: true
46 changes: 46 additions & 0 deletions .github/actions/upload-to-jfrog/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish artifacts to JFrog
description: "Publishes artifacts to JFrog"

inputs:
version:
description: ""
required: true
jdk-version:
description: ""
required: true
jfrog-repo-name:
description: ""
required: false
default: aerospike-maven-dev-local
jfrog-platform-url:
description: ""
required: false
default: https://aerospike.jfrog.io/
oidc-provider:
description: ""
required: false
default: gh-aerospike-clients
oidc-audience:
description: ""
required: false
default: aerospike/clients

runs:
using: "composite"
steps:
- name: Set up JFrog credentials
uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: ${{ inputs.jfrog-platform-url }}
with:
oidc-provider-name: ${{ inputs.oidc-provider }}
oidc-audience: ${{ inputs.oidc-audience }}

- name: Upload from branches to JFrog
shell: bash
# Only interested in `aerospike-proxy-client-x.x.x....` and `aerospike-client-jdkx-x.x.x....`
run: jf rt upload --regexp=true --dry-run "aerospike-(proxy-client|client-(jdk\d+))-\d+\.\d+\.\d+(-jar-with-dependencies)?\.jar" "${{ inputs.jfrog-repo-name }}"

- name: Publish build info
shell: bash
run: jf rt build-publish --dry-run ${{ inputs.jdk-version == 'jdk8' && 'aerospike-client-jdk8' || 'aerospike-client-jdk21' }} ${{ inputs.version }}
22 changes: 22 additions & 0 deletions .github/actions/wait-for-as-server-to-start/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Wait for Aerospike server to start"
description: Only tested on Linux and macOS
inputs:
container-name:
description: Container name
required: true
is-security-enabled:
description: Flag to toggle docker hub creds use. With this flag enabled before attempting to pull image we will attempt to log in do docker hub.
required: false
default: "false"

runs:
using: "composite"
steps:
# Composite actions doesn't support step-level timeout-minutes
# Use timeout command and store polling logic in file to make it easier to read
# Call bash shell explicitly since timeout uses "sh" shell by default, for some reason
# Also, we don't want to fail if we timeout in case the server *did* finish starting up but the script couldn't detect it due to a bug
# Effectively, this composite action is like calling "sleep" that is optimized to exit early when it detects an ok from the server
- name: Wait for EE server to start
run: timeout 30 bash ./.github/workflows/scripts/wait-for-as-server-to-start.sh ${{ inputs.container-name }} ${{ inputs.is-security-enabled }} || true
shell: bash
76 changes: 76 additions & 0 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on:
workflow_call:
inputs:
branch:
type: string
required: true
source-branch:
type: string
required: false
use-server-rc:
type: boolean
required: false
default: false
description: "Test against server release candidate?"
server-tag:
type: string
required: false
default: "latest"
description: "Server docker image tag"
upload-artifacts:
type: boolean
required: false
default: false
description: "Upload built artifacts to github?"
bump-version:
type: boolean
required: false
default: false
description: "Bump artifact version"

jobs:
debug-job:
runs-on: ubuntu-latest
steps:
- name: debug
run: |
echo "${{ inputs.branch }}"
echo "${{ github.base_ref }}"
java-version:
needs: debug-job
runs-on: ubuntu-latest
outputs:
java-version: ${{ steps.get-java-version.outputs.java-version }}
steps:
- name: Checkout client
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- name: Get java version
id: get-java-versiona
run: |
echo java_version="$(grep \"<java.version>\" pom.xml | sed -e 's/<[^>]*>//g' | awk '{$1=$1};1')" >> $GITHUB_ENV
build:
uses: ./.github/workflows/build.yaml
needs: java-version
with:
java-version: ${{ needs.java-version.outputs.java-version }}
branch: ${{ inputs.branch }}
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}
upload-artifacts: ${{ inputs.upload-artifacts }}
secrets: inherit

# build-java-8:
# if: ${{ inputs.source-branch == 'dev-jdk8/*' }}
# uses: ./.github/workflows/build.yaml
# with:
# java-version: 8
# branch: ${{ inputs.branch }}
# use-server-rc: ${{ inputs.use-server-rc }}
# server-tag: ${{ inputs.server-tag }}
# upload-artifacts: ${{ inputs.upload-artifacts }}
# secrets: inherit
77 changes: 77 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build artifacts

permissions:
# This is required for requesting the OIDC token
id-token: write

on:
workflow_call:
inputs:
branch:
type: string
required: true
java-version:
type: number
required: true
use-server-rc:
type: boolean
required: false
default: false
description: "Test against server release candidate?"
server-tag:
type: string
required: false
default: "latest"
description: "Server docker image tag"
upload-artifacts:
type: boolean
required: false
default: false
description: "Upload built artifacts to github?"
secrets:
JFROG_USERNAME:
required: true
JFROG_DOCKER_TOKEN:
required: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout client
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "semeru" # See 'Supported distributions' for available options
java-version: ${{ inputs.java-version }}

- name: Debug, list files
run: |
ls -laR .github
echo "Checked out branch ${{ inputs.branch }}"
- name: Run EE server
uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}
docker-hub-username: ${{ secrets.JFROG_USERNAME }}
docker-hub-password: ${{ secrets.JFROG_DOCKER_TOKEN }}

- name: Build
run: mvn javadoc:jar source:jar install gpg:sign -P sign -Dcrypto.type=

- name: Test
working-directory: test
run: mvn test -DskipTests=false

- name: Upload to JFrog
if: ${{ !cancelled() && inputs.upload-artifacts == true }}
uses: ./.github/actions/upload-to-jfrog
with:
version: ${{ steps.get-new-version.outputs.new_version }}
jdk-version: "jdk${{ inputs.java-version }}"
21 changes: 0 additions & 21 deletions .github/workflows/build.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/pull-request-open-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: PR open

on:
pull_request:
branches:
- "dev/*"
types:
- opened
- reopened
workflow_dispatch:
inputs:
source-branch:
type: string
description: Base branch to use if manually starting. By default base_ref will empty if triggering manually hence base_ref is only available on PRs.

jobs:
test-with-server-release:
name: Build stage - Test with latest version of Aerospike Enterprise Server
uses: ./.github/workflows/build-dev.yaml
with:
branch: ${{ github.ref }}
source-branch: ${{ inputs.source-branch || github.base_ref }}
use-server-rc: false
upload-artifacts: false
secrets: inherit

test-with-server-rc:
name: Build stage - Test with latest RC version of Aerospike Enterprise Server
uses: ./.github/workflows/build-dev.yaml
with:
branch: ${{ github.base_ref || inputs.branch }}
source-branch: ${{ inputs.source-branch || github.base_ref }}
use-server-rc: true
upload-artifacts: false
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/push-to-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Push to dev

on:
push:
branches:
- dev/*
workflow_dispatch:

jobs:
build-stage:
name: Build stage
uses: ./.github/workflows/build-dev.yaml
with:
branch: ${{ github.ref }}
upload-artifacts: true
secrets: inherit
2 changes: 1 addition & 1 deletion benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>9.0.0</version>
<version>9.0.1</version>
</parent>
<artifactId>aerospike-benchmarks</artifactId>
<packaging>jar</packaging>
Expand Down
Loading

0 comments on commit 1c5685f

Please sign in to comment.