From 7a1e5f43d9e4fb622585af9809d8acf8e05bacdc Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 23 Apr 2022 12:35:39 -0400 Subject: [PATCH] Workflow updates - Do not re-run PR tests on edited PRs - Close added/fixed issues on published release - Issues stale after 60 days instead of 30, close after 10 days instead of 5 - Use Vankka/pr-target-branch-action for checking that PR is made to proper branch - Add version number to sphinx config, must use cmake to configure the file - Add jobs to readthedocs.yaml configuration --- .github/workflows/CI.yml | 2 +- .github/workflows/clang.yml | 2 +- .github/workflows/issues-closer.yml | 21 ++++++++++++++++++ .github/workflows/issues-stale.yml | 4 ++-- .github/workflows/pull-requests.yml | 34 +++++++++-------------------- .readthedocs.yaml | 5 +++++ CMakeLists.txt | 1 + docs/source/{conf.py => conf.py.in} | 4 ++-- 8 files changed, 43 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/issues-closer.yml rename docs/source/{conf.py => conf.py.in} (97%) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index da3cc6ed..b0be1130 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -3,7 +3,7 @@ name: CI on: pull_request: branches: [master, nightly] - types: [opened, synchronize, edited, reopened] + types: [opened, synchronize, reopened] push: branches: [master] workflow_dispatch: diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index f096c5f9..fd62d261 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -3,7 +3,7 @@ name: clang-format-lint on: pull_request: branches: [master, nightly] - types: [opened, synchronize, edited, reopened] + types: [opened, synchronize, reopened] jobs: lint: diff --git a/.github/workflows/issues-closer.yml b/.github/workflows/issues-closer.yml new file mode 100644 index 00000000..943bae37 --- /dev/null +++ b/.github/workflows/issues-closer.yml @@ -0,0 +1,21 @@ +name: Close Added/Fixed Issues + +on: + release: + types: [published] + +jobs: + close_issues: + name: Check Issues / PRs + runs-on: ubuntu-latest + steps: + - name: Close Issues (added/fixed) + uses: actions/stale@v3 + with: + only-issues-labels: 'added,fixed' + close-issue-message: > + This is now available in the latest release. + close-issue-label: 'released' + days-before-issue-stale: 0 + days-before-issue-close: 0 + ignore-updates: true diff --git a/.github/workflows/issues-stale.yml b/.github/workflows/issues-stale.yml index 1c40c45d..233582bd 100644 --- a/.github/workflows/issues-stale.yml +++ b/.github/workflows/issues-stale.yml @@ -26,8 +26,8 @@ jobs: This PR was closed because it has been stalled for 5 days with no activity. stale-pr-label: 'stale' exempt-pr-labels: 'status:in-progress' - days-before-stale: 30 - days-before-close: 5 + days-before-stale: 60 + days-before-close: 10 - name: Invalid Template uses: actions/stale@v5 diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index ad014e6d..36f597b9 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -5,31 +5,17 @@ on: types: [opened, synchronize, edited, reopened] jobs: - check-branch: + check-pull-request: name: Check Pull Request runs-on: ubuntu-latest steps: - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Branch check - if: ( github.head_ref == 'repo-sync/common-repo-files/default' && github.base_ref == 'master' ) || ( github.head_ref == 'nightly' && github.base_ref == 'master' ) - run: | - echo Base: "$GITHUB_BASE_REF" - echo Head: "$GITHUB_HEAD_REF" - echo "branch=True" >> $GITHUB_ENV - - - name: Comment on Pull Request - uses: mshick/add-pr-comment@v1 - if: github.base_ref != 'nightly' && env.branch != 'True' + - uses: Vankka/pr-target-branch-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - message: Pull requests must be made to the `nightly` branch. Thanks. - repo-token: ${{ secrets.GITHUB_TOKEN }} - repo-token-user-login: 'github-actions[bot]' - - - name: Fail Workflow - if: github.base_ref != 'nightly' && env.branch != 'True' - run: | - echo Base: "$GITHUB_BASE_REF" - echo Head: "$GITHUB_HEAD_REF" - exit 1 + target: master + exclude: nightly # Don't prevent going from nightly -> master + change-to: nightly + comment: | + Your PR was set to `master`, PRs should be sent to `nightly` + The base branch of this PR has been automatically changed to `nightly`, please check that there are no merge conflicts diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 78c304f8..5f62d86b 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,6 +10,11 @@ build: os: ubuntu-20.04 tools: python: "3.9" + jobs: + post_system_dependencies: + - apt-get install cmake + pre_create_environment: + - cmake .. # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/CMakeLists.txt b/CMakeLists.txt index 862e4f1a..dcbd6942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,6 +319,7 @@ else() endif() configure_file(version.h.in version.h @ONLY) +configure_file(docs/source/conf.py.in "${CMAKE_CURRENT_SOURCE_DIR}/docs/source/conf.py" @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}) set(SUNSHINE_TARGET_FILES diff --git a/docs/source/conf.py b/docs/source/conf.py.in similarity index 97% rename from docs/source/conf.py rename to docs/source/conf.py.in index 0375d42b..99ce7143 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py.in @@ -26,7 +26,7 @@ copyright = f'{datetime.now ().year}, {project}' author = 'ReenigneArcher' # The full version, including alpha/beta/rc tags -# version = '0.13.0' +version = '@PROJECT_VERSION@' # -- General configuration --------------------------------------------------- @@ -60,7 +60,7 @@ source_suffix = ['.rst', '.md'] # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] -html_logo = os.path.join(root_dir, 'sunshine.ico') +html_logo = os.path.join(root_dir, 'sunshine.png') # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes.