From 0c5d4ae76e4350043182ae8006d5d754333dd966 Mon Sep 17 00:00:00 2001 From: Garrett Date: Wed, 27 Jan 2021 14:03:32 -0800 Subject: [PATCH] Move to github actions for CI (#895) --- .github/workflows/release.yaml | 30 ++++++++++++ .github/workflows/test.yaml | 86 ++++++++++++++++++++++++++++++++++ .travis.yml | 40 ---------------- requirements-dev.txt | 6 +-- 4 files changed, 118 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/test.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..2a38fa314 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,30 @@ +name: Release + +on: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - 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 + python -m pip install -e .[signals] -r requirements-dev.txt + + - name: Build packages + run: | + python setup.py sdist bdist_wheel + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 000000000..f2b4a7cca --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,86 @@ +name: Tests + +on: [push] + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.6', '3.7', '3.8', 'pypy-3.6'] + + 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 wheel + python -m pip install -e .[signals] -r requirements-dev.txt + + - name: Run dynamodb_local + run: | + wget --quiet http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz -O /tmp/dynamodb_local_latest.tar.gz + tar -xzf /tmp/dynamodb_local_latest.tar.gz -C /tmp + java -Djava.library.path=/tmp/DynamoDBLocal_lib -jar /tmp/DynamoDBLocal.jar -inMemory -port 8000 & + + - name: Run tests + run: | + pytest --cov-report term-missing --cov=pynamodb tests + + - name: Upload coverage + run: | + coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: ${{ matrix.test-name }} + COVERALLS_PARALLEL: true + + + mypy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e .[signals] -r requirements-dev.txt + - name: Run mypy + run: | + mypy . + + build-docs: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e.[signals] sphinx sphinx-rtd-theme + - name: Build docs + run: | + sphinx-build -W docs /tmp/docs-build + + finish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1c26b7176..000000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: python - -python: - - "3.8" - - "3.7" - - "3.6" - - "pypy3" - -before_install: - # dynamodb-local uses deprecated JAXB APIs - - sudo apt-get install openjdk-8-jdk - -install: - - pip install -e .[signals] -r requirements-dev.txt - -before_script: - - wget http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz -O /tmp/dynamodb_local_latest.tar.gz - - tar -xzf /tmp/dynamodb_local_latest.tar.gz -C /tmp - # dynamodb-local uses deprecated JAXB APIs - - /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.library.path=/tmp/DynamoDBLocal_lib -jar /tmp/DynamoDBLocal.jar -inMemory -port 8000 & - - sleep 2 - -script: - - pytest --cov-report term-missing --cov=pynamodb tests - - if [[ "$TRAVIS_PYTHON_VERSION" == "3.8" ]]; then mypy .; fi - - sphinx-build -W docs /tmp/docs-build - -after_success: - - coveralls - -deploy: - provider: pypi - user: lyft-pynamodb - edge: true - password: - secure: "B2AAd62kRYOiCcLjhfIJsICS9laH9J9c5H4tU2C2Vojnb+3W/qj9xP+/GnEZ6Tc2h4SNMQ81Wtzn1CjD3Ut8CCudoBKSZnJmip+EACgpNXjZiU+g0PlEgVbDfJV15OrmFGUeDexxLF3DEQKp8YiMpAhJAH6+SV5W17Er1M6mwBs=" - distributions: "sdist bdist_wheel" - on: - tags: true - condition: $TRAVIS_PYTHON_VERSION = 3.8 diff --git a/requirements-dev.txt b/requirements-dev.txt index 57169a292..7ecc6bfe3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,10 +1,8 @@ -pytest>=5 +pytest>=6 pytest-env pytest-mock -# only used in .travis.yml +# only used in CI coveralls mypy==0.770;python_version>="3.7" pytest-cov -sphinx -sphinx-rtd-theme