From e5255cedcefd02f5fa3aa4b6857ddf18adce9230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Fredrik=20Ki=C3=A6r?= <31612826+anders-kiaer@users.noreply.github.com> Date: Sun, 5 Apr 2020 12:46:32 +0200 Subject: [PATCH] Use GitHub workflow as CI/CD (#218) --- .github/workflows/webviz-config.yml | 98 +++++++++++++++++++++++++++++ .travis.yml | 59 ----------------- README.md | 4 +- setup.py | 20 +++--- 4 files changed, 110 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/webviz-config.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/webviz-config.yml b/.github/workflows/webviz-config.yml new file mode 100644 index 00000000..22e13213 --- /dev/null +++ b/.github/workflows/webviz-config.yml @@ -0,0 +1,98 @@ +name: webviz-config + +on: + push: + branches: + - master + pull_request: + branches: + - master + release: + types: + - published + schedule: + # Run CI daily and check that tests are working with latest dependencies + - cron: '0 0 * * *' + +jobs: + + webviz-config: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.6', '3.7', '3.8'] + pandas-version: ['0.24.2', '1.*'] # Necessary as long as RHEL6 is used internally + + steps: + - name: Checkout commit locally + uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install webviz-config with dependencies + run: | + pip install 'pandas==${{ matrix.pandas-version }}' + pip install --upgrade pip + pip install . + + - name: Install test dependencies + run: | + pip install .[tests] + pip install dash[testing] + wget https://chromedriver.storage.googleapis.com/$(wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -q -O -)/chromedriver_linux64.zip + unzip chromedriver_linux64.zip + + - name: List all installed packages + run: pip freeze + + - name: Check code style & linting + run: | + black --check webviz_config tests setup.py + pylint webviz_config tests setup.py + bandit -r -c ./bandit.yml webviz_config tests setup.py + mypy --package webviz_config --ignore-missing-imports --disallow-untyped-defs --show-error-codes + + - name: Run tests + run: | + webviz certificate + webviz preferences --theme default + pytest ./tests --headless --forked + pushd ./docs + python build_docs.py + popd + + - name: Build and deploy Python package + if: github.event_name == 'release' && matrix.python-version == '3.6' + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.pypi_webviz_token }} + run: | + python -m pip install --upgrade setuptools wheel twine + python setup.py sdist bdist_wheel + twine upload dist/* + + - name: Update GitHub pages + if: github.ref == 'refs/heads/master' && matrix.python-version == '3.6' + run: | + cp -R ./docs/_build ../_build + + git config --local user.email "webviz-github-action" + git config --local user.name "webviz-github-action" + git fetch origin gh-pages + git checkout --track origin/gh-pages + git clean -f -f -d -x + git rm -r * + + cp -R ../_build/* . + + git add . + + if git diff-index --quiet HEAD; then + echo "No changes in documentation. Skip documentation deploy." + else + git commit -m "Update Github Pages" + git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages + fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d4c581c0..00000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -language: python -dist: bionic - -addons: - chrome: stable - -services: - - xvfb - -python: - - "3.6" - - "3.7" - - "3.8" - -before_install: - - sudo apt-get -qq update - - pip freeze | grep -vw "pip" | xargs pip uninstall -y - - pip install --upgrade pip - -install: - - wget https://chromedriver.storage.googleapis.com/$(wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -q -O -)/chromedriver_linux64.zip - - unzip chromedriver_linux64.zip - - export PATH=$PATH:$PWD - -script: - - pip install . - - pip install .[tests] - - pip install dash[testing] - - pip freeze - - black --check webviz_config tests setup.py - - pylint webviz_config tests setup.py - - bandit -r -c ./bandit.yml webviz_config tests setup.py - - mypy --package webviz_config --ignore-missing-imports --disallow-untyped-defs --show-error-codes - - - webviz certificate - - webviz preferences --theme default - - pytest tests --forked - - pushd ./docs; python build_docs.py; popd - -deploy: - - provider: pages - skip_cleanup: true - local_dir: ./docs/_build - github_token: - secure: zWVmufs7SMXuV2BMukQnDxvNxTS7GWDLbcGmvEqN4js7oR1h8N4qo0z27kB/OqosLEq37G429BIAIZJAu/Xxja6LLHDQmw18zTlC3wMYxifiU9l0sUn/I7zeqMpLsQERXJIzYhneG4KMvmXxUHSlouOlLKWtQHiraTshvjlAz53Bg6tz6rfASF3kG9CvhEcSVOseG2uJe1N8cBIG2huHZEsJBjVZr/JVoD+tX0y9csEGvO/B1xLJVDMY5DvMmPPCwaEb+O4OUlGpxtfmHRKUvG6fehTZXyyBJVuR58WO2uThOYmSFiaavtvjbIpvJyb8SXM2OmikFGdavipLPtPVZ9qkPorBT9NNKGGRt+h0A/1CVYV4ALp6YmF4r9hWYihMGaJlNgM0lA8322LvwfIjGH6exuZ0/EQxJb5P031icv7ZV4s8zTQON5PJtBU+GxXqVOS2hK8sSuSmvRqpQXWkOrtqKyJ0bu7jAVpw+Xr9C8oWVZ6FTr13t+/ney7PQCCnUZk+F0j3W3bIogTLrG21r49hJYP2TtDGyFf3BUf2ulfMQ+WGwJdc3WjL2XTtgi61dTo9IJKp9pk2+RMjPJQrPNu0mEsJePHHclODIieSw+/nfOsj47Ng1Ku+ZkJq09OngdzzqtMENHtdYgB/qAl+cJxm1e61wzpMLo2iUbQjAiw= - keep_history: true - on: - python: "3.6" - branch: master - repo: equinor/webviz-config - - - provider: pypi - user: webviz - password: - secure: nPhoazwJZ2bOq8T2C9bMdzVS7mACdUkgwdmhEnsFrWT7Oh46h5ypuuaIl/Ir23n5OUYoZS+mg230hclD12McTafnH8MQnGpyooViuZy1oRWzbjjcdI5jq4poEmZokC0pS4ZM+lNeQ01eI4z3BMxwsYvvgZWVyBU+vVtwUSNrRrMnR9Vd3Wg7K17646/OvGsSoYJsN7G64Pm/rLmvphAebWYN/rwfZFz/bOPAhXJkgBmxZDZm2c4H04vCnftPhRSeL3nP7RsZQID/S1KoUuedN/E1inDg/PSAWXTWaRgbL5p6lHvbFC13Z26viRw7tD7BKo3irYxIsUup/v6rD1bwAZvaRGih1rQ5DCShOD/Yz70MpLmnDgiq2GMYWraROq/Uw+HieN+7mg2oPD7ChPeAWLBLmFw7sjZp8qwHq/3qSPARLZqRhAMOltiDtqv7llxv2w8jOcPI0hX7q1KdkWSrv7Nsf0g1wYN8G27+OM4OnDDh8q4R0EherpWQ4vSDN81d4jy8+YQcq8ALOS1k6A7XH5iP50sCArKyJzySs8IeMTT5m7/ddF/x8hnvTQxmdJMYaPAM0TSumdGFmGO0fash1I4NB8R5++ZY8185ELhSuiqz/4vZnA0Gi29yDVSIjOtjKCbPiaQRe0shue2+5zXpeH83MtS0SFD3EVgQ/yt4R58= - on: - python: "3.6" - tags: true - repo: equinor/webviz-config diff --git a/README.md b/README.md index 35a038ec..7658633f 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@
- + - + diff --git a/setup.py b/setup.py index 0700d4cc..da184080 100644 --- a/setup.py +++ b/setup.py @@ -34,16 +34,16 @@ install_requires=[ # Pinning dash to the 1.7-series as long as # https://github.com/plotly/dash-core-components/issues/746 is open - "dash~=1.7.0", - "bleach~=3.1", - "cryptography~=2.4", - "flask-caching~=1.4", - "flask-talisman~=0.6", - "jinja2~=2.10", - "markdown~=3.0", - "pandas~=0.24", - "pyarrow~=0.16", - "pyyaml~=5.1", + "dash==1.7", + "bleach>=3.1", + "cryptography>=2.4", + "flask-caching>=1.4", + "flask-talisman>=0.6", + "jinja2>=2.10", + "markdown>=3.0", + "pandas>=0.24", + "pyarrow>=0.16", + "pyyaml>=5.1", "webviz-core-components>=0.0.16", ], tests_require=TESTS_REQUIRES,