Skip to content

feature: add keyring script as executable script #35

feature: add keyring script as executable script

feature: add keyring script as executable script #35

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
lint:
name: >-
Lint the codebase 🧹 with ruff
runs-on: ubuntu-latest
steps:
- name: Checkout the codebase 📥
uses: actions/checkout@v3
- name: Set up the pixi environment 🌟
uses: prefix-dev/[email protected]
with:
environments: dev
locked: false
- name: Run code linting with ruff check 🔍
run: pixi run -e dev ruff-check
- name: Format the code with ruff format 🎨
run: pixi run -e dev format
test:
name: >-
Run tests 🧪 and upload coverage report 📊
runs-on: ubuntu-latest
steps:
- name: Checkout the codebase 📥
uses: actions/checkout@v3
- name: Set up the pixi environment 🌟
uses: prefix-dev/[email protected]
with:
environments: dev
locked: false
- name: Execute tests 🧪
run: pixi run -e dev test-reports
- name: Upload the coverage report 📊
uses: actions/upload-artifact@v3
with:
name: test-reports
path: reports/
version-check:
name: >-
Check if the version has changed 🔄
runs-on: ubuntu-latest
outputs:
version-changed: ${{ steps.version-metadata.outputs.changed }}
new-version: ${{ steps.version-metadata.outputs.newVersion }}
steps:
- name: Checkout the codebase 📥
uses: actions/checkout@v3
- name: Retrieve the current version 🕵️‍♂️
id: get-version
run: |
echo "current_version=$(grep -Po '(?<=^__version__ = ")[^"]*' src/keyrings_artifacts/_version.py)" >> $GITHUB_ENV
- name: Fetch the previous version from TestPyPI 🏷️
id: get-previous-version
run: |
package_name=$(grep -Po '(?<=^name = ")[^"]*' pyproject.toml)
previous_version=$(curl -s https://test.pypi.org/pypi/$package_name/json | jq -r '.releases | keys | .[-1]')
echo "previous_version=$previous_version" >> $GITHUB_ENV
- name: Compare the current and previous versions 🔄
id: version-metadata
run: |
if [ "$current_version" != "$previous_version" ]; then
echo "::set-output name=changed::true"
echo "::set-output name=newVersion::$current_version"
else
echo "::set-output name=changed::false"
fi
build:
name: >-
Build the Python 🐍 package 📦
runs-on: ubuntu-latest
needs: version-check
if: needs.version-check.outputs.version-changed == 'true'
steps:
- name: Checkout the codebase 📥
uses: actions/checkout@v3
- name: Set up the pixi environment 🌟
uses: prefix-dev/[email protected]
with:
environments: dev
locked: false
- name: Build the package 📦
run: pixi run -e dev build
- name: Store the distribution packages 📦
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
name: >-
Publish the Python 🐍 distribution 📦 to TestPyPI
needs:
- version-check
- build
runs-on: ubuntu-latest
if: needs.version-check.outputs.version-changed == 'true'
environment:
name: testpypi
url: https://test.pypi.org/p/keyrings.artifacts
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the distribution packages 📦
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish the distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/