Skip to content

jgrss/torch20

jgrss/torch20 #295

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
Tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip # caching pip dependencies based on changes to pyproject.toml
- name: Install GDAL binaries
run: |
# Temporary? dpkg fix: https://askubuntu.com/questions/1276111/error-upgrading-grub-efi-amd64-signed-special-device-old-ssd-does-not-exist
sudo rm /var/cache/debconf/config.dat
sudo dpkg --configure -a
# Install GDAL
sudo apt update && sudo apt upgrade -y && sudo apt install -y
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt install libmysqlclient-dev default-libmysqlclient-dev -y
sudo apt install gdal-bin libgdal-dev libgl1 libspatialindex-dev g++ -y
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
export LD_LIBRARY_PATH=/usr/local/lib
- name: Install Python packages
run: |
# Install Python GDAL
pip install -U pip setuptools wheel
pip install -U "Cython>=0.29.0,<3.0.0" "numpy<=1.21.0"
GDAL_VERSION=$(gdal-config --version | awk -F'[.]' '{print $1"."$2"."$3}')
pip install GDAL==$GDAL_VERSION --no-binary=gdal
- name: Install PyTorch
run: |
TORCH_CPU="https://download.pytorch.org/whl/cpu"
TORCH_VERSION="2.2.2"
pip install --upgrade --no-cache-dir setuptools>=0.59.5
pip install torch==${TORCH_VERSION} torchvision==0.17.2 torchaudio==${TORCH_VERSION} --extra-index-url $TORCH_CPU
- name: Install cultionet
run: |
pip install .
- name: Pytest
run: |
pip install pytest
cd tests/
python -m pytest
# Version:
# needs: Tests
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
# runs-on: ubuntu-latest
# concurrency: release
# steps:
# - uses: actions/checkout@v2
# with:
# fetch-depth: 0
# token: ${{ secrets.CULTIONET_TOKEN }}
# - uses: actions/setup-python@v2
# with:
# python-version: 3.8.12
# - name: Python Semantic Release
# run: |
# python -m pip install python-semantic-release
# # Add credentials
# git config user.name "github-actions"
# git config user.email "github-actions@github.com"
# # Bump cultionet version
# semantic-release publish
# env:
# GH_TOKEN: ${{ secrets.CULTIONET_TOKEN }}
# # https://github.com/fnkr/github-action-ghr
# Release:
# needs: Version
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
# name: Upload release
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-python@v2
# with:
# python-version: 3.8.12
# - uses: syphar/restore-virtualenv@v1
# id: cnetenv
# with:
# requirement_files: setup.cfg
# - uses: syphar/restore-pip-download-cache@v1
# if: steps.cnetenv.outputs.cache-hit != 'true'
# - name: Checkout
# uses: fnkr/github-action-ghr@v1
# if: startsWith(github.ref, 'refs/tags/')
# env:
# GHR_PATH: .
# GHR_COMPRESS: gz
# GITHUB_TOKEN: ${{ secrets.CULTIONET_TOKEN }}