Skip to content

Commit

Permalink
Add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanDeveloper committed Mar 22, 2024
1 parent def7a10 commit 8a0a922
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build_test_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: build_test_linux
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_test_linux:
name: ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["pypy-3.11",
"pypy-3.10",
"3.11",
"3.10"
]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup py-${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Caching improves build time, we use pythonLocation to cache everything including wheels to avoid building
# wheels at each build (pandas/Pypy is extremely time consuming)
# sed replacement is performed to rectify PyPy path which ends with /bin
# cache key takes into account the Python version of the runner to avoid version mismatch on updates.
- name: Get pip cache path
id: get-pip-path
run: |
id=$(echo ${{ env.pythonLocation }} | sed 's/\/bin//g')
echo "::set-output name=id::$id"
- name: Pip cache
uses: actions/cache@v3
id: pip-cache
with:
path: ${{ steps.get-pip-path.outputs.id }}
key: ${{ steps.get-pip-path.outputs.id }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}

- name: Install requirements
if: steps.pip-cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build
run: |
python -m pip install .
- name: Test
if: startsWith(matrix.os, 'ubuntu') && !startsWith(matrix.python-version, '3.10')
run: |
python -m pytest tests.py
62 changes: 62 additions & 0 deletions .github/workflows/build_test_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: build_test_macos
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_test_macos:
name: ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-12"]
python-version: ["pypy-3.11",
"pypy-3.10",
"3.11",
"3.10"
]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup py-${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Caching improves build time, we use pythonLocation to cache everything including wheels to avoid building
# wheels at each build (pandas/Pypy is extremely time consuming)
# sed replacement is performed to rectify PyPy path which ends with /bin
# cache key takes into account the Python version of the runner to avoid version mismatch on updates.
- name: Get pip cache path
id: get-pip-path
run: |
id=$(echo ${{ env.pythonLocation }} | sed 's/\/bin//g')
echo "::set-output name=id::$id"
- name: Pip cache
uses: actions/cache@v3
id: pip-cache
with:
path: ${{ steps.get-pip-path.outputs.id }}
key: ${{ steps.get-pip-path.outputs.id }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}

- name: Install requirements
if: steps.pip-cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build
run: |
python -m pip install .
- name: Test
# On other versions then 3.9, we test only. (without coverage generation)
if: startsWith(matrix.os, 'macos') && !startsWith(matrix.python-version, '3.9') && !startsWith(github.ref, 'refs/tags/')
run: |
python -m pytest tests.py
55 changes: 55 additions & 0 deletions .github/workflows/build_test_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build_test_windows
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_test_windows:
name: ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-latest"]
python-version: ["pypy-3.11",
"pypy-3.10",
"3.11",
"3.10"
]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup py-${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: git unzip mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-zlib mingw-w64-x86_64-libtiff mingw-w64-x86_64-freetype mingw-w64-x86_64-lcms2 mingw-w64-x86_64-libwebp mingw-w64-x86_64-openjpeg2 mingw-w64-x86_64-libimagequant mingw-w64-x86_64-libraqm mingw-w64-x86_64-gcc mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-pip mingw-w64-x86_64-python3-setuptools

- name: Install requirements
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build
env:
MSYSTEM: MINGW64
MSYS2_PATH: D:/a/_temp/msys64
run: |
python -m pip install .
- name: Test
# On other versions then 3.9, we test only. (without coverage generation)
if: startsWith(matrix.os, 'windows') && !startsWith(matrix.python-version, '3.9') && !startsWith(github.ref, 'refs/tags/')
run: |
python -m pytest tests.py
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ torch
setuptools
redis
mpi4py
pytest
6 changes: 6 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import pytest

# currently default test to make pipeline happy
def test_source_parameter():
assert True

0 comments on commit 8a0a922

Please sign in to comment.