This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from allenai/ci-updates
Some small improvements to CI
- Loading branch information
Showing
6 changed files
with
98 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,61 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: '17 10 * * *' # run at 10 AM UTC every day. | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python: ['3.6', '3.7'] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
python-version: ${{ matrix.python }} | ||
|
||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
key: ${{ runner.os }}-pip-${{ matrix.python }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}-pip-${{ matrix.python }} | ||
- name: Install requirements | ||
run: | | ||
pip install -r requirements.txt | ||
pip install pytest pytest-cov flake8 black mypy | ||
pip install --upgrade git+https://github.com/allenai/allennlp.git@master | ||
pip install --upgrade -r <(grep -Ev '^allennlp$' requirements.txt) | ||
pip install --upgrade -r dev-requirements.txt | ||
- name: Show pip freeze | ||
run: | | ||
pip freeze | ||
- name: Lint | ||
run: | | ||
flake8 -v | ||
black -v --check . | ||
make lint | ||
- name: Type check | ||
run: | | ||
mypy allennlp_models --ignore-missing-imports --no-strict-optional --no-site-packages | ||
make typecheck | ||
- name: Run tests | ||
run: | | ||
pytest --cov=allennlp_models/ --cov-report=xml | ||
make test-with-cov | ||
- name: Upload coverage to Codecov | ||
if: matrix.python == '3.7' | ||
uses: codecov/[email protected] | ||
with: | ||
token: da233513-af22-4b18-a7c4-e70467fc05e3 | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: PyPI Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy: | ||
needs: build | ||
if: github.repository == 'allenai/allennlp-models' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Install requirements | ||
run: | | ||
pip install -e . | ||
pip install -r dev-requirements.txt | ||
- name: Lint | ||
run: | | ||
make lint | ||
- name: Type check | ||
run: | | ||
make typecheck | ||
- name: Run tests | ||
run: | | ||
make test | ||
- name: Build Package | ||
run: | | ||
python setup.py bdist_wheel sdist | ||
- name: Upload to PyPI | ||
env: | ||
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: twine upload -u $PYPI_USERNAME -p $PYPI_PASSWORD dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.PHONY : lint | ||
lint : | ||
flake8 -v | ||
black -v --check . | ||
|
||
.PHONY : typecheck | ||
typecheck : | ||
mypy allennlp_models --ignore-missing-imports --no-strict-optional --no-site-packages | ||
|
||
.PHONY : test | ||
test : | ||
pytest -v --color=yes | ||
|
||
.PHONY : test-with-cov | ||
test-with-cov : | ||
pytest -v --color=yes --cov=allennlp_models/ --cov-report=xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters