Skip to content

Commit

Permalink
Feature/gh actions update (#162)
Browse files Browse the repository at this point in the history
* add publish_pypi, matrix_test

* rm poetry_run workflow

* support lgbm > 3.2.1
  • Loading branch information
dev-rinchin authored Aug 13, 2024
1 parent 80be502 commit 045ead9
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 130 deletions.
87 changes: 15 additions & 72 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: CI

on:
schedule:
- cron: 0 9 * * *

# Manually triggerable in github
workflow_dispatch:

Expand All @@ -25,45 +22,40 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.9"
- uses: pre-commit/[email protected]

linux-tests:
- name: pre-commit
uses: pre-commit/[email protected]

linux-py39-tests:
needs: pre-commit
runs-on: ${{matrix.os}}
runs-on: ubuntu-latest
if: |
( github.event_name == 'pull_request' ) && ( needs.pre-commit.result == 'success' )
( github.event_name == 'push' ) && ( needs.pre-commit.result == 'success' )
||
( github.event_name == 'schedule' ) && ( needs.pre-commit.result == 'success' )
( github.event_name == 'pull_request' ) && ( needs.pre-commit.result == 'success' )
||
( github.event_name == 'workflow_dispatch' ) && ( needs.pre-commit.result == 'success' )
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

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

- uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.1.7

- name: update pip if python 3.12
if: ${{ matrix.python-version == '3.12' }}
run: pip install setuptools && python -m ensurepip --upgrade
# - name: update pip if python 3.12
# run: pip install setuptools && python -m ensurepip --upgrade

- name: install deps for Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install build-essential libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info

- name: install tox
Expand All @@ -75,52 +67,3 @@ jobs:
- name: test with tox
run: |
tox
win-mac-tests:
needs: [linux-tests, pre-commit]
runs-on: ${{matrix.os}}
if: |
( github.event_name == 'schedule' ) && ( needs.pre-commit.result == 'success' )
strategy:
fail-fast: true
matrix:
os: [windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2

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

- uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.1.7

- name: install deps for MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: brew install libomp cairo pango gdk-pixbuf libffi

- name: update pip if python 3.12
if: ${{ matrix.python-version == '3.12' }}
run: pip install setuptools && python -m ensurepip --upgrade

- name: install deps for Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install build-essential libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info

- name: install deps for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: pip3 install pycairo>=1.20.0

- name: install tox
run: |
python3 -m pip install --upgrade pip
pip3 install tox==3.28.0
pip3 install tox-gh-actions==2.12.0
- name: test with tox
run: |
tox
26 changes: 19 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
name: docs

on:
# At 20:59 every day (23:59 MSK)
schedule:
- cron: 0 9 * * 1
- cron: 59 20 * * *

# Manually triggerable in github
workflow_dispatch:

jobs:
codespell:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v4

- name: codespell
uses: codespell-project/actions-codespell@v2

docs:
runs-on: ubuntu-latest
needs: codespell
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
- name: checkout
uses: actions/checkout@v4

- name: Setup Python
- name: setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
Expand All @@ -23,17 +35,17 @@ jobs:
with:
poetry-version: 1.1.7

- name: Installation pandoc
- name: installation pandoc
run: |
wget https://github.com/jgm/pandoc/releases/download/2.14.0.3/pandoc-2.14.0.3-1-amd64.deb
sudo dpkg -i pandoc-2.14.0.3-1-amd64.deb
- name: Poetry install
- name: poetry install
run: |
poetry run python scripts/poetry_fix.py -c
poetry install -E all
- name: Make documentations
- name: make documentations
run: |
cd docs
poetry run make html
111 changes: 111 additions & 0 deletions .github/workflows/matrix_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: matrix_test

on:
# # At 20:59 every day (23:59 MSK)
# schedule:
# - cron: 59 20 * * *

# Manually triggerable in github
workflow_dispatch:

workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
windows-tests:
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2

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

- uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.1.7

- name: install deps for Windows
run: pip3 install pycairo==1.20.0

- name: install tox
run: |
python3 -m pip install --upgrade pip
pip3 install tox==3.28.0
pip3 install tox-gh-actions==2.12.0
- name: test with tox
run: |
tox
macos-tests:
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2

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

- uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.1.7

- name: install deps for MacOS
run: brew update && brew install libomp cairo pango gdk-pixbuf libffi

- name: install tox
run: |
python3 -m pip install --upgrade pip
pip3 install tox==3.28.0
pip3 install tox-gh-actions==2.12.0
- name: test with tox
run: |
tox
ubuntu-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.10", "3.11", "3.12"] # "3.9" is tested in CI

steps:
- uses: actions/checkout@v2

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

- uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.1.7

- name: install deps for Ubuntu
run: sudo apt-get install build-essential libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info

- name: install tox
run: |
python3 -m pip install --upgrade pip
pip3 install tox==3.28.0
pip3 install tox-gh-actions==2.12.0
- name: test with tox
run: |
tox
39 changes: 0 additions & 39 deletions .github/workflows/poetry_run.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build and publish to pypi

on:
push:
tags:
- 'v*.*.*'
# workflow_dispatch:
# inputs:
# tag:
# description: 'Tag'
# required: true
# default: 'v0.0.0'

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.LAMA_PYPI_TOKEN }}
Loading

0 comments on commit 045ead9

Please sign in to comment.