Skip to content

Commit

Permalink
ci: Update code coverage action step
Browse files Browse the repository at this point in the history
  • Loading branch information
surpher committed Apr 25, 2024
1 parent 8aa7829 commit 6ed8064
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_macos13_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

jobs:
testMacOS13:
name: "⚗️ macOS 13"
name: "⚗️ macOS 13 (Intel)"
runs-on: macos-13

strategy:
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/test_macos14_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ jobs:
- name: "🏗 Use Xcode 15.3"
run: sudo xcode-select -switch /Applications/Xcode_15.3.app

- name: "🛠 Prepare Tools"
run: |
sh Support/prepare_build_tools
- name: "⚗️ Run tests"
run: |
sh Support/prepare_build_tools
sh Support/build_test
- name: "⬆️ Upload code coverage"
run: |
bash <(curl -s https://codecov.io/bash) -J 'PactSwiftMockServer'
- name: "⬆️ Upload coverage reports"
uses: codecov/codecov-action@v3
with:
override_branch: ${{ github.ref_name }}
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PactSwiftMockServer

[![Build and Test](https://github.com/surpher/PactSwiftMockServer/actions/workflows/build_test.yml/badge.svg?branch=main)](https://github.com/surpher/PactSwiftMockServer/actions/workflows/build_test.yml)
[![Build and Test](https://github.com/surpher/PactSwiftMockServer/actions/workflows/build_test.yml/badge.svg)](https://github.com/surpher/PactSwiftMockServer/actions/workflows/build_test.yml)
[![MIT License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](LICENSE.md)
[![codecov](https://codecov.io/gh/surpher/PactSwiftMockServer/branch/main/graph/badge.svg?token=0LYZVF36I9)](https://codecov.io/gh/surpher/PactSwiftMockServer)

Expand Down
15 changes: 9 additions & 6 deletions Support/build_test
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@

set -euo pipefail

SOURCE_DIR="${BASH_SOURCE[0]%/*}"

# "import"
source "$SOURCE_DIR/utils.sh"

# Properties
SCHEME=${SCHEME:-"PactSwiftMockServer-macOS"}
DESTINATION=${DESTINATION:-"arch=arm64"}
DERIVED_DATA_PATH=".build/DerivedData"

set -o pipefail && xcodebuild clean test \
-project PactSwiftMockServer.xcodeproj \
-scheme "$SCHEME" \
-destination "$DESTINATION" \
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES \
GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcbeautify
# Run tests
executeCommand "xcodebuild clean test -project \"PactSwiftMockServer.xcodeproj\" -scheme \"$SCHEME\" -destination \"$DESTINATION\" -enableCodeCoverage YES -derivedDataPath \"$DERIVED_DATA_PATH\" GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES | xcbeautify"
16 changes: 16 additions & 0 deletions Support/prepare_build_tools
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

set -euo pipefail

SOURCE_DIR="${BASH_SOURCE[0]%/*}"

# "import"
source "$SOURCE_DIR/utils.sh"

brew install cbindgen
brew install doxygen

Expand All @@ -25,3 +32,12 @@ if [[ "$CI" == false ]]; then
brew install xcbeautify
brew install swiftlint
fi

function installRustTools {
executeCommand "brew install cbindgen doxygen"
}

function installXcodeTools {
executeCommand "brew tap thii/xcbeautify https://github.com/thii/xcbeautify.git"
executeCommand "brew install xcbeautify swiftlint"
}
45 changes: 22 additions & 23 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
codecov:
notify:
require_ci_to_pass: yes
notify: {}
require_ci_to_pass: true

comment:
behavior: default
layout: header, diff
require_changes: false

coverage:
precision: 2
range:
- 75.0
- 100.0
round: down
range: "75...100"

status:
project: yes
patch: yes
changes: no
changes: false
patch: true
project: true

ignore:
- "Tests/**/*"
- "Tests"
- "Resources/**/*"
- "Resources"
- "Support/**/*"
- "Support"
ignore:
- (?s:Resources/.*/[^\/]+)\Z
- ^Resources.*
- (?s:Support/.*/[^\/]+)\Z
- ^Support.*

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "header, diff"
behavior: default
require_changes: no
conditional: true
loop: true
macro: false
method: false

0 comments on commit 6ed8064

Please sign in to comment.