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

Initial Test CI with GH actions #636

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
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
100 changes: 100 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Adapted from: https://github.com/alan-turing-institute/sktime/blob/main/.github/workflows/test.yml
name: Lint and Test

on:
push:
branches:
- main
- feature/gh-act # Only for testing
pull_request:
branches:
- main

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Setup Requirements
run: |
python -m pip install -r lint-requirements.txt
- name: Run Linting
run: |
flake8 setup.py lightfm tests
black --check setup.py lightfm tests


test-linux:
needs: linting
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r test-requirements.txt
- name: Install LightFM
run: |
python -m pip install .
- name: Show dependecies
run: python -m pip list
- name: Test with pytest
run: |
mv lightfm lightfm_
python -m pytest
mv lightfm_ lightfm


test-windows:
needs: linting
runs-on: windows-2019
strategy:
matrix:
python-version: [3.7] # , 3.8
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: anaconda, conda-forge

- run: conda --version
- run: which python

- name: Fix windows paths
if: ${{ runner.os == 'Windows' }}
run: echo "C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Install conda libpython
run: conda install -c anaconda libpython

- name: Install conda dependencies
run: |
conda install -c conda-forge pip wheel
conda install -c conda-forge --file test-requirements.txt
- name: Install LightFM
run: python -m pip install .

- name: Show dependecies
run: conda list

- name: Run tests
run: |
mv lightfm lightfm_
python -m pytest
mv lightfm_ lightfm


4 changes: 2 additions & 2 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pre-commit
black~=22.1
flake8~=4.0
black==22.1.*
flake8==4.0.*