Skip to content

Commit

Permalink
[MNT] Update workflows (#229)
Browse files Browse the repository at this point in the history
* update workflows

* back to 13
  • Loading branch information
MatthewMiddlehurst authored Jun 8, 2024
1 parent 9ee877d commit 8b2aafe
Show file tree
Hide file tree
Showing 18 changed files with 447 additions and 22 deletions.
63 changes: 63 additions & 0 deletions .github/actions/numba_cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Numba cache setup
description: "Tries to restore the numba cache and sets relevant environment variables for numba to use"

inputs:
cache_name:
description: "The name of the cache"
required: true
runner_os:
description: "The runner os"
required: true
python_version:
description: "The python version"
required: true
restore_cache:
description: "Whether to restore the cache"
required: false
default: "true"

runs:
using: "composite"
steps:
# Set the location for numba cache to exist
- name: Set numba cache env
run: echo "NUMBA_CACHE_DIR=${{ github.workspace }}/.numba_cache" >> $GITHUB_ENV
shell: bash

# Sets the cpu name for numba to use
- name: Set numba cpu env
run: echo "NUMBA_CPU_NAME=generic" >> $GITHUB_ENV
shell: bash

# Sets the cpu features for numba to use
- name: Set numba cpu features env
run: echo "NUMBA_CPU_FEATURES=+64bit +adx +aes +avx +avx2 -avx512bf16 -avx512bitalg -avx512bw -avx512cd -avx512dq -avx512er -avx512f -avx512ifma -avx512pf -avx512vbmi -avx512vbmi2 -avx512vl -avx512vnni -avx512vpopcntdq +bmi +bmi2 -cldemote -clflushopt -clwb -clzero +cmov +cx16 +cx8 -enqcmd +f16c +fma -fma4 +fsgsbase +fxsr -gfni +invpcid -lwp +lzcnt +mmx +movbe -movdir64b -movdiri -mwaitx +pclmul -pconfig -pku +popcnt -prefetchwt1 +prfchw -ptwrite -rdpid +rdrnd +rdseed +rtm +sahf -sgx -sha -shstk +sse +sse2 +sse3 +sse4.1 +sse4.2 -sse4a +ssse3 -tbm -vaes -vpclmulqdq -waitpkg -wbnoinvd -xop +xsave -xsavec +xsaveopt -xsaves" >> $GITHUB_ENV
shell: bash

# Set the CICD_RUNNING env so that numba knows it is running in a CI environment
- name: Set CICD_RUNNING env
run: echo "CICD_RUNNING=1" >> $GITHUB_ENV
shell: bash

# Get current date for cache restore
- name: Get Current Date
run: echo "CURRENT_DATE=$(date +'%d/%m/%Y')" >> $GITHUB_ENV
shell: bash

# GNU tar on windows runs much faster than the default BSD tar
- name: Use GNU tar instead BSD tar if Windows
if: ${{ inputs.runner_os == 'Windows' }}
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"

# Restore cache if restore_cache is true
- name: Restore cache
uses: actions/cache/restore@v4
if: ${{ inputs.restore_cache == 'true' }}
with:
path: ${{ github.workspace }}/.numba_cache
# Try restore using today's date
key: numba-${{ inputs.cache_name }}-${{ inputs.runner_os }}-${{ inputs.python_version }}-${{ env.CURRENT_DATE }}
# If cant restore with today's date try another cache (without date)
restore-keys: |
numba-${{ inputs.cache_name }}-${{ inputs.runner_os }}-${{ inputs.python_version }}-
33 changes: 33 additions & 0 deletions .github/workflows/issue_comment_edited.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Issue Comment Posted

on:
issue_comment:
types: [edited]

jobs:
check-pr-labels:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: build_tools

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install PyGithub
run: pip install -Uq PyGithub

- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PR_APP_ID }}
private-key: ${{ secrets.PR_APP_KEY }}

- name: Assign issue
run: python build_tools/comment_pr_labeler.py
env:
CONTEXT_GITHUB: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
33 changes: 33 additions & 0 deletions .github/workflows/issue_comment_posted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Issue Comment Posted

on:
issue_comment:
types: [created]

jobs:
self-assign:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: build_tools

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install PyGithub
run: pip install -Uq PyGithub

- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PR_APP_ID }}
private-key: ${{ secrets.PR_APP_KEY }}

- name: Assign issue
run: python build_tools/issue_assign.py
env:
CONTEXT_GITHUB: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
34 changes: 34 additions & 0 deletions .github/workflows/periodic_github_maintenace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: GitHub Maintenance

on:
schedule:
# Run on 1st and 15th of every month at 01:00 AM UTC
- cron: "0 1 1,15 * * *"
workflow_dispatch:

permissions:
issues: write
contents: write

jobs:
stale_branches:
runs-on: ubuntu-20.04

steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PR_APP_ID }}
private-key: ${{ secrets.PR_APP_KEY }}

- name: Stale Branches
uses: crs-k/[email protected]
with:
repo-token: ${{ steps.app-token.outputs.token }}
days-before-stale: 365
days-before-delete: 99999
comment-updates: true
tag-committer: true
stale-branch-label: "stale branch"
compare-branches: "info"
pr-check: true
32 changes: 30 additions & 2 deletions .github/workflows/periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ jobs:
with:
python-version: "3.10"

