From 55112f58c1b5c681bfc557706a0b7225ed40bf0c Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Wed, 13 Dec 2023 10:28:52 +0000 Subject: [PATCH] ci: add github workflows --- .github/ISSUE_TEMPLATE/bug_report.md | 40 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 19 +++++++++++ .github/labeler.yml | 14 ++++++++ .github/workflows/build-ci.yml | 20 ++++++++++++ .github/workflows/build.yml | 14 ++++++++ .github/workflows/docs.yml | 24 ++++++++++++++ .github/workflows/pr_label.yml | 14 ++++++++ .github/workflows/publish.yml | 13 ++++++++ .github/workflows/pytest.yml | 18 ++++++++++ .github/workflows/wiki.yml | 15 +++++++++ 10 files changed, 191 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/build-ci.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/pr_label.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/pytest.yml create mode 100644 .github/workflows/wiki.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..9b77ea71 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,40 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "" +labels: "" +assignees: "" +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] + +**Smartphone (please complete the following information):** + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..2bc5d5f7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "" +labels: "" +assignees: "" +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..181f80db --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,14 @@ +"devops": + - ".github/**/*" + - "Dockerfile" + - "*entrypoint.sh" + - "Makefile" +"dependency": + - "pyproject.toml" + - "pdm.lock" +"documentation": + - "docs/**/*" + - "mkdocs.yml" + - "README.md" +"version": + - "tm_admin/__version__.py" diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml new file mode 100644 index 00000000..022db813 --- /dev/null +++ b/.github/workflows/build-ci.yml @@ -0,0 +1,20 @@ +name: ๐Ÿ”ง Build CI Img + +on: + # Push includes PR merge + push: + branches: [main] + paths: + # Workflow is triggered only if deps change + - "pyproject.toml" + - "Dockerfile" + # Allow manual trigger + workflow_dispatch: + +jobs: + ci-build: + uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.4.0 + with: + build_target: ci + image_tags: | + "ghcr.io/${{ github.repository }}:ci" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..e47d8501 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,14 @@ +name: ๐Ÿ”ง Build + +on: + push: + tags: ["*"] + # Allow manual trigger + workflow_dispatch: + +jobs: + ci-build: + uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.4.0 + with: + build_target: prod + image_name: "ghcr.io/${{ github.repository }}" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..bd09f118 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,24 @@ +name: ๐Ÿ“– Publish Docs + +on: + push: + paths: + - docs/** + - tm_admin/** + - mkdocs.yml + branches: [main] + # Allow manual trigger (workflow_dispatch) + workflow_dispatch: + +jobs: + build_doxygen: + uses: hotosm/gh-workflows/.github/workflows/doxygen_build.yml@1.4.0 + with: + output_path: docs/apidocs + + publish_docs: + uses: hotosm/gh-workflows/.github/workflows/mkdocs_build.yml@1.4.0 + needs: [build_doxygen] + with: + image: ghcr.io/${{ github.repository }}:ci + doxygen: true diff --git a/.github/workflows/pr_label.yml b/.github/workflows/pr_label.yml new file mode 100644 index 00000000..1e5a3895 --- /dev/null +++ b/.github/workflows/pr_label.yml @@ -0,0 +1,14 @@ +name: ๐Ÿท๏ธ PR Label + +on: + pull_request_target: + +jobs: + pr-label: + runs-on: ubuntu-latest + + steps: + - uses: actions/labeler@v4 + # Uses .github/labeler.yml definitions + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..58a95c3c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,13 @@ +name: ๐Ÿšฉ Publish to PyPi.org + +on: + release: + types: [published] + # Allow manual trigger (workflow_dispatch) + workflow_dispatch: + +jobs: + publish_to_pypi: + uses: hotosm/gh-workflows/.github/workflows/pypi_publish.yml@1.4.0 + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 00000000..56126d1f --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,18 @@ +name: ๐Ÿงช PyTest + +on: + # Run tests on all pushed branches + push: + branches: [main] + # Run tests on PR, prior to merge to main & development + pull_request: + branches: [main] + # Allow manual trigger (workflow_dispatch) + workflow_dispatch: + +jobs: + pytest: + uses: hotosm/gh-workflows/.github/workflows/test_pytest.yml@1.4.0 + with: + image_name: ghcr.io/${{ github.repository }} + tag_override: ${{ github.event_name == 'push' && 'ci' || '' }} diff --git a/.github/workflows/wiki.yml b/.github/workflows/wiki.yml new file mode 100644 index 00000000..0e821e83 --- /dev/null +++ b/.github/workflows/wiki.yml @@ -0,0 +1,15 @@ +name: ๐Ÿ“– Publish Docs to Wiki + +on: + push: + paths: + - docs/** + branches: [main] + # Allow manual trigger (workflow_dispatch) + workflow_dispatch: + +jobs: + publish-docs-to-wiki: + uses: hotosm/gh-workflows/.github/workflows/wiki.yml@1.4.0 + with: + homepage_path: "wiki_redirect.md"