Skip to content

Commit 2c20c66

Browse files
authored
Fix coverage merging (#12)
* fix coverage * remove platform arg * fix
1 parent 8fc7949 commit 2c20c66

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

.github/octocov.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ coverage:
44
acceptable: current >= 60%
55
testExecutionTime:
66
if: false
7-
comment:
8-
if: is_pull_request
97
diff:
108
datastores:
119
- artifact://${GITHUB_REPOSITORY}

.github/workflows/coverage.yaml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ on:
1313
- reopened
1414
jobs:
1515
Linux:
16-
runs-on: ubuntu-latest
1716
strategy:
1817
matrix:
18+
runs-on: ['ubuntu-24.04', 'ubuntu-24.04-arm']
1919
version: ['8.4']
2020
type: ['cli', 'zts']
2121
distro: ['bookworm']
22-
outputs:
23-
matrix: ${{ toJson(matrix) }}
22+
runs-on: ${{ matrix.runs-on }}
2423
steps:
2524
- name: Checkout
2625
uses: actions/checkout@v4
@@ -30,14 +29,14 @@ jobs:
3029
uses: docker/setup-buildx-action@v3
3130
- name: Build container
3231
run: |
33-
docker compose build --pull --no-cache --build-arg PLATFORM="linux/amd64" --build-arg IMAGE="php" --build-arg TAG="${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}"
32+
docker compose build --pull --no-cache --build-arg IMAGE="php" --build-arg TAG="${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}"
3433
- name: Test with gcov
3534
run: |
3635
docker compose run -v "$(pwd)/ext:/ext" --rm shell pskel coverage
3736
- name: Upload coverage to artifact
3837
uses: actions/upload-artifact@v4
3938
with:
40-
name: coverage-${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}
39+
name: coverage-${{ matrix.runs-on }}-${{ matrix.version }}-${{ matrix.type }}-${{ matrix.distro }}
4140
path: ${{ github.workspace }}/ext/lcov.info
4241
Coverage:
4342
needs: [Linux]
@@ -47,17 +46,35 @@ jobs:
4746
uses: actions/checkout@v4
4847
- name: Download coverage artifacts
4948
uses: actions/download-artifact@v4
49+
with:
50+
path: coverage-artifacts
51+
- name: Install lcov
52+
run: sudo apt-get install -y lcov
5053
- name: Merge coverages
5154
run: |
52-
sudo apt-get install -y "lcov"
53-
LCOV_FILES="$(find . -name "lcov.info")"
54-
CMD="$(which "lcov")"
55-
for LCOV_FILE in ${LCOV_FILES}; do
56-
CMD+=" -a ${LCOV_FILE}"
55+
LCOV_FILES=$(find coverage-artifacts -name "lcov.info" -type f)
56+
57+
if [ -z "$LCOV_FILES" ]; then
58+
echo "No lcov.info files found in the artifacts!"
59+
exit 1
60+
fi
61+
62+
CMD="lcov"
63+
for LCOV_FILE in $LCOV_FILES; do
64+
echo "Adding coverage file: $LCOV_FILE"
65+
CMD+=" -a $LCOV_FILE"
5766
done
5867
CMD+=" -o lcov.info"
59-
echo "Merging coverages: ${LCOV_FILES}"
60-
${CMD}
68+
69+
echo "Executing: $CMD"
70+
eval $CMD
71+
72+
if [ ! -f "lcov.info" ]; then
73+
echo "Failed to generate merged lcov.info file!"
74+
exit 1
75+
fi
76+
77+
echo "Successfully merged $(echo $LCOV_FILES | wc -w) coverage files."
6178
- name: Report coverage
6279
uses: k1LoW/octocov-action@v1
6380
with:

0 commit comments

Comments
 (0)