Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.

Commit 882022c

Browse files
committed
ci: run swift package tests only when package related files changed
1 parent 7e34180 commit 882022c

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/main.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,42 @@ jobs:
5252
- name: Checkout repository
5353
uses: actions/checkout@v3
5454

55+
- name: Check change in source files
56+
id: changed_source
57+
uses: tj-actions/[email protected]
58+
with:
59+
files: |
60+
Sources/**/*
61+
Tests/**/*
62+
Package*.swift
63+
.github/actions/setup/action.yml
64+
.github/workflows/main.yml
65+
5566
- name: Setup repository
67+
if: steps.changed_source.outputs.any_changed == 'true'
5668
uses: ./.github/actions/setup
5769
with:
5870
swift: ${{ matrix.swift }}
5971

6072
- name: Run tests
73+
if: steps.changed_source.outputs.any_changed == 'true'
6174
run: npm run test
6275

6376
- name: Swift Coverage Report
64-
if: matrix.swift == '5.6' && github.event_name == 'push'
77+
if: |
78+
steps.changed_source.outputs.any_changed == 'true' &&
79+
matrix.swift == '5.6' &&
80+
github.event_name == 'push'
6581
uses: maxep/[email protected]
6682
with:
6783
file-format: lcov
6884
output-file: ./coverage.lcov
6985

7086
- name: Codecov upload
71-
if: matrix.swift == '5.6' && github.event_name == 'push'
87+
if: |
88+
steps.changed_source.outputs.any_changed == 'true' &&
89+
matrix.swift == '5.6' &&
90+
github.event_name == 'push'
7291
uses: codecov/[email protected]
7392
with:
7493
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)