Skip to content

Commit

Permalink
Github action to build on tag and push
Browse files Browse the repository at this point in the history
Signed-off-by: Dusan Malusev <[email protected]>
  • Loading branch information
CodeLieutenant committed Jul 17, 2024
1 parent da3edbc commit 7cab02c
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 91 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: "Build Cassandra-Stress"

on:
workflow_dispatch:
inputs:
version:
required: false
description: 'Version of the release'
default: ''
latest:
required: false
default: false
description: 'Build latest version'
workflow_call:
inputs:
version:
required: false
description: 'Version of the release'
type: boolean
default: ''
latest:
required: false
default: false
type: boolean
description: 'Build latest version'
jobs:
build:
strategy:
matrix:
java: [ '11' ]
os: [ 'ubuntu-latest' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: ${{ matrix.java }}
cache: 'maven'
cache-dependency-path: |
build/cassandra-stress*.pom
- name: Setup Ant
uses: cedx/setup-ant@v2
with:
optional-tasks: true
version: latest
- name: Build with version ${{ inputs.version }}
if: ${{ inputs.version != '' }}
run: ant -Dversion=${{ inputs.version }} jar
- name: Build latest
if: ${{ inputs.version != '' }}
run: ant jar
- name: Artifacts
if: ${{ inputs.version != '' }}
run: ant -Dversion=${{ inputs.version }} artifacts
- name: Release
uses: softprops/action-gh-release@v2
id: release
if: ${{ inputs.version != '' }}
with:
make_latest: ${{ inputs.latest }}
name: "v${{ steps.version_tag.outputs.tag }}"
tag_name: "v${{ steps.version_tag.outputs.tag }}"
generate_release_notes: true
append_body: true
prerelease: false
fail_on_unmatched_files: true
files: |
build/cassandra-stress-${{ inputs.version }}-bin.tar.gz
build/cassandra-stress-${{ inputs.version }}-bin.tar.gz.sha256
build/cassandra-stress-${{ inputs.version }}-bin.tar.gz.sha512
build/cassandra-stress-${{ inputs.version }}-src.tar.gz
build/cassandra-stress-${{ inputs.version }}-src.tar.gz.sha256
build/cassandra-stress-${{ inputs.version }}-src.tar.gz.sha512
- name: "Generate release changelog"
if: ${{ inputs.version != '' }}
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
author: true
releaseUrl: ${{ steps.release.outputs.url }}
issues: false
pullRequests: true
- uses: stefanzweifel/git-auto-commit-action@v5
if: ${{ inputs.version != '' }}
with:
commit_message: "Update CHANGELOG.md"
branch: master
commit_options: '--no-verify --signoff'
file_pattern: CHANGELOG.md
7 changes: 4 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ on:
required: false
type: boolean
image:
default: 'ghcr.io/codelieutenant/website'
default: 'scylladb/cassandra-stress'
required: false
type: string
secrets:
Expand Down Expand Up @@ -75,7 +75,6 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push API
if: ${{ inputs.dev }}
uses: docker/build-push-action@v5
with:
file: Dockerfile
Expand All @@ -85,4 +84,6 @@ jobs:
platforms: ${{ inputs.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ inputs.image }}:${{ inputs.version }}
tags: ${{ inputs.image }}:latest, ${{ inputs.image }}:${{ inputs.version }}
build-args: |
VERSION=${{ inputs.version }}
13 changes: 13 additions & 0 deletions .github/workflows/push-pull-req.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "On Push/Pull Request"

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build:
uses: "./.github/workflows/build.yml"
12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,21 @@ jobs:
branch: master
commit_options: '--no-verify --signoff'
file_pattern: CHANGELOG.md
docker_image:
docker:
needs: ['create_release']
uses: "./.github/workflows/docker.yml"
with:
docker_target: production
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
version: ${{ inputs.version }}
image: ${{ vars.IMAGE }}
secrets:
CR_PAT: ${{ secrets.CR_PAT }}
REGISTRY: ${{ secrets.REGISTRY }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
build:
needs: ['create_release']
uses: "./.github/workflows/build.yml"
with:
version: ${{ inputs.version }}
latest: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apk update \
&& apk add apache-ant bash \
&& ant realclean \
&& mkdir -p build lib \
&& ant -Dversion=${VERSION} maven-declare-dependencies artifacts \
&& ant -Dversion=$VERSION maven-declare-dependencies artifacts \
&& bash ./SCYLLA-VERSION-GEN \
&& cp build/SCYLLA-* build/dist/

Expand Down
84 changes: 0 additions & 84 deletions test/unit/com/scylladb/tools/ColumnNamesMappingTest.java

This file was deleted.

0 comments on commit 7cab02c

Please sign in to comment.