ci: Use eclipse-mosquitto image instead of custom (#147) #471
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
macos: | |
runs-on: macOS-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install and run Mosquitto | |
run: | | |
brew install mosquitto | |
mosquitto -d -c mosquitto/config/mosquitto.conf | |
- name: SPM tests | |
run: swift test --enable-code-coverage | |
- name: Convert coverage files | |
run: | | |
xcrun llvm-cov export -format "lcov" \ | |
.build/debug/mqtt-nioPackageTests.xctest/Contents/MacOs/mqtt-nioPackageTests \ | |
-ignore-filename-regex="\/Tests\/" \ | |
-instr-profile=.build/debug/codecov/default.profdata > info.lcov | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v2 | |
with: | |
file: info.lcov | |
ios: | |
runs-on: macOS-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Xcodebuild | |
run: | | |
xcodebuild build -scheme mqtt-nio -destination 'platform=iOS Simulator,name=iPhone 11' | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
tag: | |
- swift:5.7 | |
- swift:5.8 | |
- swift:5.9 | |
- swiftlang/swift:nightly-5.10-jammy | |
container: | |
image: ${{ matrix.tag }} | |
services: | |
mosquitto: | |
image: eclipse-mosquitto | |
options: --name mosquitto | |
ports: | |
- 1883:1883 | |
- 1884:1884 | |
- 8883:8883 | |
- 8080:8080 | |
- 8081:8081 | |
volumes: | |
- ${{ github.workspace }}/mosquitto/config:/mosquitto/config | |
- ${{ github.workspace }}/mosquitto/certs:/mosquitto/certs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Restart Mosquitto | |
# The mosquitto service container is started *before* mqtt-nio is checked | |
# out. Restarting the container after the checkout step is needed for the | |
# container to see volumes populated from the checked out workspace. | |
uses: docker://docker | |
with: | |
args: docker restart mosquitto | |
- name: Test | |
env: | |
MOSQUITTO_SERVER: mosquitto | |
run: | | |
swift test --enable-test-discovery --enable-code-coverage | |
- name: Convert coverage files | |
run: | | |
llvm-cov export -format="lcov" \ | |
.build/debug/mqtt-nioPackageTests.xctest \ | |
-ignore-filename-regex="\/Tests\/" \ | |
-instr-profile .build/debug/codecov/default.profdata > info.lcov | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v2 | |
with: | |
file: info.lcov |