Skip to content

Commit

Permalink
CI: Update pypi workflow (#2223)
Browse files Browse the repository at this point in the history
Update CI

Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand authored Sep 4, 2024
1 parent 6adc0a2 commit 910bd5c
Showing 1 changed file with 34 additions and 36 deletions.
70 changes: 34 additions & 36 deletions .github/workflows/pypi-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ name: PyPI - Continuous Deployment

on:
pull_request:
paths:
- .github/workflows/pypi-cd.yml
- .github/workflows/build-python-wrapper/action.yml
- .github/workflows/start-self-hosted-runner/action.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/install-valkey/action.yml
- .github/json_matrices/build-matrix.json
paths:
- .github/workflows/pypi-cd.yml
- .github/workflows/build-python-wrapper/action.yml
- .github/workflows/start-self-hosted-runner/action.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/install-valkey/action.yml
- .github/json_matrices/build-matrix.json
push:
tags:
- "v*.*"
workflow_dispatch:
inputs:
version:
description: 'The release version of GLIDE, formatted as *.*.* or *.*.*-rc*'
required: true
inputs:
version:
description: "The release version of GLIDE, formatted as *.*.* or *.*.*-rc*"
required: true

concurrency:
group: pypi-${{ github.head_ref || github.ref }}
cancel-in-progress: true

permissions:
id-token: write
id-token: write

jobs:
load-platform-matrix:
Expand All @@ -40,24 +40,23 @@ jobs:
id: load-platform-matrix
shell: bash
run: |
# Get the matrix from the matrix.json file, without the object that has the IMAGE key
export "PLATFORM_MATRIX=$(jq 'map(select(.PACKAGE_MANAGERS | contains(["pypi"])))' < .github/json_matrices/build-matrix.json | jq -c .)"
echo "PLATFORM_MATRIX=${PLATFORM_MATRIX}" >> $GITHUB_OUTPUT
# Get the matrix from the matrix.json file, without the object that has the IMAGE key
export "PLATFORM_MATRIX=$(jq 'map(select(.PACKAGE_MANAGERS | contains(["pypi"])))' < .github/json_matrices/build-matrix.json | jq -c .)"
echo "PLATFORM_MATRIX=${PLATFORM_MATRIX}" >> $GITHUB_OUTPUT
start-self-hosted-runner:
if: github.repository_owner == 'valkey-io'
runs-on: ubuntu-latest
environment: AWS_ACTIONS
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Start self hosted EC2 runner
uses: ./.github/workflows/start-self-hosted-runner
with:
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
ec2-instance-id: ${{ secrets.AWS_EC2_INSTANCE_ID }}
- name: Checkout
uses: actions/checkout@v4
- name: Start self hosted EC2 runner
uses: ./.github/workflows/start-self-hosted-runner
with:
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
ec2-instance-id: ${{ secrets.AWS_EC2_INSTANCE_ID }}

publish-binaries:
needs: [start-self-hosted-runner, load-platform-matrix]
Expand All @@ -68,8 +67,7 @@ jobs:
strategy:
fail-fast: false
matrix:
build:
${{fromJson( needs.load-platform-matrix.outputs.PLATFORM_MATRIX )}}
build: ${{fromJson( needs.load-platform-matrix.outputs.PLATFORM_MATRIX )}}
steps:
- name: Setup self-hosted runner access
if: ${{ contains(matrix.build.RUNNER, 'self-hosted') }}
Expand All @@ -92,15 +90,15 @@ jobs:
fi
echo "RELEASE_VERSION=${R_VERSION}" >> $GITHUB_ENV
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_VERSION: ${{ github.event.inputs.version }}
EVENT_NAME: ${{ github.event_name }}
INPUT_VERSION: ${{ github.event.inputs.version }}

- name: Check that the release version dont have typo init
if: ${{ github.event_name != 'pull_request' && contains(env.RELEASE_VERSION, '-') && !contains(env.RELEASE_VERSION, 'rc') }}
run: |
echo "The release version "${{ env.RELEASE_VERSION }}" contains a typo, please fix it"
echo "The release version should be in the format v{major-version}.{minor-version}.{patch-version}-rc{release-candidate-number} when it a release candidate or v{major-version}.{minor-version}.{patch-version} in a stable release."
exit 1
echo "The release version "${{ env.RELEASE_VERSION }}" contains a typo, please fix it"
echo "The release version should be in the format v{major-version}.{minor-version}.{patch-version}-rc{release-candidate-number} when it a release candidate or v{major-version}.{minor-version}.{patch-version} in a stable release."
exit 1
- name: Set the package version for Python
working-directory: ./python
Expand All @@ -112,16 +110,16 @@ jobs:
- name: Set up Python
if: ${{ !contains(matrix.build.RUNNER, 'self-hosted') }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Set up Python older versions for MacOS
if: startsWith(matrix.build.NAMED_OS, 'darwin')
run: |
brew update
brew upgrade || true
brew install [email protected] [email protected]
brew update
brew upgrade || true
brew install [email protected]
- name: Setup Python for self-hosted Ubuntu runners
if: contains(matrix.build.OS, 'ubuntu') && contains(matrix.build.RUNNER, 'self-hosted')
Expand Down Expand Up @@ -205,7 +203,7 @@ jobs:
runs-on: ubuntu-latest
needs: publish-binaries
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: python/wheels
name: wheels
Expand Down

0 comments on commit 910bd5c

Please sign in to comment.