Skip to content

Commit

Permalink
Merge pull request #293 from simonsobs/koopman/ci-workflow-improvements
Browse files Browse the repository at this point in the history
Improve GitHub Actions workflows
  • Loading branch information
BrianJKoopman committed Oct 20, 2022
2 parents 24ceb4d + a7cc5e7 commit 1600ca3
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 111 deletions.
50 changes: 1 addition & 49 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,7 @@ on:

jobs:
test:
name: pytest with coverage
runs-on: ubuntu-latest

steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: clone ocs
uses: actions/checkout@v2
# Fetch all history for all tags and branches
with:
fetch-depth: 0

- name: Install ocs
run: |
pip3 install -r requirements.txt
pip3 install -e .[so3g]
# Test (already been run by pytest workflow, but they don't take long...)
# Unit Tests
- name: Run unit tests
working-directory: ./tests
run: |
COVERAGE_FILE=.coverage.unit python3 -m pytest --cov -m 'not integtest'
# Integration Tests
- name: Build images for integration tests
run: |
docker-compose build ocs ocs-crossbar
- name: Run integration tests
working-directory: ./tests
run: |
mkdir log
COVERAGE_FILE=.coverage.int python3 -m pytest --cov -m 'integtest'
ls -la ./log/
# Coverage
- name: Report test coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mv ./tests/.coverage.* ./
pip install coveralls
coverage combine
coverage report
coveralls --service=github
uses: ./.github/workflows/pytest.yml

docker:
name: build and deploy docker images
Expand Down
93 changes: 44 additions & 49 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,16 @@ name: Build Develop Images
on:
push:
branches: [ develop ]
paths-ignore:
- 'docs/**'
- '**.rst'
- '**.md'
- '.flake8'
- '.pre-commit-config.yaml'

jobs:
test:
name: pytest with coverage
runs-on: ubuntu-latest

steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: clone ocs
uses: actions/checkout@v2
# Fetch all history for all tags and branches
with:
fetch-depth: 0

- name: Install ocs
run: |
pip3 install -r requirements.txt
pip3 install -e .[so3g]
# Test (steps from pytest workflow)
# Unit Tests
- name: Run unit tests
working-directory: ./tests
run: |
COVERAGE_FILE=.coverage.unit python3 -m pytest --cov -m 'not integtest'
# Integration Tests
- name: Build images for integration tests
run: |
docker-compose build ocs ocs-crossbar
- name: Run integration tests
working-directory: ./tests
run: |
mkdir log
COVERAGE_FILE=.coverage.int python3 -m pytest --cov -m 'integtest'
ls -la ./log/
# Coverage
- name: Report test coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mv ./tests/.coverage.* ./
pip install coveralls
coverage combine
coverage report
coveralls --service=github
uses: ./.github/workflows/pytest.yml

build:
name: build and deploy dev images
Expand Down Expand Up @@ -92,3 +50,40 @@ jobs:
# Upload to docker registry
docker-compose config | grep 'image: ' | awk -F ': ' '{ print $2 }' | xargs -I {} docker push ${DOCKERHUB_ORG}/{}:${DOCKER_TAG}
docker-compose config | grep 'image: ' | awk -F ': ' '{ print $2 }' | xargs -I {} echo ${DOCKERHUB_ORG}/{}:${DOCKER_TAG} pushed
# testing so we can catch any issues before release
# if issues are found, test locally, or copy to pytest.yml and set to test on push
wheel:
name: build and test wheel
needs: test
runs-on: ubuntu-latest

steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: clone ocs
uses: actions/checkout@v2

- name: install build dependencies
run: |
python3 -m pip install --upgrade build twine
- name: build wheel
run: |
python3 -m build
- name: install wheel
run: |
python3 -m pip install dist/ocs*.whl
- name: install testing requirements
run: |
pip3 install -r requirements/testing.txt
- name: Run unit tests
working-directory: ./tests
run: |
python3 -m pytest -m 'not integtest'
27 changes: 14 additions & 13 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
# 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: Run Tests

on:
push:
branches-ignore: [ develop ]
pull_request:
paths-ignore:
- 'docs/**'
- '**.rst'
- '**.md'
- '.flake8'
- '.pre-commit-config.yaml'
workflow_call:

jobs:
test:
name: pytest with coverage
runs-on: ubuntu-latest

steps:
# Setup
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

# Install
- name: clone ocs
uses: actions/checkout@v2

# I like this idea, but let's hold off for now.
#- 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: Install ocs
run: |
pip3 install -r requirements.txt
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/skipped-pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run Tests

on:
pull_request:
paths:
- 'docs/**'
- '**.rst'
- '**.md'
- '.flake8'
- '.pre-commit-config.yaml'

jobs:
test:
name: pytest with coverage
runs-on: ubuntu-latest

steps:
- run: 'echo "No build required" '

0 comments on commit 1600ca3

Please sign in to comment.