ci #203
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
name: ci | |
on: | |
push: | |
branches: [ dev ] | |
paths-ignore: | |
- '**.md' | |
- '**.txt' | |
pull_request: | |
branches: [ dev ] | |
paths-ignore: | |
- '**.md' | |
- '**.txt' | |
jobs: | |
test: | |
timeout-minutes: 15 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: [ 3.7, 3.8, 3.9, '3.10', '3.11' ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools distlib | |
pip install -e . | |
pip install -r requirements.txt | |
# if [ -f requirements.txt ]; then | |
- name: Lint | |
run: | | |
python3 ./lint.py | |
- name: Run unit tests | |
run: | | |
pip3 install neatest | |
python ./test_unit.py | |
- name: Prepare pkg tests | |
run: | | |
pip install chkpkg | |
# #pip install git+https://github.com/rtmigo/chkpkg_py#egg=chkpkg | |
- name: Run pkg tests | |
run: | | |
python ./test_pkg.py | |
to-staging: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Merge current -> staging | |
uses: devmasx/merge-branch@v1.3.1 | |
with: | |
type: now | |
target_branch: staging | |
github_token: ${{ github.token }} | |
timeout-minutes: 5 | |
to-master: | |
# if the commit message was "publish", copy the tested code | |
# to "master" branch and create GitHub release | |
if: github.event.head_commit.message=='publish' | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# UPDATE MASTER BRANCH | |
- name: Merge to master branch | |
uses: devmasx/merge-branch@v1.3.1 | |
with: | |
type: now | |
target_branch: master | |
github_token: ${{ github.token }} | |
# ADD GITHUB RELEASE | |
- name: Get the Python package version | |
run: echo "PKGVER=$(python setup.py --version)" >> $GITHUB_ENV | |
- name: Publish GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.PKGVER }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# ADD PYPI RELEASE | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USR }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PWD }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
timeout-minutes: 5 |