Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Actions and Dependencies #47

Merged
merged 5 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/gh-disabled-workflows/python-publish-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/directory_writer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.12

- name: Write DIRECTORY.md
run: |
Expand All @@ -27,7 +27,7 @@ jobs:
uses: EndBug/add-and-commit@v4
with:
author_name: Martin Röbke
author_email: martin.roebke@tu-dresden.de
author_email: martin.roebke@web.de
message: "Automatic Update: DIRECTORY.md"
add: "DIRECTORY.md"
env:
Expand Down
234 changes: 127 additions & 107 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,93 @@ name: Tests

on:
push:
branches: [ master ]
branches: [master]
paths-ignore:
- 'doc/**'
- 'gh-disabled-workflows/**'
- '*.md'
- "doc/**"
- "gh-disabled-workflows/**"
- "*.md"
pull_request:
branches: [ master ]
branches: [master]
paths-ignore:
- 'doc/**'
- 'gh-disabled-workflows/**'
- '*.md'
- "doc/**"
- "gh-disabled-workflows/**"
- "*.md"

env:
graphviz-version: "12.2.1"
pg-version: "16"

jobs:
linux_and_coverage:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install Workflow dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install flake8 flake8-import-order pytest coverage

- name: Install project dependencies
run: |
pip install .[test]

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: graphviz for visualization test
run: |
sudo apt-get update && sudo apt-get install -yq graphviz

- name: Test with coverage & pytest
run: |
coverage run --source=tdvisu -m pytest .
coverage xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests

- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Get Graphviz
working-directory: ..
run: |
wget -nv "https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/${{ env.graphviz-version }}/graphviz-${{ env.graphviz-version }}.tar.gz"
graphviz_12_sha256="242bc18942eebda6db4039f108f387ec97856fc91ba47f21e89341c34b554df8 graphviz-${{ env.graphviz-version }}.tar.gz"
if [[ "$(sha256sum graphviz-${{ env.graphviz-version }}.tar.gz)" != "$graphviz_12_sha256" ]]; then
echo "The file is corrupted, calculated_hash: $calculated_hash"
exit 1
fi
# extract
tar -xzf graphviz-${{ env.graphviz-version }}.tar.gz
# dev dependencies
sudo apt-get install -y build-essential pkg-config libgraphviz-dev libperl-dev libsodium-dev libargon2-dev libgts-dev

- name: Install Graphviz
working-directory: ..
run: |
cd graphviz-${{ env.graphviz-version }}
./configure --prefix=$PWD/out --with-gts
make --quiet
make install --quiet
echo "$PWD/out/bin" >> "$GITHUB_PATH"
echo "LD_LIBRARY_PATH=$PWD/out/lib" >> "$GITHUB_ENV"

- name: Install Workflow dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install flake8 flake8-import-order pytest coverage

- name: Install project dependencies
run: |
pip install .[test]

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Test with coverage & pytest
run: |
dot -V
which coverage
which dot
which pytest
coverage run --source=tdvisu -m pytest .
coverage xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests

other_os_tests:
strategy:
Expand All @@ -73,61 +102,52 @@ jobs:
continue-on-error: true

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install Workflow dependencies
run: |
python -m pip install --upgrade pip
pip install wheel

- name: Install graphviz for visualization test
if: ${{ runner.os == 'macOS' }}
uses: ts-graphviz/setup-graphviz@v2
with:
macos-skip-brew-update: 'true' # default false

- name: Setup Conda
if: ${{ runner.os == 'Windows' }}
uses: s-weigand/setup-conda@v1
with:
# Whether to activate the conda base env (Default: 'true')
activate-conda: true
# Python version which should be installed with conda (default: 'Default')
python-version: 3.8

- name: Install graphviz via conda
if: ${{ runner.os == 'Windows' }}
run: |
conda install -c anaconda graphviz

- name: add graphviz PATH
if: ${{ runner.os == 'Windows' }}
run: |
# should give base conda python
$python=Get-Command python
$pypath=Split-Path $python.Source -Parent
# Add to PATH, we know pypath is on it
$dot=[IO.Path]::Combine($pypath, 'Library', 'bin', 'graphviz')
echo $dot | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: powershell

- name: register plugins for graphviz
if: ${{ runner.os == 'Windows' }}
run: |
# execute dot
dot -V
dot -c

- name: Install project dependencies
run: |
pip install .[test]

- name: Test with pytest
run: |
# Tests reside in folder 'test'
pytest ./test
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install workflow dependencies
run: |
python -m pip install --upgrade pip
pip install wheel

- name: Brew install PostgreSQL ${{ env.pg-version }}
if: runner.os == 'MacOS'
run: |
brew install libpq postgresql@${{ env.pg-version }}
# make available on PATH
pgpath="/opt/homebrew/opt/postgresql@${{ env.pg-version }}/bin"
echo $pgpath >> "$GITHUB_PATH"
ls "$pgpath"
$pgpath/pg_config --version

- name: Add PostgreSQL to PATH
if: runner.os == 'Windows'
shell: pwsh
run: |
echo "$env:PGBIN" >> "$env:GITHUB_PATH"
pg_config --version

- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
with:
macos-skip-brew-update: "true" # default false
windows-graphviz-version: ${{ env.graphviz-version }}

- name: Register plugins for Graphviz
if: runner.os == 'Windows'
run: |
dot -V
dot -c

- name: Install project dependencies
run: |
pip install .[test]

- name: Test with pytest
run: |
# Tests reside in folder 'test'
pytest ./test
33 changes: 16 additions & 17 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,22 @@ on:

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install 'build[virtualenv]'
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
Loading
Loading