- name: Use numba cache to set env variables but not restore cache
uses: ./.github/actions/numba_cache
with:
cache_name: "run-notebook-examples"
runner_os: ${{ runner.os }}
python_version: "3.10"
restore_cache: "false"

- name: Install
uses: nick-fields/retry@v3
with:
Expand All @@ -60,13 +68,19 @@ jobs:
run: build_tools/run_examples.sh
shell: bash

- name: Save new cache
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/.numba_cache
key: numba-run-notebook-examples-${{ runner.os }}-3.10-${{ env.CURRENT_DATE }}

pytest:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, macOS-13, windows-2022 ]
os: [ ubuntu-20.04, macos-13, windows-2022 ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:
Expand All @@ -76,6 +90,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Use numba cache to set env variables but not restore cache
uses: ./.github/actions/numba_cache
with:
cache_name: "pytest"
runner_os: ${{ runner.os }}
python_version: ${{ matrix.python-version }}
restore_cache: "false"

- name: Install
uses: nick-fields/retry@v3
with:
Expand All @@ -89,6 +111,12 @@ jobs:
- name: Tests
run: python -m pytest

- name: Save new cache
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/.numba_cache
key: numba-pytest-${{ runner.os }}-${{ matrix.python-version}}-${{ env.CURRENT_DATE }}

codecov:
runs-on: ubuntu-20.04

Expand All @@ -113,7 +141,7 @@ jobs:
run: python -m pip list

- name: Run tests
run: python -m pytest --cov=aeon --cov-report=xml
run: python -m pytest --cov=aeon --cov-report=xml --timeout 1800

- uses: codecov/codecov-action@v4
env:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/pr_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ jobs:
with:
python-version: "3.10"

- name: Restore numba cache
uses: ./.github/actions/numba_cache
with:
cache_name: "run-notebook-examples"
runner_os: ${{ runner.os }}
python_version: "3.10"

- name: Install
uses: nick-fields/retry@v3
with:
Expand All @@ -36,5 +43,5 @@ jobs:
command: python -m pip install .[all_extras,dev,binder,unstable_extras]

- name: Run example notebooks
run: build_tools/run_examples.sh
run: build_tools/run_examples.sh ${{ github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'full examples run') }}
shell: bash
10 changes: 8 additions & 2 deletions .github/workflows/pr_opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@ jobs:

- name: Label pull request
id: label-pr
run: python build_tools/pr_labeler.py ${{ steps.app-token.outputs.token }}
run: python build_tools/pr_labeler.py
env:
CONTEXT_GITHUB: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Write pull request comment
run: python build_tools/pr_open_commenter.py ${{ steps.app-token.outputs.token }} ${{ steps.label-pr.outputs.title-labels }} ${{ steps.label-pr.outputs.title-labels-new }} ${{ steps.label-pr.outputs.content-labels }} ${{ steps.label-pr.outputs.content-labels-status }}
run: python build_tools/pr_open_commenter.py
env:
CONTEXT_GITHUB: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
TITLE_LABELS: ${{ steps.label-pr.outputs.title-labels }}
TITLE_LABELS_NEW: ${{ steps.label-pr.outputs.title-labels-new }}
CONTENT_LABELS: ${{ steps.label-pr.outputs.content-labels }}
CONTENT_LABELS_STATUS: ${{ steps.label-pr.outputs.content-labels-status }}
19 changes: 16 additions & 3 deletions .github/workflows/pr_pre_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,22 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PR_APP_ID }}
private-key: ${{ secrets.PR_APP_KEY }}

- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ steps.app-token.outputs.token }}

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- uses: tj-actions/changed-files@v44.5.2
- uses: tj-actions/changed-files@v44
id: changed-files

- name: List changed files
Expand All @@ -40,5 +49,9 @@ jobs:
with:
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}

- if: ${{ failure() && github.event_name == 'pull_request' && github.event.pull_request.draft == false }}
uses: pre-commit-ci/[email protected]
- if: ${{ failure() && github.event_name == 'pull_request' && github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'stop pre-commit fixes')}}
name: Push pre-commit fixes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Automatic `pre-commit` fixes
commit_user_name: tsml-actions-bot[bot]
11 changes: 9 additions & 2 deletions .github/workflows/pr_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, macOS-13, windows-2022 ]
os: [ ubuntu-20.04, windows-2022 ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:
Expand All @@ -33,6 +33,13 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Restore numba cache
uses: ./.github/actions/numba_cache
with:
cache_name: "pytest"
runner_os: ${{ runner.os }}
python_version: ${{ matrix.python-version }}

- name: Install
uses: nick-fields/retry@v3
with:
Expand Down Expand Up @@ -67,7 +74,7 @@ jobs:
command: python -m pip install .[all_extras,dev,unstable_extras]

- name: Tests
run: python -m pytest --cov=tsml_eval --cov-report=xml
run: python -m pytest --cov=tsml_eval --cov-report=xml --timeout 1800

- uses: codecov/codecov-action@v4
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/precommit_autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
python-version: "3.10"

- uses: browniebroke/pre-commit-autoupdate-action@v1.0.0
- uses: browniebroke/pre-commit-autoupdate-action@v1

- if: always()
uses: actions/create-github-app-token@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

strategy:
matrix:
os: [ ubuntu-20.04, macOS-13, windows-2022 ]
os: [ ubuntu-20.04, macos-13, windows-2022 ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:
Expand Down
Loading

0 comments on commit 8b2aafe

Please sign in to comment.