diff --git a/.github/workflows/actions/setup/action.yml b/.github/workflows/actions/setup/action.yml new file mode 100644 index 0000000..6b8c66d --- /dev/null +++ b/.github/workflows/actions/setup/action.yml @@ -0,0 +1,27 @@ +name: Set up environment +description: Set up the environment for building and testing the library on a given platform + +inputs: + xcode: + description: The version of Xcode to use + required: true + +runs: + using: composite + + steps: + - name: Set Ruby version + run: ruby -e 'puts RUBY_VERSION' | tee .ruby-version + shell: bash + + - name: Set up Ruby + uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 + with: + bundler-cache: true + cache-version: 1 + + - name: Setup Xcode + uses: mxcl/xcodebuild@6e60022a0cbe8c89278be2dd1773a2f68e7c5c87 + with: + xcode: ${{ inputs.xcode }} + action: none diff --git a/.github/workflows/actions/test/action.yml b/.github/workflows/actions/test/action.yml new file mode 100644 index 0000000..c38e152 --- /dev/null +++ b/.github/workflows/actions/test/action.yml @@ -0,0 +1,45 @@ +name: Run tests +description: Run library tests for a given platform + +inputs: + xcode: + description: The version of Xcode to use + required: true + scheme: + description: The Xcode scheme to use + required: true + platform: + description: The platform to build for + required: true + +runs: + using: composite + + steps: + - name: Install xcpretty + run: gem install xcpretty + shell: bash + + - name: Save Xcode version + run: xcodebuild -version | tee .xcode-version + shell: bash + + - id: restore-carthage-cache + name: Restore Carthage cache + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: Carthage + key: carthage-${{ inputs.platform }}-${{ hashFiles('Cartfile.resolved') }}-${{ hashFiles('.xcode-version') }}-v1 + + - name: Install dependencies + if: steps.restore-carthage-cache.outputs.cache-hit != 'true' + run: carthage bootstrap --platform ${{ inputs.platform }} --use-xcframeworks --no-use-binaries --cache-builds + shell: bash + + - name: Run tests + uses: mxcl/xcodebuild@6e60022a0cbe8c89278be2dd1773a2f68e7c5c87 + with: + xcode: ${{ inputs.xcode }} + scheme: ${{ inputs.scheme }} + platform: ${{ inputs.platform }} + code-coverage: true