diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ca78e22d..a2faf6cf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,17 +1,32 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# Dependabot version updates. +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file +# +# Same shape in every commit-check repository: monthly, one grouped pull +# request per ecosystem, `chore(deps)` commit subjects. The one exception is +# pip here, which stays daily with no cooldown: requirements.txt pins the +# commit-check release this action ships, and a new release should reach the +# action the day it is published. version: 2 updates: - package-ecosystem: github-actions directory: / schedule: - interval: "weekly" + interval: monthly + commit-message: + prefix: chore + include: scope + groups: + github-actions: + patterns: + - "*" + - package-ecosystem: pip directory: / schedule: - interval: "daily" + interval: daily cooldown: default-days: 0 + commit-message: + prefix: chore + include: scope diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 0d0b1c99..00000000 --- a/.github/stale.yml +++ /dev/null @@ -1 +0,0 @@ -_extends: .github diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 55% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index 8746dee5..c65213fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Test +name: CI permissions: contents: read @@ -44,3 +44,33 @@ jobs: - name: Run unit tests run: python -m pytest main_test.py -v + + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + # Nothing after checkout needs authenticated git. + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + # 3.10 is the real floor, see the test job + python-version: "3.10" + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install pytest pytest-cov + - name: Run tests with coverage + run: | + pytest --cov=main --cov-report=xml --cov-report=term-missing main_test.py + - name: Upload coverage to Codecov + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 + with: + # Required: main is a protected branch, so Codecov rejects tokenless uploads. + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + flags: unittests + name: codecov-umbrella + # Hard-fail on push to main so a broken upload is visible; on PRs the + # report is informational and a flaky upload should not block review. + fail_ci_if_error: ${{ github.event_name == 'push' }} diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 0c06122c..c4168b29 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -1,5 +1,8 @@ name: Commit Check +permissions: + contents: read + on: pull_request: branches: 'main' diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 47007838..00000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Coverage - -on: - push: - branches: [main] - pull_request: - branches: [main] - -permissions: - contents: read - -jobs: - coverage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - # Nothing after checkout needs authenticated git. - persist-credentials: false - - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 - with: - # 3.10 is the real floor, see test.yml - python-version: "3.10" - - name: Install dependencies - run: | - pip install -r requirements.txt - pip install pytest pytest-cov - - name: Run tests with coverage - run: | - pytest --cov=main --cov-report=xml --cov-report=term-missing main_test.py - - name: Upload coverage to Codecov - uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 - with: - # Required: main is a protected branch, so Codecov rejects tokenless uploads. - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - flags: unittests - name: codecov-umbrella - # Hard-fail on push to main so a broken upload is visible; on PRs the - # report is informational and a flaky upload should not block review. - fail_ci_if_error: ${{ github.event_name == 'push' }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 83151faf..e8a10886 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,4 +1,4 @@ -name: Run pre-commit +name: pre-commit permissions: contents: read diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index d25c13ec..75257228 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -6,6 +6,11 @@ on: - "main" workflow_dispatch: +permissions: {} + jobs: draft-release: + permissions: + contents: write + pull-requests: write uses: commit-check/.github/.github/workflows/release-drafter.yml@main diff --git a/.github/workflows/release.yaml b/.github/workflows/retag.yml similarity index 98% rename from .github/workflows/release.yaml rename to .github/workflows/retag.yml index 7c6760bd..71c6415a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/retag.yml @@ -1,4 +1,4 @@ -name: Release +name: Retag v2 permissions: contents: write diff --git a/LICENSE b/LICENSE index 149b4e31..47d4b6bb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 shenxianpeng (xianpeng.shen@gmail.com) +Copyright (c) 2023 Xianpeng Shen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal