From 819ab38e269e48c941108196706b6ce64aa37ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Wei=C3=9F?= Date: Fri, 4 Mar 2022 13:48:01 +0100 Subject: [PATCH 1/8] Initiate GH actions workflow --- .github/workflows/github-actions-demo.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/github-actions-demo.yml diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 00000000..711d62e1 --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,17 @@ +name: GitHub Actions Demo +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v2 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." From 74a6ad75d0dd703fb04faac884bddb6cc747724f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Wei=C3=9F?= Date: Fri, 4 Mar 2022 18:22:21 +0100 Subject: [PATCH 2/8] Make conda --file compatible --- lint-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lint-requirements.txt b/lint-requirements.txt index 1c25c732..5c749b44 100644 --- a/lint-requirements.txt +++ b/lint-requirements.txt @@ -1,3 +1,3 @@ pre-commit -black~=22.1 -flake8~=4.0 +black==22.1.* +flake8==4.0.* From 2dd5404982f6ced4225dc420be92ad1b8e87a8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Wei=C3=9F?= Date: Fri, 4 Mar 2022 18:23:06 +0100 Subject: [PATCH 3/8] Add initial test workflow --- .github/workflows/github-actions-demo.yml | 17 -------- .github/workflows/test.yml | 47 +++++++++++++++++++++++ 2 files changed, 47 insertions(+), 17 deletions(-) delete mode 100644 .github/workflows/github-actions-demo.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml deleted file mode 100644 index 711d62e1..00000000 --- a/.github/workflows/github-actions-demo.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: GitHub Actions Demo -on: [push] -jobs: - Explore-GitHub-Actions: - runs-on: ubuntu-latest - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..038a33bd --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,47 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: tests + +on: + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.7", "3.8"] + + 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 dependencies + run: | + python -m pip install --upgrade pip wheel + python -m pip install -r test-requirements.txt + python -m pip install -r lint-requirements.txt + - name: Install LightFM and dependencies + run: | + python -m pip install . + - name: Show dependecies + run: python -m pip list + - 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 pytest + run: | + mv lightfm lightfm_ + python -m pytest + mv lightfm_ lightfm \ No newline at end of file From 21c580b84eb478d138abb90c68429b0a80bbaf39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Wei=C3=9F?= Date: Fri, 4 Mar 2022 18:26:58 +0100 Subject: [PATCH 4/8] Change execution for pr branches. --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 038a33bd..4f605cee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,9 +5,11 @@ name: tests on: push: - branches: [ $default-branch ] + branches: + - main pull_request: - branches: [ $default-branch ] + branches: + - main jobs: build: From d31d38cdc81e357e2e9204a33d4d0cf0a3524680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Wei=C3=9F?= Date: Fri, 4 Mar 2022 18:32:18 +0100 Subject: [PATCH 5/8] Test execution --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4f605cee..7910e9c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ name: tests on: push: branches: - - main + - gh-act # Only for testing pull_request: branches: - main From fc0170fbed85545703bee4953a0a64653ad94c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Wei=C3=9F?= Date: Fri, 4 Mar 2022 18:32:45 +0100 Subject: [PATCH 6/8] Trigger action --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7910e9c5..c72d6ac7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ name: tests on: push: branches: - - gh-act # Only for testing + - feature/gh-act # Only for testing pull_request: branches: - main From 60cca1d681fa291bb40f85f58655c96acfa83b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Wei=C3=9F?= Date: Fri, 4 Mar 2022 23:31:51 +0100 Subject: [PATCH 7/8] Test windows tests --- .github/workflows/test.yml | 85 ++++++++++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c72d6ac7..399823a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,49 +1,100 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: tests +# 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: - build: + 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"] - + 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 dependencies + - name: Install test dependencies run: | python -m pip install --upgrade pip wheel python -m pip install -r test-requirements.txt - python -m pip install -r lint-requirements.txt - - name: Install LightFM and dependencies + - name: Install LightFM run: | python -m pip install . - name: Show dependecies run: python -m pip list - - 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 pytest run: | mv lightfm lightfm_ python -m pytest - mv lightfm_ lightfm \ No newline at end of file + 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 + + From e4c1d270daaffd3353049d175a3e50a7a4e40799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Wei=C3=9F?= Date: Fri, 4 Mar 2022 23:41:37 +0100 Subject: [PATCH 8/8] Trigger windows test --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 399823a0..a8311bc9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,7 +62,7 @@ jobs: runs-on: windows-2019 strategy: matrix: - python-version: [3.7, 3.8] + python-version: [3.7] # , 3.8 steps: - uses: actions/checkout@v2 - uses: conda-incubator/setup-miniconda@v2