From 8968ab0d6ea8cc3fcd133d2c7b2b1dbeaf1d9d16 Mon Sep 17 00:00:00 2001 From: Bernd Storath <999999bst@gmail.com> Date: Wed, 5 Mar 2025 11:58:31 +0100 Subject: [PATCH] improve gh actions, issue templates --- .github/ISSUE_TEMPLATE/01-bug-report.yml | 7 ++- .github/ISSUE_TEMPLATE/02-feature-request.yml | 3 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/workflows/codeql.yml | 8 ++- .github/workflows/deploy-development.yml | 38 ++++++++++-- .github/workflows/deploy-nightly.yml | 34 ++++++---- .github/workflows/deploy-pr.yml | 8 +-- .github/workflows/deploy.yml | 42 ++++++++----- .github/workflows/lint.yml | 62 +++---------------- docs/requirements.txt | 4 ++ 10 files changed, 112 insertions(+), 96 deletions(-) create mode 100644 docs/requirements.txt diff --git a/.github/ISSUE_TEMPLATE/01-bug-report.yml b/.github/ISSUE_TEMPLATE/01-bug-report.yml index bd9b0f74..517d812c 100644 --- a/.github/ISSUE_TEMPLATE/01-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/01-bug-report.yml @@ -4,6 +4,7 @@ description: Create a report to help us improve title: "[Bug]: " labels: - "type: bug" +type: Bug body: - type: markdown @@ -11,7 +12,7 @@ body: value: | **Thanks :heart: for taking the time to fill out this bug report!** We kindly ask that you search to see if an issue [already exists](https://github.com/wg-easy/wg-easy/issues?q=is%3Aissue+sort%3Acreated-desc+) for the bug you encountered. - + - type: textarea id: what-happened attributes: @@ -20,7 +21,7 @@ body: value: "A bug happened!" validations: required: true - + - type: textarea id: what-should-happen attributes: @@ -29,7 +30,7 @@ body: value: "Work just fine!" validations: required: true - + - type: textarea id: logs attributes: diff --git a/.github/ISSUE_TEMPLATE/02-feature-request.yml b/.github/ISSUE_TEMPLATE/02-feature-request.yml index b8c1f914..ab4fd081 100644 --- a/.github/ISSUE_TEMPLATE/02-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/02-feature-request.yml @@ -2,8 +2,7 @@ name: 🛠️ Feature Request description: Suggest an idea to help us improve title: "[Feat]: " -labels: - - "type: feature request" +type: Feature body: - type: markdown diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 421000eb..8ae875e1 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,4 +2,4 @@ contact_links: - name: Get Help url: https://github.com/wg-easy/wg-easy/discussions/new?category=q-a about: If you can't get something to work the way you expect, open a question in the discussions. -blank_issues_enabled: false \ No newline at end of file +blank_issues_enabled: false diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 191c33e2..5a9792fc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,10 +1,12 @@ -name: "CodeQL" +name: CodeQL on: push: - branches: ["master"] + branches: + - master pull_request: - branches: ["master"] + branches: + - master schedule: - cron: "15 0 * * *" diff --git a/.github/workflows/deploy-development.yml b/.github/workflows/deploy-development.yml index d1907ba1..1ea24f43 100644 --- a/.github/workflows/deploy-development.yml +++ b/.github/workflows/deploy-development.yml @@ -1,11 +1,11 @@ -name: Build & Publish Development +name: Development on: workflow_dispatch: jobs: - deploy: - name: Build & Deploy + docker: + name: Build & Deploy Docker runs-on: ubuntu-latest if: github.repository_owner == 'wg-easy' permissions: @@ -32,7 +32,37 @@ jobs: with: context: . push: true - platforms: linux/amd64,linux/arm64/v8 + platforms: linux/amd64,linux/arm64 tags: ghcr.io/wg-easy/wg-easy:development cache-from: type=gha cache-to: type=gha,mode=min + + docs: + name: Build & Deploy Docs + runs-on: ubuntu-latest + if: github.repository_owner == 'wg-easy' + permissions: + contents: write + needs: docker + steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.11.9 + cache: "pip" + + - name: Install Dependencies + run: | + pip install -r docs/requirements.txt + + - name: Setup Git User + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Build Docs Website + run: | + cd docs + git fetch origin gh-pages --depth=1 || true + + mike deploy --push --update-aliases development diff --git a/.github/workflows/deploy-nightly.yml b/.github/workflows/deploy-nightly.yml index 8fe8927c..5088649c 100644 --- a/.github/workflows/deploy-nightly.yml +++ b/.github/workflows/deploy-nightly.yml @@ -1,4 +1,4 @@ -name: Build & Publish Nightly +name: Nightly on: workflow_dispatch: @@ -6,13 +6,13 @@ on: - cron: "0 0 * * *" jobs: - deploy: - name: Build & Deploy + docker: + name: Build & Deploy Docker runs-on: ubuntu-latest if: github.repository_owner == 'wg-easy' permissions: packages: write - contents: write + contents: read steps: - uses: actions/checkout@v4 with: @@ -36,25 +36,37 @@ jobs: with: context: . push: true - platforms: linux/amd64,linux/arm64/v8 + platforms: linux/amd64,linux/arm64 tags: ghcr.io/wg-easy/wg-easy:nightly cache-from: type=gha cache-to: type=gha,mode=min + docs: + name: Build & Deploy Docs + runs-on: ubuntu-latest + if: github.repository_owner == 'wg-easy' + permissions: + contents: write + needs: docker + steps: - name: Setup Python uses: actions/setup-python@v5 with: python-version: 3.11.9 + cache: "pip" + - name: Install Dependencies run: | - pip install mkdocs-material - pip install pillow cairosvg mike - - name: Setup Docs Deploy + pip install -r docs/requirements.txt + + - name: Setup Git User run: | - git config --global user.name 'Docs Deploy Bot' - git config --global user.email 'docs.deploy@users.noreply.github.com' + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + - name: Build Docs Website run: | cd docs - git fetch origin gh-pages --depth=1 + git fetch origin gh-pages --depth=1 || true + mike deploy --push --update-aliases nightly diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index a0a0b442..4a3f38e2 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -1,4 +1,4 @@ -name: Build Pull Request +name: Pull Request on: workflow_dispatch: @@ -9,8 +9,8 @@ concurrency: cancel-in-progress: true jobs: - deploy: - name: Build & Deploy + docker: + name: Build Docker runs-on: ubuntu-latest if: github.repository_owner == 'wg-easy' permissions: @@ -37,7 +37,7 @@ jobs: with: context: . push: false - platforms: linux/amd64,linux/arm64/v8 + platforms: linux/amd64,linux/arm64 tags: ghcr.io/wg-easy/wg-easy:pr cache-from: type=gha cache-to: type=gha,mode=min diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1189d2e8..25263210 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Build & Publish Latest +name: Production on: workflow_dispatch: @@ -7,15 +7,15 @@ on: - "v*" jobs: - deploy: - name: Build & Deploy + docker: + name: Build & Deploy Docker runs-on: ubuntu-latest if: | github.repository_owner == 'wg-easy' && startsWith(github.ref, 'refs/tags/v') permissions: packages: write - contents: write + contents: read steps: - uses: actions/checkout@v4 @@ -48,31 +48,45 @@ jobs: with: context: . push: true - platforms: linux/amd64,linux/arm64/v8 + platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=min + docs: + name: Build & Deploy Docs + runs-on: ubuntu-latest + if: | + github.repository_owner == 'wg-easy' && + startsWith(github.ref, 'refs/tags/v') + permissions: + contents: write + needs: docker + steps: - name: Setup Python uses: actions/setup-python@v5 with: python-version: 3.11.9 + cache: "pip" + - name: Install Dependencies run: | - pip install mkdocs-material - pip install pillow cairosvg mike - - name: Setup Docs Deploy + pip install -r docs/requirements.txt + + - name: Setup Git User run: | - git config --global user.name 'Docs Deploy Bot' - git config --global user.email 'docs.deploy@users.noreply.github.com' + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + - name: Build Docs Website run: | cd docs - git fetch origin gh-pages --depth=1 - mike deploy --push --update-aliases ${{ github.ref_name }} latest + git fetch origin gh-pages --depth=1 || true + + # latest will point to old docs if old tag is pushed - # Extract version numbers (remove 'v' prefix) + # Extract version numbers DOCS_VERSION=${GITHUB_REF#refs/tags/} # e.g. v1.2.3 or v1.2.3-beta MINOR_VERSION=$(echo $DOCS_VERSION | cut -d. -f1,2) # e.g. v1.2 @@ -81,6 +95,6 @@ jobs: echo "Stable release detected: $DOCS_VERSION" mike deploy --push --update-aliases $MINOR_VERSION latest else - echo "Prerelease detected: $DOCS_VERSION" + echo "Pre-release detected: $DOCS_VERSION" mike deploy --push --update-aliases Pre-release fi diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b0a57490..8091b929 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,7 +4,6 @@ on: push: branches: - master - - production pull_request: jobs: @@ -12,58 +11,13 @@ jobs: name: Lint runs-on: ubuntu-latest if: github.repository_owner == 'wg-easy' - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - run_install: false - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "lts/*" - check-latest: true - cache: "pnpm" - - - name: pnpm lint - run: | - cd src - pnpm install - pnpm lint - - typecheck: - name: Typecheck - runs-on: ubuntu-latest - if: github.repository_owner == 'wg-easy' - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - run_install: false + strategy: + fail-fast: false + max-parallel: 3 + matrix: + command: ["lint", "typecheck", "format:check"] - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: "20" - check-latest: true - cache: "pnpm" - - - name: pnpm typecheck - run: | - cd src - pnpm install - pnpm typecheck - - formatcheck: - name: Check format - runs-on: ubuntu-latest - if: github.repository_owner == 'wg-easy' steps: - name: Checkout repository uses: actions/checkout@v4 @@ -76,12 +30,12 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "lts/*" check-latest: true cache: "pnpm" - - name: pnpm format:check + - name: pnpm ${{ matrix.command }} run: | cd src pnpm install - pnpm format:check + pnpm ${{ matrix.command }} diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..e0aaf166 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,4 @@ +mkdocs-material +pillow +cairosvg +mike