Skip to content

Commit

Permalink
feat: reuseable workflow
Browse files Browse the repository at this point in the history
Signed-off-by: ChaudharyRaman <[email protected]>

change build_xline workflow

Signed-off-by: ChaudharyRaman <[email protected]>

fix: trailing space

Signed-off-by: ChaudharyRaman <[email protected]>

feat: bump script version

Signed-off-by: ChaudharyRaman <[email protected]>
  • Loading branch information
ChaudharyRaman committed Mar 26, 2024
1 parent 85e7891 commit 2eb0227
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 45 deletions.
33 changes: 13 additions & 20 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,16 @@ jobs:
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Build xline
run: |
docker run -q --rm -v $(pwd):/xline \
-e SCCACHE_GHA_ENABLED=on \
-e ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL} \
-e ACTIONS_RUNTIME_TOKEN=${ACTIONS_RUNTIME_TOKEN} \
ghcr.io/xline-kv/build-env:latest \
cargo build --release --bin xline --bin benchmark
- run: |
cd scripts
cp ../target/release/{xline,benchmark} .
docker build . -t ghcr.io/xline-kv/xline:latest
docker pull datenlord/etcd:v3.5.5
bash ./benchmark.sh
- uses: actions/upload-artifact@v4
with:
name: benchmark-output
path: scripts/out
call_build_xline:
name: Build and Upload Artifacts
uses: ./.github/workflows/build_xline.yml
with:
docker_xline_image: "ghcr.io/xline-kv/build-env:latest"
release_bin: "--bin xline --bin benchmark"
binaries: "xline,benchmark"
additional_setup_commands: |
docker build . -t ghcr.io/xline-kv/xline:latest
docker pull datenlord/etcd:v3.5.5
script_name: "benchmark.sh"
uploadLogs: false
uploadBenchmark: true
80 changes: 80 additions & 0 deletions .github/workflows/build_xline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build Xline
env:
CI_RUST_TOOLCHAIN: 1.71.0
on:
workflow_call:
inputs:
release_bin:
description: "list of binaries to build"
required: true
type: string
additional_setup_commands:
description: "Additional commands to run after initial setup, before running the script"
required: false
default: ""
type: string
docker_xline_image:
description: "Docker image to use for building"
required: true
type: string
binaries:
description: "Comma-separated list of binaries to copy"
required: true
type: string
script_name:
description: "Name of the script to run"
required: true
type: string
uploadLogs:
description: "Boolean to decide if logs should be uploaded"
required: false
default: false
type: boolean
uploadBenchmark:
description: "Boolean to decide if benchmark output should be uploaded"
required: false
default: false
type: boolean
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Configure sccache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Build xline
run: |
docker run -q --rm -v $(pwd):/xline \
-e SCCACHE_GHA_ENABLED=on \
-e ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL} \
-e ACTIONS_RUNTIME_TOKEN=${ACTIONS_RUNTIME_TOKEN} \
${{ inputs.docker_xline_image }} \
cargo build --release ${{ inputs.release_bin }}
- run: |
cd scripts
cp ../target/release/{${{ inputs.binaries }}} .
${{ inputs.additional_setup_commands }}
bash ./${{ inputs.script_name }}
- name: Upload logs
if: ${{ inputs.uploadLogs }} && (failure() || cancelled())
uses: actions/upload-artifact@v4
with:
name: Xline logs
path: scripts/logs

- name: Upload benchmark output
if: ${{ inputs.uploadBenchmark }}
uses: actions/upload-artifact@v4
with:
name: benchmark-output
path: scripts/out
41 changes: 16 additions & 25 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,19 @@ jobs:
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Build xline
run: |
docker run -q --rm -v $(pwd):/xline \
-e SCCACHE_GHA_ENABLED=on \
-e ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL} \
-e ACTIONS_RUNTIME_TOKEN=${ACTIONS_RUNTIME_TOKEN} \
ghcr.io/xline-kv/build-env:latest \
cargo build --release --bin xline --bin benchmark --bin validation_lock_client
- run: |
sudo apt-get install -y --force-yes expect
cd scripts
cp ../target/release/{xline,benchmark,validation_lock_client} .
ldd ./xline
ldd ./benchmark
cp ../fixtures/{private,public}.pem .
docker build . -t ghcr.io/xline-kv/xline:latest
docker pull gcr.io/etcd-development/etcd:v3.5.5
bash ./validation_test.sh
- name: upload logs
if: failure() || cancelled()
uses: actions/upload-artifact@v4
with:
name: Xline logs
path: scripts/logs
call_build_xline:
name: Build and Upload Artifacts
uses: ./.github/workflows/build_xline.yml
with:
release_bin: '--bin xline --bin benchmark --bin validation_lock_client'
docker_xline_image: 'ghcr.io/xline-kv/build-env:latest'
additional_setup_commands: |
sudo apt-get install -y --force-yes expect
ldd ./xline
ldd ./benchmark
cp ../fixtures/{private,public}.pem .
docker build . -t ghcr.io/xline-kv/xline:latest
docker pull gcr.io/etcd-development/etcd:v3.5.5
binaries: 'xline,benchmark,validation_lock_client'
script_name: 'validation_test.sh'
uploadLogs: true

0 comments on commit 2eb0227

Please sign in to comment.