From 562e372923c5b66ed5d332104496fd77e8c0d3f2 Mon Sep 17 00:00:00 2001 From: Benjamin DERVILLE Date: Wed, 28 Aug 2024 13:48:46 +0200 Subject: [PATCH] add github actions --- .github/workflows/ci.yml | 21 +++++++++++ .github/workflows/test-and-publish.yml | 51 ++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/test-and-publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3442c10 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: CI + +# This workflow is triggered on pushes to the repository. +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Set up Docker Compose + run: | + sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + + - name: Run Docker Compose and test service + run: | + bash test_build.sh diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml new file mode 100644 index 0000000..f7b10fc --- /dev/null +++ b/.github/workflows/test-and-publish.yml @@ -0,0 +1,51 @@ +name: Test and Publish + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8, 3.9, "3.10"] + + 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 + pip install -e .[all] + pip install pytest + - name: Run tests + run: pytest + + publish: + needs: test + if: github.ref == 'refs/heads/master' + 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 + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/*