Skip to content

Merge pull request #94 from William-Laverty/docs/update-project-struc… #165

Merge pull request #94 from William-Laverty/docs/update-project-struc…

Merge pull request #94 from William-Laverty/docs/update-project-struc… #165

name: Build & Test
permissions:
contents: read
on:
push:
branches:
- "main"
pull_request:
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
build-and-test:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
name: Build & Test with Coverage
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Xcode version
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: latest-stable
- name: Build
uses: ./.github/actions/xcodebuild
with:
configuration: Debug
- name: Run Tests with Coverage
uses: ./.github/actions/xcodebuild
with:
configuration: Debug
run-tests: "true"
enable-coverage: "true"
result-bundle-path: TestResults.xcresult
- name: Install and cache xcresultparser
uses: gerlero/brew-install@main
with:
packages: xcresultparser
- name: Convert Coverage to Codecov Format
run: |
xcresultparser --output-format cobertura TestResults.xcresult > coverage.xml
xcresultparser --output-format junit TestResults.xcresult > junit.xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
flags: coverage
name: middledrag-coverage
swift_project: MiddleDrag
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Test Results
uses: codecov/codecov-action@v5
if: ${{ !cancelled() }}
with:
report_type: test_results
files: ./junit.xml
flags: unittests
name: middledrag-unittests
swift_project: MiddleDrag
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: FOSSA Scan
uses: fossas/fossa-action@main
if: ${{ !cancelled() }}
with:
api-key: ${{ secrets.FOSSA_API_KEY }}
- name: Wait for FOSSA Analysis Processing
run: |
echo "⏳ Waiting 30s for FOSSA to process the analysis..."
sleep 30
if: ${{ !cancelled() }}
- name: FOSSA Test
uses: fossas/fossa-action@main
if: ${{ !cancelled() }}
with:
api-key: ${{ secrets.FOSSA_API_KEY }}
run-tests: true
- name: Add FOSSA Report to Summary
if: ${{ !cancelled() }}
run: |
echo "## FOSSA License Compliance" >> $GITHUB_STEP_SUMMARY
echo "✅ FOSSA scan completed successfully" >> $GITHUB_STEP_SUMMARY