Skip to content

Commit

Permalink
Trigger tests on pull request events (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hernandez authored Jan 20, 2021
1 parent 6f7cead commit 359ee0d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
64 changes: 19 additions & 45 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
on: push
on:
pull_request:
types: [opened, synchronize]

name: Tests
jobs:
Expand All @@ -15,6 +17,9 @@ jobs:
python-version: ${{ matrix.python_version }}
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Build featuretools package
run: make package_featuretools
- name: Install featuretools with doc requirements
Expand Down Expand Up @@ -75,6 +80,9 @@ jobs:
python-version: ${{ matrix.python_version }}
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Build featuretools package
run: make package_featuretools
- name: Install featuretools with optional, dev, and test requirements
Expand Down Expand Up @@ -105,55 +113,15 @@ jobs:
ref = basename("${{ github.event.ref }}")
is_dev = not any(pattern.match(ref) for pattern in patterns)
print('::set-output name=is_dev::' + str(is_dev))
- name: Install package for requests
run: python -m pip install requests
- name: Check for pull request number
id: pull_request
shell: python
run: |
from requests import get
url = "https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls"
headers = {'Accept': 'application/vnd.github.groot-preview+json'}
response = get(url=url, headers=headers)
info = "%s (%s)" % (response.reason, response.status_code)
assert response.status_code == 200, info
json = response.json()
number = str(json[0]['number'] if json else None)
print('::set-output name=number::' + number)
- if: ${{ steps.branch.outputs.is_dev == 'True' }}
name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- if: ${{ steps.branch.outputs.is_dev == 'True' }}
name: Check if release notes were updated
run: cat docs/source/release_notes.rst | grep ":pr:\`${{ steps.pull_request.outputs.number }}\`"

run_premium_primitives_tests:
name: run premium primitives tests
runs-on: ubuntu-latest
steps:
- name: Check for main and release branch
id: branch
shell: python
run: |
from os.path import basename
from re import compile
main = compile('^main$')
release = compile('^v\d+\.\d+\.\d+$')
ref = basename("${{ github.event.ref }}")
is_main = str(bool(main.match(ref)))
is_release = str(bool(release.match(ref)))
print('::set-output name=is_main::' + is_main)
print('::set-output name=is_release::' + is_release)
- if: ${{ steps.branch.outputs.is_main == 'True' }}
name: "Trigger premium primitives tests for python 3.6 main"
run: |
url=https://circleci.com/api/v1.1/project/github/FeatureLabs/premium-primitives/tree/main
curl -u ${{ secrets.PP_K }}: -d 'build_parameters[CIRCLE_JOB]=python_36' $url
- if: ${{ steps.branch.outputs.is_release == 'True' }}
name: "Trigger premium primitives tests for python 3.6 release"
run: |
url=https://circleci.com/api/v1.1/project/github/FeatureLabs/premium-primitives/tree/main
curl -u ${{ secrets.PP_K }}: -d 'build_parameters[CIRCLE_JOB]=python_36_ft_release' $url
run: cat docs/source/release_notes.rst | grep ":pr:\`${{ github.event.number }}\`"

unit_tests:
name: ${{ matrix.python_version }} unit tests ${{ matrix.optional_libraries }}
Expand All @@ -170,6 +138,9 @@ jobs:
python-version: ${{ matrix.python_version }}
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Build featuretools package
run: make package_featuretools
- name: Set up pip and graphviz
Expand Down Expand Up @@ -238,6 +209,9 @@ jobs:
conda create -n featuretools python=${{ matrix.python_version }}
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Install featuretools with test requirements
shell: pwsh
run: |
Expand Down
3 changes: 2 additions & 1 deletion docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Release Notes
* Testing Changes
* Unpin python-graphviz package on Windows (:pr:`1296`)
* Reorganize and clean up tests (:pr:`1294`, :pr:`1303`, :pr:`1306`)
* Trigger tests on pull request events (:pr:`1304`)

Thanks to the following people for contributing to this release:
:user:`rwedge`, :user:`thehomebrewnerd`
:user:`jeff-hernandez`, :user:`rwedge`, :user:`thehomebrewnerd`

**v0.23.0 Dec 31, 2020**
* Fixes
Expand Down

0 comments on commit 359ee0d

Please sign in to comment.