Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
metrics-changed: ${{ steps.set-flags.outputs.metrics-changed }}
python-changed: ${{ steps.set-flags.outputs.python-changed }}
rust-changed: ${{ steps.set-flags.outputs.rust-changed }}
swift-changed: ${{ steps.set-flags.outputs.swift-changed }}
yaml-changed: ${{ steps.set-flags.outputs.yaml-changed }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down Expand Up @@ -83,6 +84,13 @@ jobs:
**/Cargo.lock
**/*.rs
base_sha: ${{ github.event.pull_request.base.sha || github.event.before }}
- id: changed-files-swift
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: |
glean-core/ios/**
samples/ios/app/**
base_sha: ${{ github.event.pull_request.base.sha || github.event.before }}
- id: changed-files-yaml
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
Expand All @@ -99,6 +107,7 @@ jobs:
METRICS_CHANGED: ${{ github.ref_name == 'main' || steps.changed-files-metrics.outputs.any_changed }}
PYTHON_CHANGED: ${{ github.ref_name == 'main' || steps.changed-files-python.outputs.any_changed }}
RUST_CHANGED: ${{ github.ref_name == 'main' || steps.changed-files-rust.outputs.any_changed }}
SWIFT_CHANGED: ${{ github.ref_name == 'main' || steps.changed-files-swift.outputs.any_changed }}
YAML_CHANGED: ${{ github.ref_name == 'main' || steps.changed-files-yaml.outputs.any_changed }}
run: |
echo "cargo-changed=$CARGO_CHANGED" >> $GITHUB_OUTPUT
Expand All @@ -107,6 +116,7 @@ jobs:
echo "metrics-changed=$METRICS_CHANGED" >> $GITHUB_OUTPUT
echo "python-changed=$PYTHON_CHANGED" >> $GITHUB_OUTPUT
echo "rust-changed=$RUST_CHANGED" >> $GITHUB_OUTPUT
echo "swift-changed=$SWIFT_CHANGED" >> $GITHUB_OUTPUT
echo "yaml-changed=$YAML_CHANGED" >> $GITHUB_OUTPUT

test-rust:
Expand Down Expand Up @@ -321,6 +331,94 @@ jobs:
make build-python-wheel GLEAN_BUILD_TARGET="$target" GLEAN_BUILD_EXTRA="--zig"
done

test-swift:
runs-on: macos-latest
needs: [decide-runs]
if: needs.decide-runs.outputs.rust-changed == 'true' || needs.decide-runs.outputs.swift-changed == 'true'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean an end to /run-ios?

Also, running all swift tests on all rust changes? Is that a change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Yes! We run iOS builds by default now
  2. Yes! We did that whole /run-ios part and not running by default because of cost. macOS time was costly on CircleCI and we were asked to reduce it. Until someone tells me that about GitHub Actions we will just default to running it.

steps:
- *checkout

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

- uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: '3.4'

- name: Install xcpretty
run: |
gem install --no-document xcpretty

- name: Show Ruby environment
run: |
ruby --version
gem env
xcpretty --version || true

- &swift-build-environment
name: Setup build environment
run: |
set -x
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios

# For some reason everything works fine if we use the host clang,
# not the Xcode-bundled clang.
echo '[target.aarch64-apple-darwin]' >> ~/.cargo/config.toml
echo 'linker = "/usr/bin/cc"' >> ~/.cargo/config.toml

# List available devices -- allows us to see what's there
DEVICES=$(xcrun xctrace list devices 2>&1)
echo "$DEVICES"
# Pick a device and start it
UUID=$(echo "$DEVICES" | grep --max-count=1 'iPhone 17 Simulator (26' | awk -F'[()]' '{print $4}')
xcrun simctl boot "$UUID"
Comment on lines +360 to +376

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rubber-stamp this, but if you want a real review you may need to tap someone who understands mac/ios/swift.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's copied from what we do on CircleCI.


- name: Run iOS build
run: |
make build-swift

- name: Run iOS test
run: |
make test-swift

test-swift-sample:
runs-on: macos-latest
needs: [decide-runs]
if: needs.decide-runs.outputs.rust-changed == 'true' || needs.decide-runs.outputs.swift-changed == 'true'
steps:
- *checkout

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

- uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: '3.4'

- name: Install xcpretty
run: |
gem install --no-document xcpretty

- name: Show Ruby environment
run: |
ruby --version
gem env
xcpretty --version || true

- *swift-build-environment

- name: Build XCFramework archive
run: |
make build-xcframework

- name: Test sample app
run: |
make test-ios-sample

test-kotlin:
runs-on: ubuntu-latest
needs: [decide-runs]
Expand Down
Loading