Skip to content

Commit

Permalink
Use GH Action instead of on path filtering (conda#12180)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard authored Dec 15, 2022
1 parent 82fa24b commit 89d6f0f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 68 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/tests-skip.yml

This file was deleted.

81 changes: 61 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,10 @@ on:
branches:
- main
- feature/**
paths: # run if src/tests/recipe are modified
- conda/**
- conda_env/**
- tests/**
- '*.py'
- recipe/**
- .github/workflows/tests.yml

# NOTE: github.event context is pull_request payload:
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
pull_request:
paths:
- conda/**
- conda_env/**
- tests/**
- '*.py'
- recipe/**
- .github/workflows/tests.yml

concurrency:
# Concurrency group that uses the workflow name and PR number if available
Expand All @@ -39,7 +25,36 @@ concurrency:
cancel-in-progress: true

jobs:
# detect whether any code changes are included in this PR
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v3
# dorny/paths-filter needs git clone for push events
# https://github.com/marketplace/actions/paths-changes-filter#supported-workflows
if: github.event_name == 'push'
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
id: filter
with:
filters: |
code:
- 'conda/**'
- 'conda_env/**'
- 'tests/**'
- '*.py'
- 'recipe/**'
- '.github/workflows/tests.yml'
# windows test suite
windows:
# only run test suite if there are code changes
needs: changes
if: needs.changes.outputs.code == 'true'

runs-on: windows-2019
strategy:
fail-fast: false
Expand Down Expand Up @@ -115,7 +130,12 @@ jobs:
test-report.xml
retention-days: 1

# linux test suite
linux:
# only run test suite if there are code changes
needs: changes
if: needs.changes.outputs.code == 'true'

runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -159,7 +179,12 @@ jobs:
test-report.xml
retention-days: 1

# linux-qemu test suite
linux-qemu:
# only run test suite if there are code changes
needs: changes
if: needs.changes.outputs.code == 'true'

# Run one single fast test per docker+qemu emulated linux platform to test that
# test execution is possible there (container+tools+dependencies work). Can be
# changed / extended to run specific tests in case there are platform related
Expand Down Expand Up @@ -207,7 +232,12 @@ jobs:
test-report.xml
retention-days: 1

# macos test suite
macos:
# only run test suite if there are code changes
needs: changes
if: needs.changes.outputs.code == 'true'

runs-on: macos-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -280,10 +310,12 @@ jobs:
test-report.xml
retention-days: 1

analyze:
name: Analyze results
needs: [windows, linux, linux-qemu, macos]
if: always()
# aggregate and upload
aggregate:
# only aggregate test suite if there are code changes
needs: [changes, windows, linux, linux-qemu, macos]
if: needs.changes.outputs.code == 'true' && always()

runs-on: ubuntu-latest
steps:
- name: Download test results
Expand All @@ -303,12 +335,21 @@ jobs:
with:
paths: ./test-results-${{ github.sha }}-**/test-report*.xml

# required check
# required check
analyze:
name: Analyze results
needs: [windows, linux, linux-qemu, macos, aggregate]
if: always()

runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}

# canary builds
build:
name: Canary Build
needs: [analyze]
Expand Down

0 comments on commit 89d6f0f

Please sign in to comment.