diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2b5ec42 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,83 @@ +# Main CI +name: CI + +on: + push: + branches: + - master + tags: + - '*' + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.7 🐍 + uses: actions/setup-python@v1 + with: + python-version: '3.7' + + - name: install flake8 + run: pip install flake8 + + - name: lint + run: flake8 --show-source --statistics --max-line-length=127 + + build: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8', '3.9'] + + steps: + - uses: actions/checkout@v2 + with: + path: python-libvmi + + - name: Set up Python 🐍 + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + + - name: install dependencies + run: sudo apt-get install -qq cmake bison flex check libjson-c-dev libglib2.0-dev libxenstore3.0 libxen-dev libvirt-dev + + - name: clone libvmi + uses: actions/checkout@v2 + with: + repository: libvmi/libvmi + path: libvmi + + - name: install libvmi + run: | + cmake -B build -DCMAKE_INSTALL_PREFIX=/usr . + cmake --build build + sudo cmake --build build --target install + working-directory: libvmi + + - name: install python-libvmi 🔨 + run: | + pip install . + working-directory: python-libvmi + + - name: smoke test + run: python -c 'from libvmi import Libvmi' + + - name: build sdist and bdist_wheel + run: | + python -m pip install wheel + python setup.py sdist + python setup.py bdist_wheel + working-directory: python-libvmi + + - name: publish on PyPI 🚀 + # push on master and tag is 'v*' + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + uses: pypa/gh-action-pypi-publish@v1.3.1 + with: + user: __token__ + password: ${{ secrets.ACCESS_TOKEN }} + packages_dir: python-libvmi/dist/ \ No newline at end of file