From f3f7fa6ecf6610f26bd9916bcfb5b6a1369944bb Mon Sep 17 00:00:00 2001 From: Adyanth Hosavalike Date: Fri, 18 Oct 2024 23:01:24 +0530 Subject: [PATCH 1/2] Add test pipeline, update deps --- .github/workflows/ci.yaml | 28 ++++++++++++---------------- .github/workflows/test.yaml | 33 +++++++++++++++++++++++++++++++++ .gitignore | 6 ++++++ requirements-dev.txt | 1 + 4 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9b73687..9b2e7b4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,9 +10,6 @@ on: - '*' tags: - '*' - pull_request: - branches: - - '*' permissions: contents: read packages: write @@ -24,33 +21,32 @@ jobs: steps: # Get the repositery's code - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 # https://github.com/docker/setup-qemu-action - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 # https://github.com/docker/setup-buildx-action - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1 - + uses: docker/setup-buildx-action@v3 + # https://github.com/docker/login-action - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login to GHCR if: github.event_name != 'pull_request' - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - + # https://github.com/docker/metadata-action - name: Docker meta id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: # list of Docker images to use as base name for tags images: | @@ -64,18 +60,18 @@ jobs: type=ref,event=tag type=raw,value=latest,enable={{is_default_branch}} type=sha - + # https://github.com/docker/build-push-action - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - + # https://github.com/peter-evans/dockerhub-description - name: Docker Hub Description - uses: peter-evans/dockerhub-description@v3 + uses: peter-evans/dockerhub-description@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..1ce9b61 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,33 @@ +name: Python Test + +on: + workflow_dispatch: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["pypy3.10", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + - name: Test + run: python -m pytest --junitxml=junit/test-results.xml --cov=main --cov-report=xml --cov-report=html diff --git a/.gitignore b/.gitignore index b2be029..9ee25b3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,9 @@ venv/ .vscode/ .pytest_cache/ __pycache__/ +.coverage +coverage.xml +htlmcov/ +junit/ +.ruff_cache +.DS_Store diff --git a/requirements-dev.txt b/requirements-dev.txt index d04a04e..95a5c37 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,3 @@ pytest +pytest-cov -r requirements.txt \ No newline at end of file From 991cbe405eda00c4a1c38a039f65b2043cd79970 Mon Sep 17 00:00:00 2001 From: Adyanth Hosavalike Date: Fri, 18 Oct 2024 23:02:41 +0530 Subject: [PATCH 2/2] Update trigger --- .github/workflows/ci.yaml | 2 +- .github/workflows/test.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9b2e7b4..5a5a685 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ on: workflow_dispatch: push: branches: - - '*' + - 'main' tags: - '*' permissions: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1ce9b61..7d83c95 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: branches: - - '*' + - 'main' pull_request: branches: - '*'