Skip to content

Commit 6e1969f

Browse files
committed
Added pull-request workflows
- pull-request.yml workflow for PR for unstable and release branches - renamed custom_build to custom_ref_type - renamed pre-merge to build-n-test - removed nightly test workflow
1 parent 8c9a31e commit 6e1969f

File tree

5 files changed

+49
-45
lines changed

5 files changed

+49
-45
lines changed

.github/actions/build-and-tag-locally/action.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ inputs:
3535
redistimeseries_version:
3636
description: 'Redistimeseries version to build'
3737
required: false
38-
custom_build:
38+
custom_ref_type:
3939
description: 'Type of custom release, branch tag or commit. Empty for release'
4040
required: false
4141
run_type:
42-
description: 'Run type, either release, nightly, unstable or custom'
42+
description: 'Run type, either release, pr, nightly, unstable or custom'
4343
required: true
4444

4545
runs:
@@ -108,13 +108,13 @@ runs:
108108

109109
- name: Redis release archive
110110
shell: bash
111-
if: inputs.run_type != 'release'
111+
if: inputs.run_type != 'release' && inputs.run_type != 'pr'
112112
run: |
113-
if [[ "${{ inputs.custom_build }}" == "branch" ]]; then
113+
if [[ "${{ inputs.custom_ref_type }}" == "branch" ]]; then
114114
echo "REDIS_DOWNLOAD_URL=https://github.com/redis/redis/archive/refs/heads/${{ inputs.release_tag }}.tar.gz" | tee -a "$GITHUB_ENV"
115-
elif [[ "${{ inputs.custom_build }}" == "tag" ]]; then
115+
elif [[ "${{ inputs.custom_ref_type }}" == "tag" ]]; then
116116
echo "REDIS_DOWNLOAD_URL=https://github.com/redis/redis/archive/refs/tags/${{ inputs.release_tag }}.tar.gz" | tee -a "$GITHUB_ENV"
117-
elif [[ "${{ inputs.custom_build }}" == "commit" ]]; then
117+
elif [[ "${{ inputs.custom_ref_type }}" == "commit" ]]; then
118118
echo "REDIS_DOWNLOAD_URL=https://github.com/redis/redis/archive/${{ inputs.release_tag }}.tar.gz" | tee -a "$GITHUB_ENV"
119119
else
120120
echo "Wrong custom_build type, available options are tag, branch and commit"
@@ -137,8 +137,8 @@ runs:
137137
REDISJSON_VERSION=${{ inputs.redisjson_version }}
138138
REDISBLOOM_VERSION=${{ inputs.redisbloom_version }}
139139
REDISTIMESERIES_VERSION=${{ inputs.redistimeseries_version }}
140-
${{ inputs.run_type != 'release' && 'CUSTOM_BUILD=true' || '' }}
141-
${{ inputs.run_type != 'release' && format('REDIS_DOWNLOAD_URL={0}', env.REDIS_DOWNLOAD_URL) || '' }}
140+
${{ (inputs.run_type != 'release' && inputs.run_type != 'pr') && 'CUSTOM_BUILD=true' || '' }}
141+
${{ (inputs.run_type != 'release' && inputs.run_type != 'pr') && format('REDIS_DOWNLOAD_URL={0}', env.REDIS_DOWNLOAD_URL) || '' }}
142142
143143
- name: Capture build logs on failure
144144
shell: bash
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11

