Skip to content

Commit

Permalink
Updates to CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
rhandberg committed Jun 29, 2021
1 parent f490679 commit 28a134e
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 73 deletions.
62 changes: 0 additions & 62 deletions .github/workflows/deploy.yml

This file was deleted.

124 changes: 113 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,57 @@ on:
- cron: '0 6 1 * *' # once a month in the morning

jobs:
# Use the `flake8` tool to check for syntax errors
flake8:
name: Flake8
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-py3.7-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-py3.7-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
grep "numpy" requirements.txt | xargs -I {} pip install "{}"
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
# For some reason we have to specifically ignore G001 as well
flake8 --select=E9,F63,F7,F82 --ignore=G001 --show-source
# exit-zero treats all errors as warnings.
flake8 --exit-zero
# Run unit tests on Linux, OSX and Windows
pytest:
needs: flake8
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
include:
- os: ubuntu-latest
pippath: ~/.cache/pip
- os: macos-latest
pippath: ~/Library/Caches/pip
- os: windows-latest
pippath: ~\AppData\Local\pip\Cache

name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -33,11 +77,33 @@ jobs:
with:
fetch-depth: 0

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

- name: Restore LFS cache
uses: actions/cache@v2
id: lfs-cache
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1

- name: Git LFS Pull
run: git lfs pull

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ matrix.pippath }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
Expand All @@ -53,30 +119,66 @@ jobs:
with:
env_vars: OS,PYTHON


# Use the `flake8` tool to check for syntax errors
flake8:
name: Flake8
# Release tagged commits to:
release:
name: Create release
if: startsWith( github.ref, 'refs/tags/v' )
needs: pytest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

- name: Restore LFS cache
uses: actions/cache@v2
id: lfs-cache
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1

- name: Git LFS Pull
run: git lfs pull

- name: Setup Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-py3.7-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-py3.7-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
grep "numpy" requirements.txt | xargs -I {} pip install "{}"
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
# For some reason we have to specifically ignore G001 as well
flake8 --select=E9,F63,F7,F82 --ignore=G001 --show-source
# exit-zero treats all errors as warnings.
flake8 --exit-zero
- name: Update VERSION file
run: python -c "from flows import version; version.update_release_version();"

- name: Set env
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/v}

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Version ${{ steps.vars.outputs.tag }}
body: |
Version ${{ steps.vars.outputs.tag }}
draft: true

0 comments on commit 28a134e

Please sign in to comment.