Skip to content

Commit

Permalink
ci: extract version from git tags
Browse files Browse the repository at this point in the history
  • Loading branch information
nosahama committed Dec 18, 2024
1 parent 255ea7f commit c9ae28c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/container-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@ jobs:
with:
fetch-depth: 0

- name: Install requirements
run: make install-dev

- name: Resolve Karapace version
run: |
source ./venv/bin/activate
KARAPACE_VERSION=$(python -c "from karapace import version; print(version.__version__)")
echo KARAPACE_VERSION=$KARAPACE_VERSION >> $GITHUB_ENV
id: karapace_version
run: echo KARAPACE_VERSION=$(git describe --tags | cut -d '-' -f -2 | sed 's/-/.dev/g') | tee -a $GITHUB_OUTPUT

- run: echo "RUNNER_UID=$(id -u)" >> $GITHUB_ENV
- run: echo "RUNNER_GID=$(id -g)" >> $GITHUB_ENV
Expand All @@ -36,7 +31,7 @@ jobs:
run: make start-karapace-docker-resources
env:
PYTHON_VERSION: ${{ matrix.python-version }}
KARAPACE_VERSION: ${{ env.KARAPACE_VERSION }}
KARAPACE_VERSION: ${{ steps.karapace_version.outputs.KARAPACE_VERSION }}
RUNNER_UID: ${{ env.RUNNER_UID }}
RUNNER_GID: ${{ env.RUNNER_GID }}

Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,9 @@ jobs:
cache: pip
python-version: '3.12'

- name: Install requirements
run: make install-dev

- name: Resolve Karapace version
run: |
source ./venv/bin/activate
KARAPACE_VERSION=$(python -c "from karapace import version; print(version.__version__)")
echo KARAPACE_VERSION=$KARAPACE_VERSION >> $GITHUB_ENV
id: karapace_version
run: echo KARAPACE_VERSION=$(git describe --tags | cut -d '-' -f -2 | sed 's/-/.dev/g') | tee -a $GITHUB_OUTPUT

- run: echo "RUNNER_UID=$(id -u)" >> $GITHUB_ENV
- run: echo "RUNNER_GID=$(id -g)" >> $GITHUB_ENV
Expand All @@ -58,6 +53,6 @@ jobs:
run: make type-check-mypy-in-docker
env:
PYTHON_VERSION: 3.12
KARAPACE_VERSION: ${{ env.KARAPACE_VERSION }}
KARAPACE_VERSION: ${{ steps.karapace_version.outputs.KARAPACE_VERSION }}
RUNNER_UID: ${{ env.RUNNER_UID }}
RUNNER_GID: ${{ env.RUNNER_GID }}
15 changes: 5 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,17 @@ jobs:
with:
go-version: '1.21.0'

- name: Install requirements
run: make install-dev

- name: Resolve Karapace version
run: |
source ./venv/bin/activate
KARAPACE_VERSION=$(python -c "from karapace import version; print(version.__version__)")
echo KARAPACE_VERSION=$KARAPACE_VERSION >> $GITHUB_ENV
id: karapace_version
run: echo KARAPACE_VERSION=$(git describe --tags | cut -d '-' -f -2 | sed 's/-/.dev/g') | tee -a $GITHUB_OUTPUT

- run: echo "RUNNER_UID=$(id -u)" >> $GITHUB_ENV
- run: echo "RUNNER_GID=$(id -g)" >> $GITHUB_ENV

- run: make unit-tests-in-docker
env:
PYTHON_VERSION: ${{ matrix.python-version }}
KARAPACE_VERSION: ${{ env.KARAPACE_VERSION }}
KARAPACE_VERSION: ${{ steps.karapace_version.outputs.KARAPACE_VERSION }}
RUNNER_UID: ${{ env.RUNNER_UID }}
RUNNER_GID: ${{ env.RUNNER_GID }}
COVERAGE_FILE: "/opt/karapace/coverage/.coverage.${{ matrix.python-version }}"
Expand All @@ -64,7 +59,7 @@ jobs:
- run: make e2e-tests-in-docker
env:
PYTHON_VERSION: ${{ matrix.python-version }}
KARAPACE_VERSION: ${{ env.KARAPACE_VERSION }}
KARAPACE_VERSION: ${{ steps.karapace_version.outputs.KARAPACE_VERSION }}
RUNNER_UID: ${{ env.RUNNER_UID }}
RUNNER_GID: ${{ env.RUNNER_GID }}
COVERAGE_FILE: "/opt/karapace/coverage/.coverage.${{ matrix.python-version }}"
Expand All @@ -73,7 +68,7 @@ jobs:
- run: make integration-tests-in-docker
env:
PYTHON_VERSION: ${{ matrix.python-version }}
KARAPACE_VERSION: ${{ env.KARAPACE_VERSION }}
KARAPACE_VERSION: ${{ steps.karapace_version.outputs.KARAPACE_VERSION }}
RUNNER_UID: ${{ env.RUNNER_UID }}
RUNNER_GID: ${{ env.RUNNER_GID }}
COVERAGE_FILE: "/opt/karapace/coverage/.coverage.${{ matrix.python-version }}"
Expand Down

0 comments on commit c9ae28c

Please sign in to comment.