22
name: Build and Test
33
on:
4-
pull_request:
5-
branches:
6-
- master
7-
- release/*
84
workflow_call:
95
inputs:
106
release_tag:
@@ -32,12 +28,12 @@ on:
3228
required: false
3329
type: boolean
3430
default: false
35-
custom_build:
31+
custom_ref_type:
3632
description: 'Custom type, either branch, tag or commit. Empty for releases'
3733
required: false
3834
type: string
3935
run_type:
40-
description: 'Run type, either release, unstable, nightly or custom'
36+
description: 'Run type, either release, pr, unstable, nightly or custom'
4137
required: false
4238
type: string
4339
outputs:
@@ -92,20 +88,20 @@ jobs:
9288
platform: ${{ matrix.platform }}
9389
registry_username: ${{ github.actor }}
9490
registry_password: ${{ secrets.GITHUB_TOKEN }}
95-
publish_image: ${{ inputs.publish_image || vars.PUBLISH_IMAGE }}
91+
publish_image: ${{ inputs.publish_image }}
9692
registry_repository: ${{ format('ghcr.io/{0}', github.repository) }}
9793
release_tag: ${{ inputs.release_tag }}
9894
redisearch_version: ${{ inputs.redisearch_version }}
9995
redisjson_version: ${{ inputs.redisjson_version }}
10096
redisbloom_version: ${{ inputs.redisbloom_version }}
10197
redistimeseries_version: ${{ inputs.redistimeseries_version }}
102-
custom_build: ${{ inputs.custom_build }}
98+
custom_ref_type: ${{ inputs.custom_ref_type }}
10399
run_type: ${{ inputs.run_type }}
104100

105101
collect-images-metadata:
106102
runs-on: ubuntu-latest
107103
needs: build-and-test
108-
if: ${{ inputs.release_tag }}
104+
if: ${{ inputs.release_tag && inputs.run_type == 'release' }}
109105
outputs:
110106
docker_images_metadata: ${{ steps.collect-metadata.outputs.metadata }}
111107
steps:

.github/workflows/pull-request.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Pull Request Build and Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- release/*
8+
- unstable
9+
10+
jobs:
11+
build-and-test:
12+
uses: ./.github/workflows/build-n-test.yml
13+
if: github.event_name == 'pull_request' && github.base_ref != 'unstable'
14+
secrets: inherit
15+
with:
16+
release_tag: ''
17+
publish_image: false
18+
run_type: pr
19+
20+
build-and-test-unstable:
21+
uses: ./.github/workflows/build-n-test.yml
22+
if: github.event_name == 'pull_request' && github.base_ref == 'unstable'
23+
secrets: inherit
24+
with:
25+
release_tag: unstable
26+
publish_image: false
27+
redisearch_version: master
28+
redisjson_version: master
29+
redisbloom_version: master
30+
redistimeseries_version: master
31+
custom_ref_type: branch
32+
run_type: unstable

.github/workflows/release_build_and_test.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
redistimeseries_version:
2727
description: 'Redistimeseries version to build'
2828
required: false
29-
custom_build:
29+
custom_ref_type:
3030
description: 'Custom type, either branch, tag or commit. Empty for releases'
3131
required: false
3232
run_type:
@@ -73,7 +73,7 @@ jobs:
7373
release_version_branch: ${{ steps.ensure-branch.outputs.release_version_branch }}
7474

7575
build-and-test:
76-
uses: ./.github/workflows/pre-merge.yml
76+
uses: ./.github/workflows/build-n-test.yml
7777
needs: prepare-release
7878
if: always() && (needs.prepare-release.result == 'success' || needs.prepare-release.result == 'skipped')
7979
secrets: inherit
@@ -84,22 +84,19 @@ jobs:
8484
redisjson_version: ${{ github.event.inputs.redisjson_version }}
8585
redisbloom_version: ${{ github.event.inputs.redisbloom_version }}
8686
redistimeseries_version: ${{ github.event.inputs.redistimeseries_version }}
87-
custom_build: ${{ github.event.inputs.custom_build }}
87+
custom_ref_type: ${{ github.event.inputs.custom_ref_type }}
8888
run_type: ${{ github.event.inputs.run_type }}
8989

9090
merge-back-to-release-branch:
9191
needs: [prepare-release, build-and-test]
92-
if: success()
92+
if: success() && github.event.inputs.run_type == 'release' && github.event.inputs.release_tag != 'unstable'
9393
runs-on: ["ubuntu-latest"]
9494
steps:
9595
- name: Checkout code
9696
uses: actions/checkout@v4
97-
with:
98-
ref: ${{ github.event.inputs.release_tag == 'unstable' && 'unstable' || '' }}
9997

10098
- name: Ensure Release Branch
10199
id: ensure-branch
102-
if: github.event.inputs.release_tag != 'unstable'
103100
uses: redis-developer/redis-oss-release-automation/.github/actions/ensure-release-branch@main
104101
with:
105102
release_tag: ${{ github.event.inputs.release_tag }}
@@ -108,7 +105,6 @@ jobs:
108105

109106
- name: Merge back to release branch
110107
id: merge-back
111-
if: github.event.inputs.release_tag != 'unstable'
112108
uses: redis-developer/redis-oss-release-automation/.github/actions/merge-branches-verified@main
113109
with:
114110
from_branch: ${{ steps.ensure-branch.outputs.release_version_branch }}

.github/workflows/test-nightly-unstable.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)