diff --git a/.github/workflows/code-safety/build_image.yml b/.github/workflows/code-safety/build_image.yml new file mode 100644 index 0000000..ce52763 --- /dev/null +++ b/.github/workflows/code-safety/build_image.yml @@ -0,0 +1,16 @@ +name: build_image.yml + +on: + push: + branches: + - main + +jobs: + docker-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Build Docker image + run: docker build -t python-kata-wompwomp:latest . + diff --git a/.github/workflows/code-safety/check-formatter.yml b/.github/workflows/code-safety/check-formatter.yml new file mode 100644 index 0000000..8decd2b --- /dev/null +++ b/.github/workflows/code-safety/check-formatter.yml @@ -0,0 +1,23 @@ +name: check-formatter.yml + +on: + pull_request: + branches: + - main + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - name: Install uv + uses: astral-sh/setup-uv@v3 + + - name: Install project + run: uv sync --group dev + + - name: Check formatting + run: uv run ruff format --check . + diff --git a/.github/workflows/code-safety/check-linter.yml b/.github/workflows/code-safety/check-linter.yml new file mode 100644 index 0000000..9b4267f --- /dev/null +++ b/.github/workflows/code-safety/check-linter.yml @@ -0,0 +1,22 @@ +name: check-linter.yml +run-name: ${{ github.actor }} is making linter checks + +on: + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Install uv + uses: astral-sh/setup-uv@v3 + + - name: Install project + run: uv sync --group dev + + - name: Run ruff (lint) + run: uv run ruff check . diff --git a/.github/workflows/code-safety/check-type-safety.yml b/.github/workflows/code-safety/check-type-safety.yml new file mode 100644 index 0000000..a886cc9 --- /dev/null +++ b/.github/workflows/code-safety/check-type-safety.yml @@ -0,0 +1,23 @@ +name: check-type-safety.yml + +on: + pull_request: + branches: + - main + +jobs: + typecheck: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - name: Install uv + uses: astral-sh/setup-uv@v3 + + - name: Install project + run: uv sync --group dev + + - name: Run Pyright + run: uv run pyright + diff --git a/.github/workflows/code-safety/deploy.yml b/.github/workflows/code-safety/deploy.yml new file mode 100644 index 0000000..2c9e480 --- /dev/null +++ b/.github/workflows/code-safety/deploy.yml @@ -0,0 +1,34 @@ +name: deploy.yml + +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and tag image + run: | + docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/python-kata-wompwomp:latest . + + - name: Push image + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/python-kata-wompwomp:latest + + - name: Deploy to Render + env: + RENDER_WEBHOOK: ${{ secrets.RENDER_DEPLOY_WEBHOOK }} + IMAGE_URL: docker.io/${{ secrets.DOCKERHUB_USERNAME }}/python-kata-wompwomp:latest + run: | + ENCODED_IMAGE_URL=$(echo -n "$IMAGE_URL" | jq -s -R -r @uri) + curl "${RENDER_WEBHOOK}&imgURL=${ENCODED_IMAGE_URL}" \ No newline at end of file diff --git a/.github/workflows/code-safety/run-unit-tests.yml b/.github/workflows/code-safety/run-unit-tests.yml new file mode 100644 index 0000000..bb2e436 --- /dev/null +++ b/.github/workflows/code-safety/run-unit-tests.yml @@ -0,0 +1,25 @@ +name: run-unit-tests.yml + +on: + pull_request: + branches: + - main + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + python-version: "3.x" + + - name: Sync dependencies + run: uv sync --group dev + + - name: Run tests + run: uv run pytest + diff --git a/.github/github-actions-demo.yaml b/.github/workflows/git-test.yaml similarity index 100% rename from .github/github-actions-demo.yaml rename to .github/workflows/git-test.yaml diff --git a/.github/git-test.yaml b/.github/workflows/github-actions-demo.yaml similarity index 100% rename from .github/git-test.yaml rename to .github/workflows/github-actions-demo.yaml