Unverified 提交 d37c6204 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: GitHub

Merge pull request #88 from dfm/checks

Combining checks into one and dealing with skipped runs
...@@ -4,27 +4,41 @@ on: ...@@ -4,27 +4,41 @@ on:
push: push:
branches: branches:
- master - master
- gh-actions - checks
paths:
- 'setup.cfg'
- 'requirements.txt'
- '.coveragerc'
- '**.py'
- '!docs/**'
pull_request: pull_request:
branches: branches:
- master - master
paths:
- 'setup.cfg'
- 'requirements.txt'
- '.coveragerc'
- '**.py'
- '!docs/**'
jobs: jobs:
changes:
name: "Check for changes"
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.changes.outputs.src }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
python: &python
- 'theano/**/*.py'
- 'tests/**/*.py'
- '*.py'
src:
- *python
- '.github/**/*.yml'
- 'setup.cfg'
- 'requirements.txt'
- '.coveragerc'
style: style:
name: "Check code style" name: Check code style
needs: changes
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.changes == 'true' }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python - name: Set up Python
...@@ -42,8 +56,11 @@ jobs: ...@@ -42,8 +56,11 @@ jobs:
test: test:
name: "Test py${{ matrix.python-version }}: ${{ matrix.part }}" name: "Test py${{ matrix.python-version }}: ${{ matrix.part }}"
needs: style needs:
- changes
- style
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
...@@ -93,6 +110,16 @@ jobs: ...@@ -93,6 +110,16 @@ jobs:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
auto-update-conda: true auto-update-conda: true
- name: Get unique id
id: unique-id
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: |
echo $STRATEGY_CONTEXT
export JOB_ID=`echo $STRATEGY_CONTEXT | md5sum`
echo $JOB_ID
echo "::set-output name=id::$JOB_ID"
# Setup # Setup
- name: Install dependencies - name: Install dependencies
shell: bash -l {0} shell: bash -l {0}
...@@ -121,29 +148,40 @@ jobs: ...@@ -121,29 +148,40 @@ jobs:
FAST_COMPILE: ${{ matrix.fast-compile }} FAST_COMPILE: ${{ matrix.fast-compile }}
FLOAT32: ${{ matrix.float32 }} FLOAT32: ${{ matrix.float32 }}
- name: Coverage - uses: actions/upload-artifact@v2
shell: bash -l {0} with:
run: | name: ${{ steps.unique-id.outputs.id }}
echo $COVERALLS_FLAG_NAME path: .coverage
python -m pip install coveralls
coveralls
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: "py${{ matrix.python-version }} (${{ matrix.fast-compile }}-${{ matrix.float32 }}): ${{ matrix.part }}"
coverage: coverage:
name: "Upload coverage" name: "Merge and upload coverage"
needs: test needs: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ needs.test.result == 'success' }}
steps: steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v1 uses: actions/setup-python@v1
with: with:
python-version: 3.7 python-version: 3.7
- name: Coveralls Finished - name: Download all artifacts
uses: actions/download-artifact@v2
- name: Merge and upload coverage
run: | run: |
python -m pip install coveralls python -m pip install coveralls
coveralls --finish find . -name \.coverage -exec coverage combine --append {} \;
coveralls
env: env:
GITHUB_TOKEN: ${{ secrets.github_token }} GITHUB_TOKEN: ${{ secrets.github_token }}
combine:
if: ${{ always() }}
runs-on: ubuntu-latest
name: "All tests"
needs: [changes, style, test]
steps:
- name: Check build matrix status
if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test.result != 'success') }}
run: exit 1
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论