diff --git a/.github/actions/set_up_macos/action.yml b/.github/actions/set_up_macos/action.yml new file mode 100644 index 000000000..e267c880b --- /dev/null +++ b/.github/actions/set_up_macos/action.yml @@ -0,0 +1,27 @@ +name: Set Up macOS Runner +description: Prepare macOS runner to execute tests. + +inputs: + repo_name: + description: The name of the GitHub repo. + required: true + xcode_version: + description: The version of Xcode to use. + default: '14.0.1' + +runs: + using: composite + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ inputs.xcode_version }} + - name: Confirm Xcode Version + shell: bash + run: | + # Print used xCode version + xcode-select -print-path + xcodebuild -version + - uses: cgrindel/gha_set_up_bazel@v1 + with: + repo_name: ${{ inputs.repo_name }} + diff --git a/.github/actions/test_example/action.yml b/.github/actions/test_example/action.yml new file mode 100644 index 000000000..31d28aa5e --- /dev/null +++ b/.github/actions/test_example/action.yml @@ -0,0 +1,19 @@ +name: Test Examples +description: Execute an example integration test. + +inputs: + example_name: + description: The name of the example. + required: true + bazel_version: + description: The Bazel version suffix (e.g. semver or .bazelversion) + required: true + +runs: + using: composite + steps: + - name: Execute Integration Test + shell: bash + run: | + bazelisk test //examples:${{ inputs.example_name }}_test_bazel_${{ inputs.bazel_version }} + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ce76f1be..339fa0a86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,23 +9,68 @@ on: jobs: - macos_build: + macos_tidy_and_test: runs-on: macos-12 steps: - - uses: maxim-lobanov/setup-xcode@v1 + - uses: actions/checkout@v3 + - uses: ./.github/actions/set_up_macos with: - xcode-version: '14.0.1' - - name: Confirm Xcode Version + xcode_version: '14.0.1' + repo_name: swift_bazel + - name: Ensure everything is tidy shell: bash run: | - # Print used xCode version - xcode-select -print-path - xcodebuild -version + bazelisk run //:tidy_check + - name: Execute Tests + shell: bash + run: | + bazelisk test //... + + + macos_single_bazel_ver_int_test_matrix: + strategy: + matrix: + example: + - "firebase_example" + - "interesting_deps" + - "ios_sim" + - "objc_code" + - "phone_number_kit" + - "xcmetrics_example" + bazel_version: + - ".bazelversion" + runs-on: macos-12 + steps: - uses: actions/checkout@v3 - - uses: cgrindel/gha_set_up_bazel@v1 + - uses: ./.github/actions/set_up_macos with: + xcode_version: '14.0.1' repo_name: swift_bazel - - uses: ./.github/actions/build_and_test + - uses: ./.github/actions/test_example + with: + example_name: ${{ matrix.example }} + bazel_version: ${{ matrix.bazel_version }} + + macos_multi_bazel_ver_int_test_matrix: + strategy: + matrix: + example: + - "http_archive_ext_deps" + - "pkg_manifest_minimal" + bazel_version: + - ".bazelversion" + - "5_4_0" + runs-on: macos-12 + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/set_up_macos + with: + xcode_version: '14.0.1' + repo_name: swift_bazel + - uses: ./.github/actions/test_example + with: + example_name: ${{ matrix.example }} + bazel_version: ${{ matrix.bazel_version }} ubuntu_build: runs-on: ubuntu-22.04 @@ -57,7 +102,11 @@ jobs: all_ci_tests: runs-on: ubuntu-20.04 - needs: [macos_build, ubuntu_build] + needs: + - macos_tidy_and_test + - macos_single_bazel_ver_int_test_matrix + - macos_multi_bazel_ver_int_test_matrix + - ubuntu_build if: ${{ always() }} steps: - uses: cgrindel/gha_join_jobs@v1