One Call API 3.0 (#13) #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Swift | |
on: | |
push: | |
branches: [main] | |
paths: | |
- "Sources/**/*.swift" | |
- "Tests/**/*.swift" | |
pull_request: | |
branches: [main] | |
paths: | |
- "Sources/**/*.swift" | |
- "Tests/**/*.swift" | |
jobs: | |
test-swift: | |
name: Test Swift Code | |
runs-on: macos-14 | |
steps: | |
- name: Configure Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Cache SPM dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .build | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
- name: Build | |
run: swift build -v | |
- name: Run tests | |
run: swift test --enable-code-coverage -v | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
- name: Convert coverage report | |
continue-on-error: true | |
run: Scripts/convert-coverage-report --target HPOpenWeatherPackageTests | |
- name: Upload coverage reports to Codecov | |
continue-on-error: true | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: henrik-dmg/HPOpenWeather | |
lint-code: | |
name: Lint Swift Code | |
runs-on: macos-14 | |
steps: | |
- name: Configure Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Cache SPM dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .build | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
- name: Install SwiftLint | |
run: brew install swift-format peripheryapp/periphery/periphery | |
- name: Lint code | |
run: Scripts/lint-swift-code | |
- name: Scan for dead code | |
run: periphery scan --strict --config config/periphery.yml |