diff --git a/.gitea/workflows/build-and-push.yaml b/.gitea/workflows/build-and-push.yaml new file mode 100755 index 00000000..2be2b55b --- /dev/null +++ b/.gitea/workflows/build-and-push.yaml @@ -0,0 +1,73 @@ +name: Build and push +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + python_files: ${{ steps.filter.outputs.python_files }} + helm_files: ${{ steps.filter.outputs.helm }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + python_files: + - 'app/**' + helm: + - 'helm/**' + Lint-Python: + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.python_files == 'true' }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + python_files: + - 'app/**/*.py' + - name: install UV + run: | + pip install uv --quiet + if: steps.filter.outputs.python_files == 'true' + - name: install black and lint code + run: | + uv pip install black --system --quiet + black app --check --fast + if: steps.filter.outputs.python_files == 'true' + Build-and-Push-Docker: + needs: changes + if: ${{ needs.changes.outputs.python_files == 'true' }} + steps: + - name: Login to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: | + ldooks/dragon-bot:latest + ldooks/dragon-bot:${{ gitea.run_id }} + sync-argocd-app: + needs: [changes, Build-and-Push-Docker] + if: ${{ needs.changes.outputs.python_files == 'true' }} + steps: + - name: Sync app in ArgoCD + uses: clowdhaus/argo-cd-action/@main + with: + version: 2.6.7 + command: app + options: --insecure --server 192.168.1.205 --auth-token ${{ secrets.ARGOCD_TOKEN }} set dragon-bot --helm-set image.tag=${{ gitea.run_id }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100755 index 579486ea..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,58 +0,0 @@ -image: docker:dind -services: - - name: docker:dind - entrypoint: ["env", "-u", "DOCKER_HOST"] - command: ["dockerd-entrypoint.sh"] -variables: - DOCKER_TLS_CERTDIR: "" - DOCKER_HOST: tcp://docker:2375/ - DOCKER_DRIVER: overlay2 - -stages: - - lint_python - - lint_helm - - deploy - -lint_helm: - image: alpine/helm - stage: lint_helm - script: - - helm lint ./helm - rules: - - changes: - - helm/* - -lint_python: - image: python:alpine - stage: lint_python - script: - - pip install -q black && black --fast --check . - rules: - - changes: - - app/**/* - -build_and_push_container: - stage: deploy - script: - - echo "Wait for Docker daemon at tcp://localhost:2375" - - while ! nc -z localhost 2375; do sleep 0.1; done # Wait until docker socket is available - - docker login -u ldooks -p $DOCKER_ACCESS_TOKEN - - docker build --platform linux/amd64 -t ldooks/dragon-bot:$CI_PIPELINE_IID -t ldooks/dragon-bot:latest . - - docker push ldooks/dragon-bot -a - rules: - - changes: - - app/**/* - - Dockerfile - -sync_argo: - stage: .post - image: python:alpine - script: - - apk add --no-cache jq curl - - latest=$(curl -sL https://api.github.com/repos/argoproj/argo-cd/releases/latest | jq -r '.assets[] | select( .name | contains("argocd-linux-amd64")).browser_download_url') - - curl -Ls $latest -o /tmp/argocd && chmod +x /tmp/argocd - - /tmp/argocd --insecure --server argocd-server.argocd.svc.cluster.local --auth-token $ARGOCD_TOKEN app set dragon-bot --helm-set image.tag=$CI_PIPELINE_IID - rules: - - changes: - - helm/* - - app/**/* diff --git a/.gitlab/merge_request_templates/merge_request.md b/.gitlab/merge_request_templates/merge_request.md deleted file mode 100755 index bd8f0b25..00000000 --- a/.gitlab/merge_request_templates/merge_request.md +++ /dev/null @@ -1,11 +0,0 @@ -### New Merge Request - -- What? - * `briefly describe the issue this is fixing` -- How? - * `briefly describe what this PR is doing to remedy the issue` -- Why? - * `is there an open issue associated with this PR? if so, reference it with #56 (or whatever the issue number is)` -- Is it...? - * [ ] Based? - * [ ] Dale-pilled? \ No newline at end of file diff --git a/Dockerfile-test-env b/Dockerfile-test-env index 27b72d52..40692787 100755 --- a/Dockerfile-test-env +++ b/Dockerfile-test-env @@ -2,7 +2,6 @@ FROM python:3.10-rc as build ADD app/requirements.txt /requirements.txt ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh RUN /install.sh && rm /install.sh -# RUN pip install --disable-pip-version-check --verbose -r requirements.txt RUN /root/.cargo/bin/uv pip install --system --verbose -r requirements.txt FROM python:3.10-rc-slim diff --git a/app/cogs/animal_functions.py b/app/cogs/animal_functions.py index 140bfb46..6c19b175 100755 --- a/app/cogs/animal_functions.py +++ b/app/cogs/animal_functions.py @@ -14,13 +14,13 @@ class AnimalFunctions(commands.Cog): await ctx.respond(animals.get_red_panda()) @commands.slash_command( - guild_ids=None, name="dog", description="Posts a photo of a dog" + guild_ids=None, name="dog", description="Posts a photo of a Dog" ) async def dog(self, ctx: commands.Context): await ctx.respond(animals.get_dog()) @commands.slash_command( - guild_ids=None, name="sheeb", description="Posts a photo of a sheeb" + guild_ids=None, name="sheeb", description="Posts a photo of a Sheeb" ) async def sheeb(self, ctx: commands.Context): await ctx.respond(animals.random_sheeb())