Update README.md #180
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: build | |
on: | |
push: | |
branches: | |
- main | |
- github-actions | |
- 'release-**' | |
pull_request: | |
branches: | |
- main | |
- github-actions | |
- 'release-**' | |
env: | |
# Expected to be used within scripts. | |
LANG: en_US.UTF-8 | |
PACKAGE_TEST_DIRECTORY: "InstructionsPackageTest" | |
TEST_DIRECTORY: "Instructions" | |
# Wether or not to perform certain steps. | |
run_pod_lint: true | |
build_app_extension_example: true | |
run_tests: true | |
jobs: | |
test-package: | |
name: Check installation | |
runs-on: macos-13 | |
steps: | |
- name: Switch Xcode version | |
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app | |
- name: Check out test repository | |
uses: actions/checkout@v2 | |
with: | |
repository: "ephread/InstructionsPackageTest" | |
path: ${{ env.PACKAGE_TEST_DIRECTORY }} | |
- name: Install test dependencies | |
working-directory: ./${{ env.PACKAGE_TEST_DIRECTORY }} | |
run: | | |
bundle install | |
- name: Test SwiftPM import | |
working-directory: ./${{ env.PACKAGE_TEST_DIRECTORY }} | |
run: | | |
bundle exec fastlane test_swiftpm | |
- name: Test CocoaPods import | |
working-directory: ./${{ env.PACKAGE_TEST_DIRECTORY }} | |
run: | | |
bundle exec fastlane test_cocoapods | |
- name: Test Carthage import | |
working-directory: ./${{ env.PACKAGE_TEST_DIRECTORY }} | |
run: | | |
bundle exec fastlane test_carthage | |
test: | |
name: Build, lint & test | |
runs-on: macos-13 | |
steps: | |
- name: Switch Xcode version | |
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
with: | |
path: ${{ env.TEST_DIRECTORY }} | |
- name: Install test dependencies | |
working-directory: ./${{ env.TEST_DIRECTORY }} | |
run: | | |
bundle install | |
- name: Run Cocoapods' linter | |
if: env.run_pod_lint == 'true' | |
working-directory: ./${{ env.TEST_DIRECTORY }} | |
# Warnings might be allowed in versions where Instructions | |
# continue to support deprecated methods. | |
run: | | |
if [ $ALLOW_WARNINGS == "YES" ]; then | |
pod lib lint --allow-warnings; | |
else | |
pod lib lint; | |
fi | |
- name: Run tests | |
if: env.run_tests == 'true' | |
working-directory: ./${{ env.TEST_DIRECTORY }} | |
run: | | |
bundle exec fastlane test_all | |
- name: Upload Failure Diffs | |
uses: actions/upload-artifact@v2 | |
if: failure() && env.run_tests == 'true' | |
with: | |
name: FailureDiffs | |
path: "${{github.workspace}}/${{env.TEST_DIRECTORY}}/Examples/Example/Snapshot\ Tests/Supporting\ Files/Snapshots/FailureDiffs/" | |
- name: Convert and upload coverage | |
uses: paambaati/codeclimate-action@v2.6.0 | |
if: env.run_tests == 'true' | |
env: | |
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} | |
with: | |
coverageCommand: "cd '${{env.TEST_DIRECTORY}}' && slather coverage -x --build-directory Build/" | |
coverageLocations: "${{github.workspace}}/${{env.TEST_DIRECTORY}}/Tests/cobertura.xml:cobertura" |