Skip to content

Commit 59eb4da

Browse files
joejoevictorcopybara-github
authored andcommitted
Migrate Python Fire CI from Travis to Github Actions.
PiperOrigin-RevId: 353286136 Change-Id: I030d43b4c911137c2859b1d5dcd91e5831dc6b2d
1 parent 2b5902a commit 59eb4da

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/scripts/build.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright (C) 2018 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
#!/usr/bin/env bash
16+
17+
PYTHON_VERSION=${PYTHON_VERSION:-2.7}
18+
19+
pip install --upgrade setuptools pip
20+
pip install --upgrade pylint pytest pytest-pylint pytest-runner
21+
pip install termcolor
22+
pip install hypothesis python-Levenshtein
23+
python setup.py develop
24+
python -m pytest # Run the tests without IPython.
25+
pip install ipython
26+
python -m pytest # Now run the tests with IPython.
27+
pylint fire --ignore=test_components_py3.py,parser_fuzz_test.py,console
28+
if [[ ${PYTHON_VERSION} == 2.7 || ${PYTHON_VERSION} == 3.7 ]]; then
29+
pip install pytype;
30+
fi
31+
# Run type-checking, excluding files that define or use py3 features in py2.
32+
if [[ ${PYTHON_VERSION} == 2.7 ]]; then
33+
pytype -x \
34+
fire/fire_test.py \
35+
fire/inspectutils_test.py \
36+
fire/test_components_py3.py;
37+
elif [[ ${PYTHON_VERSION} == 3.7 ]]; then
38+
pytype;
39+
fi
40+

.github/workflows/build.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Python Fire
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [2.7, 3.4, 3.5, 3.7, 3.8, 3.9]
11+
12+
steps:
13+
# Checkout the repo.
14+
- name: Checkout Python Fire repository
15+
uses: actions/checkout@v2
16+
17+
# Set up Python environment.
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
# Build Python Fire using the build.sh script.
24+
- name: Run build script
25+
shell: bash
26+
run: ./.github/scripts/build.sh
27+
env:
28+
PYTHON_VERSION: ${{ matrix.python-version }}

0 commit comments

Comments
 (0)