Skip to content

Commit

Permalink
Merge pull request #819 from ix5/feature/actions-install-optim
Browse files Browse the repository at this point in the history
GitHub Actions: Optimize actions, cache, upload artifacts
  • Loading branch information
ix5 committed Mar 21, 2022
2 parents 39fbe4e + 0ed8bb7 commit c1c4596
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
paths:
- "docs/**"
- ".github/workflows/documentation.yml"
pull_request:
paths:
- "docs/**"
- ".github/workflows/documentation.yml"

jobs:
check:
Expand All @@ -15,7 +17,7 @@ jobs:
- uses: actions/checkout@v2

- name: Installing Dependencies
run: sudo apt update && sudo apt install python3-sphinx sassc
run: sudo apt install python3-sphinx sassc

- name: Check docs
# TODO: -W turns warnings into errors
Expand Down
78 changes: 74 additions & 4 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Python package
on: [push, pull_request]

jobs:
build:
test:

runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -13,21 +13,91 @@ jobs:
fail-fast: false

steps:

- name: Check out repository code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# Dependencies are in setup.py, so use it as cache key
cache-dependency-path: 'setup.py'

- name: Install isso dependencies
run: python setup.py develop
# Use pip instead of python setup.py develop to get caching from
# "setup-python" action
run: pip install -e .

- name: Install test suite dependencies
run: pip3 install pytest
run: pip install pytest

- name: Run test suite
run: make test
env:
PYTHONHASHSEED: random

- name: Install style check dependencies
run: pip3 install flake8
run: pip install flake8

- name: Run style check
run: make flakes

build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
# Use only lowest and highest supported python versions for now,
# to speed up CI runs
python-version: [3.6, "3.10"]
node-version: [16]
fail-fast: false

steps:

- name: Check out repository code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# Dependencies are in setup.py, so use it as cache key
cache-dependency-path: 'setup.py'

- name: Set up NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: package.json

- name: Install Javascript dependencies using npm
run: make init

- name: Create Javascript artifacts (but skip manpages)
run: make js

- name: Generate Isso package
id: generate-package
run: |
python setup.py sdist
echo "::set-output name=package_file::$(ls dist/)"
- name: Install generated Isso package
run: pip install dist/${{ steps.generate-package.outputs.package_file }}

- name: Archive and upload generated package
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ steps.generate-package.outputs.package_file }}
path: dist/${{ steps.generate-package.outputs.package_file }}

- name: Clean up Isso package from site-packages
# This ensures it isn't accidentally restored by the "setup-python"
# action
run: pip uninstall --y isso

0 comments on commit c1c4596

Please sign in to comment.