Skip to content

Commit 4f0d3f3

Browse files
committed
Adding dev flows
1 parent 3a77e18 commit 4f0d3f3

File tree

9 files changed

+363
-21
lines changed

9 files changed

+363
-21
lines changed
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "Run EE Server"
2+
description: "Run EE server. Returns once server is ready. Only tested on Linux and macOS"
3+
4+
inputs:
5+
# All inputs in composite actions are strings
6+
use-server-rc:
7+
description: Flag for rc candidates
8+
required: true
9+
default: "false"
10+
server-tag:
11+
description: Server version to use
12+
required: true
13+
default: "latest"
14+
# Github Composite Actions can't access secrets
15+
# so we need to pass them in as inputs
16+
docker-hub-username:
17+
description: Dockerhub username
18+
required: false
19+
docker-hub-password:
20+
description: Dockerhub password
21+
required: false
22+
container-repo-url:
23+
required: false
24+
description: Container repo url
25+
default: aerospike.jfrog.io/docker/
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- name: Log into Docker Hub to get server RC
31+
if: ${{ inputs.use-server-rc == 'true' }}
32+
run: docker login ${{ inputs.container-repo-url }} --username ${{ inputs.docker-hub-username }} --password ${{ inputs.docker-hub-password }}
33+
shell: bash
34+
35+
- 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
36+
shell: bash
37+
38+
- run: docker run -d --name aerospike -p 3000:3000 ${{ env.IMAGE_NAME }}
39+
shell: bash
40+
41+
- uses: ./.github/actions/wait-for-as-server-to-start
42+
with:
43+
container-name: aerospike
44+
is-security-enabled: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish artifacts to JFrog
2+
description: "Publishes artifacts to JFrog"
3+
4+
inputs:
5+
version:
6+
description: ""
7+
required: true
8+
jdk-version:
9+
description: ""
10+
required: true
11+
jfrog-repo-name:
12+
description: ""
13+
required: false
14+
default: aerospike-maven-dev-local
15+
jfrog-platform-url:
16+
description: ""
17+
required: false
18+
default: https://aerospike.jfrog.io/
19+
oidc-provider:
20+
description: ""
21+
required: false
22+
default: gh-aerospike-clients
23+
oidc-audience:
24+
description: ""
25+
required: false
26+
default: aerospike/clients
27+
28+
runs:
29+
using: "composite"
30+
steps:
31+
- name: Set up JFrog credentials
32+
uses: jfrog/setup-jfrog-cli@v3
33+
env:
34+
JF_URL: ${{ inputs.jfrog-platform-url }}
35+
with:
36+
oidc-provider-name: ${{ inputs.oidc-provider }}
37+
oidc-audience: ${{ inputs.oidc-audience }}
38+
39+
- name: Upload from branches to JFrog
40+
shell: bash
41+
# Only interested in `aerospike-proxy-client-x.x.x....` and `aerospike-client-jdkx-x.x.x....`
42+
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 }}"
43+
44+
- name: Publish build info
45+
shell: bash
46+
run: jf rt build-publish --dry-run ${{ inputs.jdk-version == 'jdk8' && 'aerospike-client-jdk8' || 'aerospike-client-jdk21' }} ${{ inputs.version }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Wait for Aerospike server to start"
2+
description: Only tested on Linux and macOS
3+
inputs:
4+
container-name:
5+
description: Container name
6+
required: true
7+
is-security-enabled:
8+
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.
9+
required: false
10+
default: "false"
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
# Composite actions doesn't support step-level timeout-minutes
16+
# Use timeout command and store polling logic in file to make it easier to read
17+
# Call bash shell explicitly since timeout uses "sh" shell by default, for some reason
18+
# 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
19+
# Effectively, this composite action is like calling "sleep" that is optimized to exit early when it detects an ok from the server
20+
- name: Wait for EE server to start
21+
run: timeout 30 bash ./.github/workflows/scripts/wait-for-as-server-to-start.sh ${{ inputs.container-name }} ${{ inputs.is-security-enabled }} || true
22+
shell: bash

.github/workflows/build-dev.yaml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
branch:
5+
type: string
6+
required: true
7+
source-branch:
8+
type: string
9+
required: false
10+
use-server-rc:
11+
type: boolean
12+
required: false
13+
default: false
14+
description: "Test against server release candidate?"
15+
server-tag:
16+
type: string
17+
required: false
18+
default: "latest"
19+
description: "Server docker image tag"
20+
upload-artifacts:
21+
type: boolean
22+
required: false
23+
default: false
24+
description: "Upload built artifacts to github?"
25+
bump-version:
26+
type: boolean
27+
required: false
28+
default: false
29+
description: "Bump artifact version"
30+
31+
jobs:
32+
debug-job:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: debug
36+
run: |
37+
echo "${{ inputs.branch }}"
38+
echo "${{ github.base_ref }}"
39+
40+
java-version:
41+
needs: debug-job
42+
runs-on: ubuntu-latest
43+
outputs:
44+
java-version: ${{ steps.get-java-version.outputs.java-version }}
45+
steps:
46+
- name: Checkout client
47+
uses: actions/checkout@v4
48+
with:
49+
ref: ${{ inputs.branch }}
50+
51+
- name: Get java version
52+
id: get-java-version
53+
run: |
54+
echo java-version="$(grep '<java.version>' pom.xml | sed -e 's/<[^>]*>//g' | awk '{$1=$1};1')" >> $GITHUB_OUTPUT
55+
56+
- name: debug - print java-version
57+
run: |
58+
echo ${{ steps.get-java-version.outputs.java-version }}
59+
60+
debug-java-version-job:
61+
runs-on: ubuntu-latest
62+
needs: java-version
63+
steps:
64+
- name: debug
65+
run: |
66+
echo "${{ needs.java-version.outputs.java-version }}"
67+
68+
build:
69+
uses: ./.github/workflows/build.yaml
70+
needs: java-version
71+
with:
72+
java-version: ${{ needs.java-version.outputs.java-version }}
73+
branch: ${{ inputs.branch }}
74+
use-server-rc: ${{ inputs.use-server-rc }}
75+
server-tag: ${{ inputs.server-tag }}
76+
upload-artifacts: ${{ inputs.upload-artifacts }}
77+
secrets: inherit
78+
79+
# build-java-8:
80+
# if: ${{ inputs.source-branch == 'dev-jdk8/*' }}
81+
# uses: ./.github/workflows/build.yaml
82+
# with:
83+
# java-version: 8
84+
# branch: ${{ inputs.branch }}
85+
# use-server-rc: ${{ inputs.use-server-rc }}
86+
# server-tag: ${{ inputs.server-tag }}
87+
# upload-artifacts: ${{ inputs.upload-artifacts }}
88+
# secrets: inherit

.github/workflows/build.yaml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build artifacts
2+
3+
permissions:
4+
# This is required for requesting the OIDC token
5+
id-token: write
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
branch:
11+
type: string
12+
required: true
13+
java-version:
14+
type: string
15+
required: true
16+
use-server-rc:
17+
type: boolean
18+
required: false
19+
default: false
20+
description: "Test against server release candidate?"
21+
server-tag:
22+
type: string
23+
required: false
24+
default: "latest"
25+
description: "Server docker image tag"
26+
upload-artifacts:
27+
type: boolean
28+
required: false
29+
default: false
30+
description: "Upload built artifacts to github?"
31+
secrets:
32+
JFROG_USERNAME:
33+
required: true
34+
JFROG_DOCKER_TOKEN:
35+
required: true
36+
37+
jobs:
38+
build:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout client
42+
uses: actions/checkout@v4
43+
with:
44+
ref: ${{ inputs.branch }}
45+
46+
- name: Setup Java
47+
uses: actions/setup-java@v4
48+
with:
49+
distribution: "semeru" # See 'Supported distributions' for available options
50+
java-version: ${{ inputs.java-version }}
51+
52+
- name: Debug, list files
53+
run: |
54+
ls -laR .github
55+
echo "Checked out branch ${{ inputs.branch }}"
56+
57+
- name: Run EE server
58+
uses: ./.github/actions/run-ee-server
59+
with:
60+
use-server-rc: ${{ inputs.use-server-rc }}
61+
server-tag: ${{ inputs.server-tag }}
62+
docker-hub-username: ${{ secrets.JFROG_USERNAME }}
63+
docker-hub-password: ${{ secrets.JFROG_DOCKER_TOKEN }}
64+
65+
- name: Build
66+
run: mvn javadoc:jar source:jar install gpg:sign -P sign -Dcrypto.type=
67+
68+
- name: Test
69+
working-directory: test
70+
run: mvn test -DskipTests=false
71+
72+
- name: Upload to JFrog
73+
if: ${{ !cancelled() && inputs.upload-artifacts == true }}
74+
uses: ./.github/actions/upload-to-jfrog
75+
with:
76+
version: ${{ steps.get-new-version.outputs.new_version }}
77+
jdk-version: "jdk${{ inputs.java-version }}"

.github/workflows/build.yml

-21
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PR open
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "dev/*"
7+
types:
8+
- opened
9+
- reopened
10+
workflow_dispatch:
11+
inputs:
12+
source-branch:
13+
type: string
14+
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.
15+
16+
jobs:
17+
test-with-server-release:
18+
name: Build stage - Test with latest version of Aerospike Enterprise Server
19+
uses: ./.github/workflows/build-dev.yaml
20+
with:
21+
branch: ${{ github.ref }}
22+
source-branch: ${{ inputs.source-branch || github.base_ref }}
23+
use-server-rc: false
24+
upload-artifacts: false
25+
secrets: inherit
26+
27+
test-with-server-rc:
28+
name: Build stage - Test with latest RC version of Aerospike Enterprise Server
29+
uses: ./.github/workflows/build-dev.yaml
30+
with:
31+
branch: ${{ github.base_ref || inputs.branch }}
32+
source-branch: ${{ inputs.source-branch || github.base_ref }}
33+
use-server-rc: true
34+
upload-artifacts: false
35+
secrets: inherit

.github/workflows/push-to-dev.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Push to dev
2+
3+
on:
4+
push:
5+
branches:
6+
- dev/*
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-stage:
11+
name: Build stage
12+
uses: ./.github/workflows/build-dev.yaml
13+
with:
14+
branch: ${{ github.ref }}
15+
upload-artifacts: true
16+
secrets: inherit

0 commit comments

Comments
 (0)