From b0488d1cbebf0cafb43a48aa460dd9db19ed0fce Mon Sep 17 00:00:00 2001 From: gabe-levin Date: Sun, 19 Jan 2025 15:20:13 +0100 Subject: [PATCH] test: github actions for continues deployment to pypi --- .github/workflows/py-client-ci.yml | 67 ++++++++++++++++++++++++++++++ .gitignore | 5 ++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/py-client-ci.yml diff --git a/.github/workflows/py-client-ci.yml b/.github/workflows/py-client-ci.yml new file mode 100644 index 0000000..2be07d2 --- /dev/null +++ b/.github/workflows/py-client-ci.yml @@ -0,0 +1,67 @@ +name: Client CI/CD + +on: + push: + branches: [ main ] + paths: + - 'space2stats_client/**' + pull_request: + branches: [ main ] + paths: + - 'space2stats_client/**' + +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./space2stats_client + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y proj-bin libproj-dev gdal-bin libgdal-dev + + - name: Install Poetry + uses: snok/install-poetry@v1 + + - name: Install dependencies + run: poetry install + + - name: Run tests + run: poetry run pytest + + publish: + needs: test + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./space2stats_client + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install Poetry + uses: snok/install-poetry@v1 + + - name: Build and publish + env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: | + poetry config pypi-token.pypi $PYPI_TOKEN + poetry build + poetry publish \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1e9abe2..3afaa08 100644 --- a/.gitignore +++ b/.gitignore @@ -106,4 +106,7 @@ space2stats_api/space2stats_env cdk.out lambda_layer .venv -.envrc \ No newline at end of file +.envrc + +# secrets +.secrets