Browse Source

Merge pull request #49 from norio-nomura/use-github-actions

Setup GitHub Actions workflow
Norio Nomura 6 years ago
parent
commit
2d7673716d
3 changed files with 91 additions and 123 deletions
  1. 0 45
      .circleci/config.yml
  2. 91 0
      .github/workflows/ci.yml
  3. 0 78
      azure-pipelines.yml

+ 0 - 45
.circleci/config.yml

@@ -1,45 +0,0 @@
-version: 2.1
-jobs:
-  xcode_codecov:
-    macos:
-      xcode: "10.0.0"
-    shell: /bin/bash --login -eo pipefail
-    environment:
-      XCODE_FLAGS: -scheme Base32
-      XCODE_FLAGS_FOR_TEST: -enableCodeCoverage YES -parallel-testing-enabled NO
-    steps:
-      - checkout
-      - run: mkdir -p build/reports
-      - run: >
-          xcodebuild $XCODE_FLAGS $XCODE_FLAGS_FOR_TEST test |
-          xcpretty -r junit -o build/reports/xcodebuild-macOS.xml
-      - store_test_results:
-          path: build/reports/
-      - run: bash <(curl -s https://codecov.io/bash)
-
-  test_with_image:
-    parameters:
-      image:
-        type: string
-    docker:
-      - image: << parameters.image >>
-    steps:
-      - checkout
-      - run: swift test
-
-workflows:
-  workflow:
-    jobs:
-      - xcode_codecov
-      - test_with_image:
-          name: linux_swift_4.0
-          image: norionomura/swift:4.0
-      - test_with_image:
-          name: linux_swift_4.1
-          image: norionomura/swift:4.1
-      - test_with_image:
-          name: linux_swift_4.2
-          image: norionomura/swift:4.2
-      - test_with_image:
-          name: linux_swift_5.0
-          image: norionomura/swift:5.0

+ 91 - 0
.github/workflows/ci.yml

@@ -0,0 +1,91 @@
+name: CI
+on:
+  push:
+    branches:
+      - master
+  pull_request: {}
+
+jobs:
+  xcodebuild:
+    name: xcodebuild
+    strategy:
+      matrix:
+        xcode:
+          - version: '9.4.1'
+          - version: '10'
+            flag_for_test: -enableCodeCoverage YES -parallel-testing-enabled NO
+          - version: '10.1'
+            flag_for_test: -enableCodeCoverage YES -parallel-testing-enabled NO
+          - version: '10.2'
+            flag_for_test: -enableCodeCoverage YES -parallel-testing-enabled NO
+          - version: '10.2.1'
+            flag_for_test: -enableCodeCoverage YES -parallel-testing-enabled NO
+          - version: '10.3'
+            flag_for_test: -enableCodeCoverage YES -parallel-testing-enabled NO
+          - version: '11'
+            flag_for_test: -enableCodeCoverage YES -parallel-testing-enabled NO
+    runs-on: macOS-10.14
+    steps:
+      - uses: actions/checkout@v1
+      - run: xcodebuild -version
+        env: 
+          DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode.version }}.app
+      - name: macOS
+        env:
+          DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode.version }}.app
+        run: xcodebuild -scheme Base32 ${{ matrix.xcode.flag_for_test }} test | xcpretty
+        shell: bash
+      - name: iPhone Simulator
+        env:
+          DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode.version }}.app
+        run: > 
+          xcodebuild -scheme Base32 ${{ matrix.xcode.flag_for_test }} test
+          -sdk iphonesimulator -destination "name=iPhone 8" | xcpretty
+        shell: bash
+      - name: Apple TV Simulator
+        env:
+          DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode.version }}.app
+        run: >
+          xcodebuild -scheme Base32 ${{ matrix.xcode.flag_for_test }} test
+          -sdk appletvsimulator -destination "name=Apple TV 4K" | xcpretty
+        shell: bash
+      - name: watchOS Simulator
+        env:
+          DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode.version }}.app
+        run: xcodebuild -scheme Base32 build -sdk watchsimulator | xcpretty
+        shell: bash
+      - run: bash <(curl -s https://codecov.io/bash)
+        shell: bash
+
+  SwiftPM_on_macOS:
+    name: SwiftPM on macOS
+    strategy:
+      matrix:
+        xcode: ['9.4.1','10','10.1','10.2','10.2.1','10.3','11']
+    runs-on: macOS-10.14
+    steps:
+      - uses: actions/checkout@v1
+      - env:
+          DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app
+        run: swift test
+
+  pod_lib_lint:
+    name: pod lib lint
+    runs-on: macOS-10.14
+    steps:
+      - uses: actions/checkout@v1
+      - run: pod lib lint
+        env:
+          DEVELOPER_DIR: /Applications/Xcode_10.3.app
+
+  SwiftPM_on_Linux:
+    name: SwiftPM on Linux
+    strategy:
+      matrix:
+        tag: ['4.1', '4.2', '5.0', '5.1']
+    runs-on: ubuntu-latest
+    container:
+      image: norionomura/swift:${{ matrix.tag }}
+    steps:
+      - uses: actions/checkout@v1
+      - run: swift test

+ 0 - 78
azure-pipelines.yml

@@ -1,78 +0,0 @@
-trigger:
-- master
-jobs:
-- job: macOS
-  pool:
-    vmImage: $[ coalesce(variables['VM_IMAGE'], 'macOS-10.13') ] 
-  strategy:
-    maxParallel: 10
-    matrix:
-      Xcode 9.0.1:
-        DEVELOPER_DIR: '/Applications/Xcode_9.0.1.app'
-      Xcode 9.1:
-        DEVELOPER_DIR: '/Applications/Xcode_9.1.app'
-      Xcode 9.2:
-        DEVELOPER_DIR: '/Applications/Xcode_9.2.app'
-      Xcode 9.3.1:
-        DEVELOPER_DIR: '/Applications/Xcode_9.3.1.app'
-      Xcode 9.4.1:
-        DEVELOPER_DIR: '/Applications/Xcode_9.4.1.app'
-      Xcode 10:
-        DEVELOPER_DIR: '/Applications/Xcode_10.app'
-        XCODE_FLAGS_FOR_TEST: -parallel-testing-enabled NO
-      Xcode 10.1:
-        DEVELOPER_DIR: '/Applications/Xcode_10.1.app'
-        XCODE_FLAGS_FOR_TEST: -parallel-testing-enabled NO
-      Xcode 10.2:
-        DEVELOPER_DIR: '/Applications/Xcode_10.2.app'
-        VM_IMAGE: 'macOS-10.14'
-        XCODE_FLAGS_FOR_TEST: -parallel-testing-enabled NO
-  steps:
-    - script: |
-        xcodebuild -version
-        echo "##vso[task.setvariable variable=XCODE_FLAGS]-scheme Base32 $XCODE_FLAGS_FOR_TEST"
-      displayName: xcodebuild -version & set XCODE_FLAGS
-    - script: >
-        set -o pipefail &&
-        xcodebuild $XCODE_FLAGS test |
-        xcpretty -r junit -o build/reports/xcodebuild-macOS.xml
-      displayName: tests on macOS
-      condition: succeededOrFailed()
-    - script: >
-        set -o pipefail &&
-        xcodebuild $XCODE_FLAGS test -sdk iphonesimulator -destination "name=iPhone 8" |
-        xcpretty -r junit -o build/reports/xcodebuild-iOS.xml
-      displayName: tests on iOS
-      condition: succeededOrFailed()
-    - script: >
-        set -o pipefail &&
-        xcodebuild $XCODE_FLAGS test -sdk appletvsimulator -destination "name=Apple TV 4K" |
-        xcpretty -r junit -o build/reports/xcodebuild-tvOS.xml
-      displayName: tests on tvOS
-      condition: succeededOrFailed()
-    - script: >
-        set -o pipefail &&
-        xcodebuild $XCODE_FLAGS build -sdk watchsimulator -destination "name=Apple Watch Series 3 - 38mm" |
-        xcpretty
-      displayName: build on watchOS
-      condition: succeededOrFailed()
-    - script: >
-        set -o pipefail &&
-        swift test 2>&1 |
-        xcpretty -r junit -o build/reports/swift-test.xml
-      displayName: swift test
-      condition: succeededOrFailed()
-    - task: PublishTestResults@2
-      inputs:
-        testRunner: JUnit
-        testResultsFiles: build/reports/**
-      condition: succeededOrFailed()
-
-- job: pod_lib_lint
-  pool:
-    vmImage: 'macOS-10.14'
-  variables:
-    DEVELOPER_DIR: '/Applications/Xcode_10.2.app'
-  steps:
-    - script: pod lib lint
-      displayName: pod lib lint