diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..26df7a4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - "*" + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + mac: + name: MacOS 12 + runs-on: macos-12 + strategy: + matrix: + xcode: ["14.2"] + steps: + - uses: actions/checkout@v3 + - name: Select Xcode ${{ matrix.xcode }} + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app + - name: Print Swift version + run: swift --version + - name: Run test + run: make test-swift + + linux: + name: Ubuntu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run test + run: make test-linux diff --git a/Makefile b/Makefile index c0bc485..0af395f 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,18 @@ -PLATFORM_IOS = iOS Simulator,name=iPhone 11 Pro Max -PLATFORM_MACOS = macOS -PLATFORM_TVOS = tvOS Simulator,name=Apple TV 4K (at 1080p) (2nd generation) +test-all: test-swift test-linux -default: test-all +test-swift: + swift test --parallel -test-all: test-ios test-macos test-tvos - -test-ios: - xcodebuild test \ - -scheme Realtime \ - -destination platform="$(PLATFORM_IOS)" - -test-macos: - xcodebuild test \ - -scheme Realtime \ - -destination platform="$(PLATFORM_MACOS)" - -test-tvos: - xcodebuild test \ - -scheme Realtime \ - -destination platform="$(PLATFORM_TVOS)" +test-linux: + docker run \ + --rm \ + -v "$(PWD):$(PWD)" \ + -w "$(PWD)" \ + swift:5.5 \ + bash -c 'make test-swift' format: - swift format \ - --ignore-unparsable-files \ - --in-place \ - --recursive \ - ./Package.swift ./Sources ./Tests + swift format --in-place --recursive . -.PHONY: format test-all test-ios test-macos test-tvos +.PHONY: test-swift test-linux format