Skip to content

Commit

Permalink
CI: Run "GMT Dev Tests" if PR is labeled with 'run/test-gmt-dev' (#2960)
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman authored Jan 7, 2024
1 parent ecefd53 commit af7892f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 36 deletions.
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Fixes #
**Slash Commands**

You can write slash commands (`/command`) in the first line of a comment to perform
specific operations. Supported slash commands are:
specific operations. Supported slash command is:

- `/format`: automatically format and lint the code
- `/test-gmt-dev`: run full tests on the latest GMT development version
42 changes: 10 additions & 32 deletions .github/workflows/ci_tests_dev.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# Test PyGMT with GMT dev version on Linux/macOS/Windows
#
# This workflow runs regular PyGMT tests with the GMT dev version, and also
# pre-release versions of several dependencies like NumPy, Pandas, Xarray, etc.
# If any tests fail, it also uploads the diff images as workflow artifacts.
# The GMT dev version is installed by fetching the latest source codes from
# the GMT master branch and compiling.
# This workflow runs regular PyGMT tests with the GMT dev version, and also pre-release
# versions of several dependencies like NumPy, Pandas, Xarray, etc. If any tests fail,
# it also uploads the diff images as workflow artifacts. The GMT dev version is
# installed by fetching the latest source codes from the GMT master branch and
# compiling.
#
# It is triggered when a pull request is marked as "ready as review", or using
# the slash command `/test-gmt-dev`. It is also scheduled to run on Monday,
# Wednesday, and Friday on the main branch.
# It is triggered when a pull request is marked as "ready as review", or labeled with
# 'run/test-gmt-dev'. It is also scheduled to run on Monday, Wednesday, and Friday on
# the main branch.
#
name: GMT Dev Tests

on:
# push:
# branches: [ main ]
pull_request:
types: [ready_for_review]
types: [ opened, reopened, labeled, synchronize ]
paths:
- 'pygmt/**'
- '.github/workflows/ci_tests_dev.yaml'
repository_dispatch:
types: [test-gmt-dev-command]
# Schedule tests on Monday/Wednesday/Friday
schedule:
- cron: '0 0 * * 1,3,5'
Expand All @@ -34,6 +32,7 @@ jobs:
test_gmt_dev:
name: ${{ matrix.os }} - GMT ${{ matrix.gmt_git_ref }}
runs-on: ${{ matrix.os }}
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run/test-gmt-dev')
strategy:
fail-fast: false
matrix:
Expand All @@ -48,31 +47,10 @@ jobs:
# Checkout current git repository
- name: Checkout
uses: actions/[email protected]
if: github.event_name != 'repository_dispatch'
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0

# Checkout the pull request branch
- name: Checkout
uses: actions/[email protected]
if: github.event_name == 'repository_dispatch'
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
# fetch all history so that setuptools-scm works
fetch-depth: 0

- name: Show job URL
uses: peter-evans/[email protected]
if: github.event_name == 'repository_dispatch' && runner.os == 'Linux'
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/[email protected]
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Support slash commands in pull requests
#
# Currently, two slash commands `format` and `test-gmt-dev` are supported.
# Currently, only one slash command `format` is supported.
#
name: Slash Command Dispatch
on:
Expand All @@ -19,6 +19,5 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
commands: |
format
test-gmt-dev
issue-type: pull-request
permission: none

0 comments on commit af7892f

Please sign in to comment.