From 2959b6cfdf2f2a45c6b6913d6072b37a54e4343e Mon Sep 17 00:00:00 2001 From: Bouke Haarsma Date: Sun, 29 Nov 2020 09:05:18 +0100 Subject: [PATCH] Test using GH actions --- .github/workflows/test.yml | 42 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 31 ---------------------------- Sources/main.swift | 3 +++ 3 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f6f63eb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: Test +on: + push: + branches: [ master ] + pull_request: +jobs: + Ubuntu: + runs-on: ubuntu-18.04 + strategy: + matrix: + swift: ['5.1', '5.2'] + steps: + - uses: actions/checkout@v2 + - name: Setup Swift ${{ matrix.swift }} + run: | + sudo apt install libavahi-compat-libdnssd-dev libsodium-dev libssl-dev + wget https://swift.org/builds/swift-${{ matrix.swift }}-release/ubuntu1804/swift-${{ matrix.swift }}-RELEASE/swift-${{ matrix.swift }}-RELEASE-ubuntu18.04.tar.gz + tar xzf swift-${{ matrix.swift }}-RELEASE-ubuntu18.04.tar.gz + export PATH=`pwd`/swift-${{ matrix.swift }}-RELEASE-ubuntu18.04/usr/bin:"${PATH}" + - name: Run Tests + run: swift test -c release -Xswiftc -enable-testing + macOS: + runs-on: macos-latest + continue-on-error: ${{ matrix.swift == '5.3' }} + strategy: + matrix: + swift: ['5.1', '5.2', '5.3'] + steps: + - uses: actions/checkout@v2 + - name: Setup Swift 5.1 + run: sudo xcode-select -s /Applications/Xcode_11.3.1.app/Contents/Developer + if: matrix.swift == '5.1' + - name: Setup Swift 5.2 + run: sudo xcode-select -s /Applications/Xcode_11.6.app/Contents/Developer + if: matrix.swift == '5.2' + - name: Setup Swift 5.3 + run: sudo xcode-select -s /Applications/Xcode_12_beta.app/Contents/Developer + if: matrix.swift == '5.3' + - name: Setup libsodium + run: brew install libsodium + - name: Run Tests + run: swift test -c release -Xswiftc -enable-testing diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0739911..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: generic -sudo: required -script: swift build -matrix: - include: - - name: Swift 5 on macOS - os: osx - osx_image: xcode10.3 - before_install: - - brew update - - brew install libsodium - - name: Swift 5 on Linux - os: linux - dist: trusty - before_install: - # workaround for https://travis-ci.community/t/then-sudo-apt-get-update-failed-public-key-is-not-available-no-pubkey-6b05f25d762e3157-in-ubuntu-xenial/1728 - - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157 - - sudo apt update - - sudo apt install libavahi-compat-libdnssd-dev - - wget https://swift.org/builds/swift-5.0-release/ubuntu1404/swift-5.0-RELEASE/swift-5.0-RELEASE-ubuntu14.04.tar.gz - - tar xzf swift-5.0-RELEASE-ubuntu14.04.tar.gz - - export PATH=`pwd`/swift-5.0-RELEASE-ubuntu14.04/usr/bin:"${PATH}" - - sudo apt-get install -y libssl-dev - - wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz - - tar xzf libsodium-1.0.16.tar.gz - - cd libsodium-1.0.16 - - ./configure - - make && make check - - sudo make install - - cd .. - - sudo ldconfig diff --git a/Sources/main.swift b/Sources/main.swift index 7089429..f029299 100644 --- a/Sources/main.swift +++ b/Sources/main.swift @@ -19,6 +19,9 @@ let thermostat = ICYThermostat(info: .init(name: "Thermostaat", serialNumber: "1 let device = HAP.Device(setupCode: "123-44-321", storage: FileStorage(filename: "configuration.json"), accessory: thermostat) let server = try HAP.Server(device: device, listenPort: 0) +//let speaker = Accessory(info: Service.Info(name: "My Speaker", serialNumber: "2"), type: .speaker, services: [Service.TelevisionSpeaker(name: "My Speaker")]) +//let device = HAP.Device(bridgeInfo: Service.Info(name: "My Bridge", serialNumber: "0"), storage: FileStorage(filename: "configuration.json"), + var keepRunning = true func stop() { DispatchQueue.main.async {