Skip to content

Commit

Permalink
Fixed updating the library version in the CD workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
barshaul committed Feb 15, 2024
1 parent b17a77f commit cdb8ca8
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 16 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/npm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
name: Continuous Deployment

on:
pull_request:
paths:
- .github/workflows/npm-cd.yml
- .github/workflows/build-node-wrapper/action.yml
push:
tags:
- "v*.*"
Expand Down Expand Up @@ -56,7 +60,8 @@ jobs:
- name: Set the release version
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
export version=`if ${{ github.event_name == 'pull_request' }}; then echo '255.255.255'; else echo ${GITHUB_REF:11}; fi`
echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV
- name: Setup node
if: matrix.build.NPM_PUBLISH == true
Expand All @@ -68,7 +73,13 @@ jobs:
scope: "${{ vars.NPM_SCOPE }}"
always-auth: true
token: ${{ secrets.NPM_AUTH_TOKEN }}


- name: Update package version in config.toml
uses: ./.github/workflows/update-glide-version
with:
folder_path: "${{ github.workspace }}/node/rust-client/.cargo"
named_os: ${{ matrix.build.NAMED_OS }}

- name: Build Node wrapper
if: matrix.build.NPM_PUBLISH == true
uses: ./.github/workflows/build-node-wrapper
Expand All @@ -82,7 +93,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to NPM
if: matrix.build.NPM_PUBLISH == true
if: matrix.build.NPM_PUBLISH == true && github.event_name != 'pull_request'
shell: bash
working-directory: ./node
run: |
Expand Down Expand Up @@ -190,6 +201,7 @@ jobs:
done
- name: Publish the base package
if: github.event_name != 'pull_request'
shell: bash
working-directory: ./node/npm/glide
run: |
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/pypi-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
name: Continuous Deployment

on:
pull_request:
paths:
- .github/workflows/pypi-cd.yml
- .github/workflows/build-python-wrapper/action.yml
push:
tags:
- "v*.*"
Expand Down Expand Up @@ -56,7 +60,8 @@ jobs:
- name: Set the release version
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
export version=`if ${{ github.event_name == 'pull_request' }}; then echo '255.255.255'; else echo ${GITHUB_REF:11}; fi`
echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV
- name: Set the package version for Python
if: matrix.build.PYPI_PUBLISH == true
Expand Down Expand Up @@ -85,6 +90,12 @@ jobs:
sudo apt upgrade -y
sudo apt install python3 python3-venv python3-pip -y
- name: Update package version in config.toml
uses: ./.github/workflows/update-glide-version
with:
folder_path: "${{ github.workspace }}/python/.cargo"
named_os: ${{ matrix.build.NAMED_OS }}

- name: Build Python wrapper
if: matrix.build.PYPI_PUBLISH == true
uses: ./.github/workflows/build-python-wrapper
Expand All @@ -104,7 +115,7 @@ jobs:
cat .gitignore
- name: Build Python wheels (linux)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'linux')
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'linux') && github.event_name != 'pull_request'
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
Expand All @@ -125,22 +136,23 @@ jobs:
fi
- name: Build Python wheels (macos)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin')
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin') && github.event_name != 'pull_request'
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
target: ${{ matrix.build.TARGET }}
args: --release --strip --out wheels -i python3.8 python3.9 python3.10 python3.11 python3.12

- name: Upload Python wheels
if: matrix.build.PYPI_PUBLISH == true
if: matrix.build.PYPI_PUBLISH == true && github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: wheels
path: python/wheels
if-no-files-found: error

publish-to-pypi:
if: github.event_name != 'pull_request'
name: Publish the base PyPi package
runs-on: ubuntu-latest
needs: publish-binaries
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/update-glide-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Update GLIDE version in the config.toml file

inputs:
folder_path:
description: "The folder path of the config.toml file"
required: true
type: string
named_os:
description: "The name of the current operating system"
required: false
default: "linux"
type: string
options:
- linux
- darwin
runs:
using: "composite"
steps:
- name: Update package version in config.toml
working-directory: ${{ inputs.folder_path }}
shell: bash
run: |
SED_FOR_MACOS=`if ${{ inputs.named_os == 'darwin' }}; then echo "''"; fi`
sed -i $SED_FOR_MACOS "s|unkown|${{ env.RELEASE_VERSION }}|g" ./config.toml
# log the config.toml file
cat ./config.toml
2 changes: 1 addition & 1 deletion benchmarks/rust/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = "Glide" # This should be overwritten by each wrapper library.
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion csharp/lib/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = { value = "GlideC#", force = true }
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion glide-core/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = "Glide" # This should be overwritten by each wrapper library.
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion java/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = { value = "GlideJava", force = true }
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion node/rust-client/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = { value = "GlideJS", force = true }
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
2 changes: 1 addition & 1 deletion node/tests/SharedTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function runBaseTests<Context>(config: {
const result = await client.customCommand(["CLIENT", "INFO"]);

expect(result).toContain("lib-name=GlideJS");
expect(result).toContain("lib-ver=0.1.0");
expect(result).toContain("lib-ver=unkown");
}, protocol);
},
config.timeout
Expand Down
2 changes: 1 addition & 1 deletion python/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[env]
GLIDE_NAME = { value = "GlidePy", force = true }
GLIDE_VERSION = "0.1.0"
GLIDE_VERSION = "unkown"
4 changes: 2 additions & 2 deletions python/python/tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async def test_register_client_name_and_version(self, redis_client: TRedisClient
info = await redis_client.custom_command(["CLIENT", "INFO"])
assert type(info) is str
assert "lib-name=GlidePy" in info
assert "lib-ver=0.1.0" in info
assert "lib-ver=unkown" in info

@pytest.mark.parametrize("cluster_mode", [True, False])
@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3])
Expand Down Expand Up @@ -981,7 +981,7 @@ async def test_expireat_pexpireat_ttl_with_positive_timeout(
# set command clears the timeout.
assert await redis_client.set(key, "bar") == OK
current_time_ms = int(time.time() * 1000)
if not check_if_server_version_lt(redis_client, "7.0.0"):
if not await check_if_server_version_lt(redis_client, "7.0.0"):
assert (
await redis_client.pexpireat(
key, current_time_ms + 50000, ExpireOptions.HasExistingExpiry
Expand Down

0 comments on commit cdb8ca8

Please sign in to comment.