build(deps-dev): bump ruff from 0.5.6 to 0.6.3 #252
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dev build CI | |
on: | |
push: | |
paths-ignore: | |
- 'README**' | |
branches: | |
- '**' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- '*' | |
paths-ignore: | |
- 'README**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: write | |
checks: write | |
packages: write | |
env: | |
PREFERED_PYTHON_VERSION: '3.12' | |
WEBPODA_AUTH_CODE: ${{ secrets.WEBPODA_AUTH_CODE }} | |
jobs: | |
qa: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pre-commit/[email protected] | |
build: | |
strategy: | |
matrix: | |
python-versions: ['3.10', '3.11', '3.12'] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
# map step outputs to job outputs so they can be share among jobs | |
outputs: | |
package_version: ${{ env.PACKAGE_VERSION }} | |
package_name: ${{ env.PACKAGE_NAME }} | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-versions }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Declare version variables for dev builds | |
id: variables_step_dev | |
run: | | |
# Override the version with a dev suffix because we are not on a tag. Tag builds pull version directly from pyproject.toml | |
poetry version $(poetry version --short)-dev.$GITHUB_RUN_NUMBER | |
echo "Using version from pyproject.toml file with dev suffix (because not on a tag): $(poetry version --short)" | |
echo "PACKAGE_NAME=$(poetry version | awk '{print $1}')" >> $GITHUB_ENV | |
echo "PACKAGE_VERSION=$(poetry version --short)" >> $GITHUB_ENV | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
shell: bash | |
- name: Declare variables PACKAGE_NAME and PACKAGE_VERSION | |
id: variables_step | |
run: | | |
echo "Version used by poetry: $(poetry version --short)" | |
echo "PACKAGE_NAME=$(poetry version | awk '{print $1}')" >> $GITHUB_ENV | |
echo "PACKAGE_VERSION=$(poetry version --short)" >> $GITHUB_ENV | |
shell: bash | |
- name: build | |
run: ./build.sh | |
- name: Build wheels and source tarball | |
run: ./pack.sh | |
- name: Create Version file | |
run: echo "Version ${{ env.PACKAGE_VERSION }}, SHA ${{ github.sha }}, Ref ${{ github.ref_name }}" > dist/python${{matrix.python-versions}}/version.txt | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
if: matrix.python-versions == env.PREFERED_PYTHON_VERSION | |
- name: Login to GitHub Container registry ghcr.io | |
uses: docker/login-action@v3 | |
if: matrix.python-versions == env.PREFERED_PYTHON_VERSION | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get image metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
if: matrix.python-versions == env.PREFERED_PYTHON_VERSION | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
# minimal | |
type=semver,pattern={{version}} | |
# use custom value instead of git tag | |
type=semver,pattern={{version}},value=${{ env.PACKAGE_VERSION }} | |
# set latest tag for default branch | |
type=raw,value=latest | |
# branch event | |
type=ref,event=branch | |
# pull request event | |
type=ref,event=pr | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
if: matrix.python-versions == env.PREFERED_PYTHON_VERSION | |
with: | |
context: . | |
file: deploy/Dockerfile | |
push: true | |
tags: | | |
${{ steps.meta.outputs.tags }} | |
- name: Zip up the folder | |
run: zip -r ${{ env.PACKAGE_NAME }}_python${{matrix.python-versions}}_${{ env.PACKAGE_VERSION }}.zip python${{matrix.python-versions}} | |
working-directory: dist | |
- name: Upload python wheel/tarball | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PACKAGE_NAME }}_python${{matrix.python-versions}}_${{ env.PACKAGE_VERSION }}.zip | |
path: dist/${{ env.PACKAGE_NAME }}_python${{matrix.python-versions}}_${{ env.PACKAGE_VERSION }}.zip | |
if-no-files-found: error | |
- name: Upload Coverage report | |
uses: actions/upload-artifact@v4 | |
if: matrix.python-versions == env.PREFERED_PYTHON_VERSION | |
with: | |
name: CoverageReport_python${{matrix.python-versions}}_${{ env.PACKAGE_VERSION }} | |
path: htmlcov | |
if-no-files-found: error | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
with: | |
name: Test Results (${{ matrix.python-versions }}) | |
path: 'test-results.xml' | |
reporter: java-junit | |
- name: Create Release ${{github.ref_name}} & upload artifacts | |
uses: softprops/action-gh-release@v2 | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
with: | |
draft: false | |
prerelease: false | |
fail_on_unmatched_files: true | |
files: | | |
dist/${{ env.PACKAGE_NAME }}_python${{matrix.python-versions}}_${{ env.PACKAGE_VERSION }}.zip | |
test_on_windows: | |
strategy: | |
matrix: | |
python-versions: ['3.10', '3.11', '3.12'] | |
os: [windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-versions }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install | |
- name: Run tests | |
run: poetry run pytest -s --cov-config=.coveragerc --cov=src --cov-append --cov-report=xml --cov-report term-missing --cov-report=html --junitxml=test-results.xml tests | |
- name: Upload Coverage report | |
uses: actions/upload-artifact@v4 | |
if: matrix.python-versions == env.PREFERED_PYTHON_VERSION | |
with: | |
name: CoverageReport_${{ matrix.os }}_python${{matrix.python-versions}}_${{ env.PACKAGE_VERSION }} | |
path: htmlcov | |
if-no-files-found: error | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
with: | |
name: Test Results (${{ matrix.os }}) (${{ matrix.python-versions }}) | |
path: 'test-results.xml' | |
reporter: java-junit | |
build_single_file_binary: | |
strategy: | |
matrix: | |
os: [linux, windows] | |
include: | |
- os: linux | |
image: batonogov/pyinstaller-linux:latest | |
executable: imap-mag | |
folder: manylinux_2_36_x86_64 | |
- os: windows | |
image: batonogov/pyinstaller-windows:latest | |
executable: imap-mag.exe | |
folder: win_amd64 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PREFERED_PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Set REVISION | |
run: echo "REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Declare version variables for dev builds | |
id: variables_step_dev | |
run: | | |
# Override the version with a dev suffix because we are not on a tag. Tag builds pull version directly from pyproject.toml | |
poetry version $(poetry version --short)-dev.$GITHUB_RUN_NUMBER | |
echo "Using version from pyproject.toml file with dev suffix (because not on a tag): $(poetry version --short)" | |
echo "PACKAGE_NAME=$(poetry version | awk '{print $1}')" >> $GITHUB_ENV | |
echo "PACKAGE_VERSION=$(poetry version --short)" >> $GITHUB_ENV | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
shell: bash | |
- name: Declare variables PACKAGE_NAME and PACKAGE_VERSION | |
id: variables_step | |
run: | | |
echo "Version used by poetry: $(poetry version --short)" | |
echo "PACKAGE_NAME=$(poetry version | awk '{print $1}')" >> $GITHUB_ENV | |
echo "PACKAGE_VERSION=$(poetry version --short)" >> $GITHUB_ENV | |
shell: bash | |
- uses: addnab/docker-run-action@v3 | |
with: | |
registry: gcr.io | |
image: ${{ matrix.image }} | |
options: -v ${{ github.workspace }}:/src/ | |
run: | | |
python -m pip install poetry | |
python -m poetry self add poetry-pyinstaller-plugin | |
python -m poetry install | |
python -m poetry build | |
if [ ! -f dist/pyinstaller/${{ matrix.folder }}/${{ matrix.executable }} ] | |
then | |
echo "Cannot find dist/pyinstaller/${{ matrix.folder }}/${{ matrix.executable }}" | |
exit 1 | |
fi | |
- name: Zip up the binary | |
run: | | |
sudo chown -R $(whoami):$(whoami) . | |
cp pyinstaller/${{ matrix.folder }}/${{ matrix.executable}} . | |
zip -r ${{ env.PACKAGE_NAME }}_${{ matrix.executable }}_v${{ env.PACKAGE_VERSION }}.zip ${{ matrix.executable }} | |
echo "PACKAGE_ZIP=${{ env.PACKAGE_NAME }}_${{ matrix.executable }}_v${{ env.PACKAGE_VERSION }}.zip" >> $GITHUB_ENV | |
working-directory: dist | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PACKAGE_ZIP }} | |
path: dist/${{ env.PACKAGE_ZIP }} | |
if-no-files-found: error | |
- name: Upload artifacts to release (tagged only)) | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: false | |
prerelease: false | |
fail_on_unmatched_files: true | |
files: | | |
dist/${{ env.PACKAGE_ZIP }} |