diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5a95e9b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +.dockerignore +Dockerfile +.hadolint.yml +.git/ +.gitignore +.isort.cfg +.pre-commit-config.yaml +LICENSE +Makefile +README.md +setup.cfg +**/**/__pycache__/** diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..da0a9d4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,75 @@ +name: Bug report +description: You've found a bug with the Mairror API. +labels: ['type:bug', 'status:requirements', 'priority-5-triage'] +body: + - type: markdown + attributes: + value: | + Before you begin to fill out the form, make sure you have actually found a bug. + If you're not sure then create a [discussion](https://github.com/mairror/infrastructure/discussions) first. + If you have questions or want help with Mairror infrastructure, then also create a [discussion](https://github.com/mairror/infrastructure/discussions). + + - type: dropdown + id: how-are-you-running + attributes: + label: How are you running Mairror API? + options: + - 'Running without Docker' + - 'Running using Docker' + - 'Other' + validations: + required: true + + - type: dropdown + id: what-component-is-causing-the-bug + attributes: + label: What component is causing the bug? + options: + - 'Python' + - 'Dependencies' + - 'Bot' + validations: + required: true + + - type: input + id: commit-hash + attributes: + label: Tell us what is the commit hash you run. + validations: + required: false + + - type: dropdown + id: regression-error + attributes: + label: Was this something which used to work for you, and then stopped? + options: + - 'It used to work, and then stopped' + - 'I never saw this working' + validations: + required: true + + - type: textarea + id: describe-bug + attributes: + label: Describe the bug + description: 'Do not report any security concerns here. Email organization members instead.' + validations: + required: true + + - type: textarea + id: debug-logs + attributes: + label: Relevant debug logs + description: | + Try not to raise a bug report unless you've looked at the logs first. + Paste the *relevant* logs here, not the entire thing and not just a link. to the dashboard (others do not have permissions to view them). + value: | +
Logs + + ``` + Copy/paste any log here, between the starting and ending backticks + ``` + +
+ validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..d58d8d1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Start a discussion (config, doubts, docs) + url: https://github.com/mairror/telegram-bot/discussions/new + about: If you have any questions about Mairror Telegram Bot configuration or doubts about whether you should create a feature request or bug report, or have problems with the documentation please click here to create a Discussion instead of an Issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..6560b00 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,32 @@ +name: Feature request +description: Suggest an idea for this project. +labels: ['type:feature', 'status:requirements', 'priority-5-triage'] +body: + - type: textarea + id: what-would-you-like-renovate-to-be-able-to-do + attributes: + label: What would you like Mairror Telegram Bot to be able to do? + description: Tell us what requirements you need solving, and be sure to mention too if this is part of any bigger problem you're trying to solve. + validations: + required: true + + - type: textarea + id: implementation-idea-textbox + attributes: + label: If you have any ideas on how this should be implemented, please tell us here. + description: | + In case you've already dug into existing options or source code and have ideas, mention them here. + Try to keep implementation ideas separate from requirements. + validations: + required: true + + - type: dropdown + id: interested-in-implementing-the-feature + attributes: + label: Is this a feature you are interested in implementing yourself? + options: + - 'Yes' + - 'Maybe' + - 'No' + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/refactor.yml b/.github/ISSUE_TEMPLATE/refactor.yml new file mode 100644 index 0000000..507b052 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/refactor.yml @@ -0,0 +1,15 @@ +name: Refactor (internal) +description: For internal use only. +labels: ['type:refactor', 'status:requirements', 'priority-5-triage'] +body: + - type: markdown + attributes: + value: '# This form is for Mairror maintainers only.' + + - type: textarea + id: describe-proposed-changes + attributes: + label: Describe the proposed change(s). + description: 'Do not report any security concerns here. Email the organization members instead.' + validations: + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6ef1411 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,30 @@ +# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates +# https://sysdogs.com/articles/automating-terraform-updates-with-dependabot + +# Set update schedule for GitHub Actions + +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + target-branch: "main" + schedule: + interval: "weekly" + assignees: + - "aacecandev" + - "blopezpi" + commit-message: + prefix: "[Github]" + + # Maintain dependencies for pip on telegram bot + - package-ecosystem: "pip" + directory: "/src" + target-branch: "main" + schedule: + interval: "weekly" + assignees: + - "aacecandev" + - "blopezpi" + commit-message: + prefix: "[PIP]" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e55d6a2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: "Build Bot" +on: + push: + tags: + - v*.*.* + +jobs: + build-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: ${{ runner.os }}-buildx- + + - name: Login to DockerHub Registry + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Push to Docker Hub + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64 + push: true + tags: | + mairror/mairror-bot:${{ github.ref_name }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..00f372e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: "Release Bot" +on: + push: + branches: + - main + +jobs: + new-release: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v2 + id: semantic + with: + semantic_version: "18.0.1" + extra_plugins: | + @semantic-release/github@8.0.2 + env: + GITHUB_TOKEN: ${{ secrets.PAT }} diff --git a/.hadolint.yml b/.hadolint.yml new file mode 100644 index 0000000..a101dd2 --- /dev/null +++ b/.hadolint.yml @@ -0,0 +1,16 @@ +# Docker linter https://github.com/hadolint/hadolint +# # https://github.com/hadolint/hadolint#rules + +failure-threshold: warning + +label-schema: + maintainer: text + +override: + warning: + - DL3049 # Label