Skip to content

Commit

Permalink
Split out cron workflow into it's own workflow
Browse files Browse the repository at this point in the history
fixes sunpy#98
  • Loading branch information
Cadair committed Oct 31, 2024
1 parent 4ca8e60 commit cb002af
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 18 deletions.
4 changes: 3 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"author_name": "",
"author_email": "",
"project_url": "",
"github_repo": "sunpy/sunpy",
"license": [
"BSD 3-Clause",
"GNU GPL v3+",
Expand All @@ -16,7 +17,8 @@
"3.9",
"3.10",
"3.11",
"3.12"
"3.12",
"3.13"
],
"use_compiled_extensions": "n",
"enable_dynamic_dev_versions": "n",
Expand Down
17 changes: 0 additions & 17 deletions {{ cookiecutter.package_name }}/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,6 @@ jobs:
envs: |
- linux: build_docs
cron:
if: |
github.event_name == 'workflow_dispatch' || (
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'Run cron CI')
)
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '{{ default_python }}'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
envs: |
- linux: py311-devdeps
secrets:
CODECOV_TOKEN: {{ '${{ secrets.CODECOV_TOKEN }}' }}

publish:
# Build wheels on PRs only when labelled. Releases will only be published if tagged ^v.*
# see https://github-actions-workflows.openastronomy.org/en/latest/publish.html#upload-to-pypi
Expand Down
54 changes: 54 additions & 0 deletions {{ cookiecutter.package_name }}/.github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% set default_python = '3.12' %}
name: Daily cron

on:
workflow_dispatch:
schedule:
# ┌───────── minute (0 - 59)
# │ ┌───────── hour (0 - 23)
# │ │ ┌───────── day of the month (1 - 31)
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
- cron: '0 3 * * *' # run every day at 3am UTC
pull_request:
# We also want this workflow triggered if the 'Run cron CI' label is added
# or present when PR is updated
types:
- synchronize
- labeled
push:
# We want this workflow to always run on release branches as well as
# all tags since we want to be really sure we don't introduce
# regressions on the release branches, and it's also important to run
# this on pre-release and release tags.
branches:
- 'main'
- '*.*'
- '!*backport*'
tags:
- 'v*'
- '!*dev*'
- '!*pre*'
- '!*post*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
cron:
# Run on all triggers other than pull_request unless there's a label
if: (github.repository == '{{ cookiecutter.github_repo }}' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Run cron CI')))
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '{{ default_python }}'
submodules: false
coverage: codecov
toxdeps: tox-pypi-filter
envs: |
- linux: py311-devdeps
secrets:
CODECOV_TOKEN: {{ '${{ secrets.CODECOV_TOKEN }}' }}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ on:

jobs:
update:
# Do not run this workflow on forks
if: github.repository == '{{ cookiecutter.github_repo }}'
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand Down Expand Up @@ -86,6 +88,9 @@ jobs:
delete-branch: true
draft: ${{ steps.cruft_update.outputs.merge_conflicts == '1' }}
title: "Updates from the package template"
labels: |
No Changelog Entry Needed
pre-commit.ci run
body: |
This is an autogenerated PR, which will applies the latest changes from the [SunPy Package Template](https://github.com/sunpy/package-template).
If this pull request has been opened as a draft there are conflicts which need fixing.
Expand Down

0 comments on commit cb002af

Please sign in to comment.