From d64f0528fcd27a48d960938a80b239566681f123 Mon Sep 17 00:00:00 2001 From: znerol Date: Sat, 3 Apr 2021 16:38:44 +0200 Subject: [PATCH] Migrate from travis to github actions (#68) --- .github/workflows/ci.yml | 36 +++++++++++++++++++ .github/workflows/pypi.yml | 24 +++++++++++++ .travis.yml | 73 -------------------------------------- README.rst | 5 ++- 4 files changed, 62 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pypi.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9a2f1da --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +--- +name: CI + +# yamllint disable-line rule:truthy +on: + push: + branches: + - main + - develop + tags: + - v* + pull_request: + branches: + - main + - develop + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install pylint / pyflakes + run: sudo apt-get install --yes pylint pyflakes3 + + - name: Install pve_exporter + run: sudo pip install -e . + + - name: Run pylint + run: pylint pve_exporter + + - name: Run pyflakes + run: pyflakes3 src/pve_exporter diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..bc57d13 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,24 @@ +--- +name: Upload Python Package + +# yamllint disable-line rule:truthy +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apt-get install --yes python3-wheel twine + + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + python3 setup.py sdist bdist_wheel + twine upload dist/* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 98a51f4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -os: linux -dist: bionic -services: docker -language: python -python: - - 3.8 - - 3.7 - - 3.6 -cache: - directories: - - $HOME/.cache/pip -env: - global: - - IMAGE_NAME: prompve/prometheus-pve-exporter - - IMAGE_BUILD_ID: "travis-build-${TRAVIS_BUILD_ID}" - - DOCKER_USERNAME: prompveci - # travis encrypt DOCKER_PASSWORD=abcdefg[...] - - secure: "UL0vSTw+8nKj1+a+5k2urlBdQCfrDYbWDWrEcIUN42c8m44OSKgUO2LLDlnJMVIrEdgOuY9pxaNjhkRRDSP8+RFDCwX2N355610qONcBAcUhZZbVXCU9aR29Lhnm1LZq13LDgs+05P9vQ9Aye2MSTKjsEPj1Rrx97GUNFUBfKbqhiV5e/++MLYHtcjsPSLjgBAfA80Tme/FwGbvBzL64OLUl1rmXnaUlAQ60FCag078RS8LlsMNZFEU11f1+DWxl9VdYdH83AzKN/t/xY2+qJu0eUksOvxFM19jMIrC9+KWzvSio3GpbPlA1R/eqpE8iWHx3Zo0tyeVllraYsxX4Wyn7XUqYVzw/5DmXA6gHYtgayrjDk6oA2qpsMmg9w+Q4fhQz7AJjLgNd/vXHwUBByzdgPfjT98zzUUwi2784o6e/+B7bZ3EeLSgrL0VuootmI4LTvlPjwFlWBKij9cQGSzSMiGomr7RcmZGPU9gFyA/EYkglxFV0sSMJgEOBi4Lostc8rEXThKF4eDcDQo7GdI4QvQ+0tQLzsbDAg17pm14+1b9WwqrwTCW1wCgR0T8VwH7wFvaiGnLbFuIWDT5KK4nSq9YOwYB+eLnO85N58ideqrM3o6FKnHqwscVzN4uIUMtCUgGgzS/gP+N7DMjN/OM2lkPIg4/fY45+5bEYhKI=" -stages: - - name: test - - name: docker image - - name: publish - if: tag IS present -install: - - pip install -U pip wheel - - pip install -r test-requirements.txt - - pip install -e . -script: - - pylint pve_exporter - - pyflakes src/pve_exporter -jobs: - include: - - stage: docker image - install: skip - before_script: - - docker login --username="${DOCKER_USERNAME}" --password="${DOCKER_PASSWORD}" - script: - - > - docker build - --tag "${IMAGE_NAME}:${IMAGE_BUILD_ID}" - --build-arg build_log_label="Travis CI Build #${TRAVIS_BUILD_NUMBER}" - --build-arg build_log_url="${TRAVIS_BUILD_WEB_URL}" - . - - docker push "${IMAGE_NAME}:${IMAGE_BUILD_ID}" - - stage: publish - install: skip - before_script: - - docker login --username="${DOCKER_USERNAME}" --password="${DOCKER_PASSWORD}" - script: - - export VERSION_PATCH="${TRAVIS_TAG#v}" - - export VERSION_MINOR="${VERSION_PATCH%.*}" - - export VERSION_MAJOR="${VERSION_MINOR%.*}" - - docker pull "${IMAGE_NAME}:${IMAGE_BUILD_ID}" - - docker tag "${IMAGE_NAME}:${IMAGE_BUILD_ID}" "${IMAGE_NAME}:${VERSION_PATCH}" - - docker tag "${IMAGE_NAME}:${IMAGE_BUILD_ID}" "${IMAGE_NAME}:${VERSION_MINOR}" - - docker tag "${IMAGE_NAME}:${IMAGE_BUILD_ID}" "${IMAGE_NAME}:${VERSION_MAJOR}" - - docker tag "${IMAGE_NAME}:${IMAGE_BUILD_ID}" "${IMAGE_NAME}:latest" - - docker push "${IMAGE_NAME}:${VERSION_PATCH}" - - docker push "${IMAGE_NAME}:${VERSION_MINOR}" - - docker push "${IMAGE_NAME}:${VERSION_MAJOR}" - - docker push "${IMAGE_NAME}:latest" - - stage: publish - install: skip - script: skip - deploy: - on: - all_branches: true - provider: pypi - distributions: sdist bdist_wheel - username: "__token__" - password: - secure: G8okbVzDXXZ6EJb5pMV/e6qsCJBK1i4sFONnfhOO3wD4cQrmpoUYnDWUCrg7yt44E6dE7rS1U0+YndUrxURjGO+hHXxnTNQ5Rb7S59h43oDMKI7ige/eSdVsDZiVs91mNgYCsWOpoOuVX2CdiJyp2rVSW8Hofu4r2JVFMFB4D6DXgGKh5yI4Sa9NIDRQEwAAbY6c/G0qmEJudtuoWmlAAa58VrQcjTmejd3n51EWiwYvMID2TFYa1xbaKaemi6iF2998UCqBmNn+mem1zHqFpKNIgyVHbOCxsit9ODZBJ7u090VM9mAUcU5Rmg95cJaPjJCfojmkE2kcKGdykB+s2bYp/G+6lb/iVLzQw3jZYXvz7nJvxUMLQacxGHQukT82jhJXkWMYuqVe2koRDcgIAn2GGpWQ2CYh7oJb2p1u/8D1lp+2uXDbixk6UPhd75+KySucJPhjIb5LUdGKHbSvFLp2cClRpWQwnjn4NtmIiPB/Tzb1K0c1tlPKvFowK1cMsEFWaJ1k27BcJOwy91UOsi669ZKkf+iK8pn/shoQn6IuUflGHzsOjjHz+vwLNqxlOIzyo7UJJInU1CAb/8dMY9F7KxZvvB5qFEyr26XKtqzGnbCRXPBdMgQ4u7KUetr+hshmvYIwf9FXJppMPYD+/RZpUfXQgBIlBuV79Hrl3P4= diff --git a/README.rst b/README.rst index 87f8da6..bd7ac6c 100644 --- a/README.rst +++ b/README.rst @@ -172,9 +172,8 @@ Grafana Dashboards * `Proxmox via Prometheus by Pietro Saccardi`_ - -.. |Build Status| image:: https://travis-ci.com/prometheus-pve/prometheus-pve-exporter.svg?branch=master - :target: https://travis-ci.com/prometheus-pve/prometheus-pve-exporter +.. |Build Status| image:: https://github.com/prometheus-pve/prometheus-pve-exporter/actions/workflows/ci.yml/badge.svg + :target: https://github.com/prometheus-pve/prometheus-pve-exporter/actions/workflows/ci.yml .. |Package Version| image:: https://img.shields.io/pypi/v/prometheus-pve-exporter.svg :target: https://pypi.python.org/pypi/prometheus-pve-exporter .. _wiki: https://github.com/prometheus-pve/prometheus-pve-exporter/wiki