Skip to content
Closed
Show file tree
Hide file tree
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
104 changes: 104 additions & 0 deletions .github/workflows/native-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Native Simulator Tests

on:
push:
branches:
- ci/native-e2e
workflow_dispatch:
schedule:
- cron: '0 18 * * 0' # Weekly, Monday 03:00 JST
Comment on lines +7 to +9

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.

🔍 定期実行対象は既定ブランチに固定される

schedule は既定ブランチ上のワークフローだけを起動し、そのブランチをチェックアウトします。想定する iOS 27 ブランチを週次検証できる構成か確認してください。

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


permissions:
contents: read

concurrency:
group: native-e2e-${{ github.ref }}
cancel-in-progress: false

jobs:
suite:
timeout-minutes: 75
# xcode-27 preview label; Xcode 27 beta is the default toolchain on that
# image, so no DEVELOPER_DIR override is needed.
runs-on: xcode-27
strategy:
fail-fast: false
matrix:
include:
- suite: ui-shell
script: scripts/verify-native-ui-shell.sh
kana: ''
- suite: search
script: scripts/verify-native-search.sh
scenario: search
kana: kana
- suite: edge
script: scripts/verify-native-search.sh
scenario: edge
kana: ''
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24

- id: meta
run: |
xcodebuild -version
echo "xcode_version=$(xcodebuild -version | head -n 1 | tr ' ' '-')" >> "$GITHUB_OUTPUT"
echo "image_version=${ImageVersion:-unknown}" >> "$GITHUB_OUTPUT"
Comment on lines +45 to +49

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.

🔍 ランナーイメージ更新がキャッシュキーに反映されない

取得した image_version は増分ビルドキャッシュキーに使われません。同じ Xcode 表示バージョンでイメージが更新されると、古い DerivedData が復元されます。

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


- uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Restore incremental build products
uses: actions/cache@v5
with:
path: ${{ runner.temp }}/native-${{ matrix.suite }}
key: native-${{ matrix.suite }}-${{ steps.meta.outputs.xcode_version }}-${{ hashFiles('**/package-lock.json', 'ios/**', 'demo/ios/**', 'demo/native-*-fixture/**', 'src/**') }}
restore-keys: |
native-${{ matrix.suite }}-${{ steps.meta.outputs.xcode_version }}-
Comment on lines +61 to +64

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.

🟡 キャッシュ復元後のネイティブテストが再実行できない

次回実行では、consumer/ios と tests.xcresult を含む作業ディレクトリ全体が復元されます。初期化せず同じ出力を再生成するため、既存出力と衝突してテスト前またはテスト実行時に失敗します。

Learn more

このキャッシュは Xcode の増分ビルド成果物だけでなく、各検証スクリプトの作業ディレクトリ全体を保存します。次回、同じキーまたは restore key が一致すると、consumer/ios や tests.xcresult も復元されます。検索スイート と UI Shell スイート はそれらを削除せず、同じ場所へ cap add ios と xcodebuild -resultBundlePath を実行します。どちらも新規出力先を前提とするため、復元された成果物と衝突します。

Example: コード変更のない翌週の定期実行では同じ完全キーがヒットします。前週の consumer/ios が復元されるため npx cap add ios は「プラットフォームが既に存在する」として終了し、シミュレーターテストは開始されません。

Recommended fix: キャッシュ対象を demo-build、spm-build、build、test-build などの DerivedData ディレクトリだけに限定してください。または、各スクリプトの開始時に consumer、tests、tests.xcresult、screenshots を削除し、再生成物と増分ビルド成果物を分離してください。

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


- name: Install XcodeGen
run: brew list xcodegen >/dev/null 2>&1 || brew install xcodegen

- run: npm ci
- run: npm ci
working-directory: './demo'

- name: Fetch shared simulator setup script
run: |
sha=$(jq -r '.packages["node_modules/@rdlabo/ionic-theme-utils"].resolved' package-lock.json | sed 's/.*#//')
curl -fsSL "https://raw.githubusercontent.com/rdlabo-dev/ionic-theme-utils/$sha/scripts/ci-simulator.sh" -o "$RUNNER_TEMP/ci-simulator.sh"

- name: Create and boot simulator
run: sh "$RUNNER_TEMP/ci-simulator.sh" "iPhone 17" "iOS 27.0" ${{ matrix.kana }}

- name: Run ${{ matrix.suite }} suite
run: sh ${{ matrix.script }} "$SIM_UDID" ${{ matrix.scenario }}
env:
VERIFY_ARTIFACTS_DIR: ${{ runner.temp }}/native-${{ matrix.suite }}

- name: Upload screenshots and logs
uses: actions/upload-artifact@v5
if: always()
with:
name: native-${{ matrix.suite }}-screenshots
path: |
${{ runner.temp }}/native-${{ matrix.suite }}/screenshots
${{ runner.temp }}/native-${{ matrix.suite }}/*.log
if-no-files-found: warn
retention-days: 7

- name: Upload result bundle on failure
uses: actions/upload-artifact@v5
if: failure()
with:
name: native-${{ matrix.suite }}-xcresult
path: ${{ runner.temp }}/native-${{ matrix.suite }}/tests.xcresult
if-no-files-found: warn
retention-days: 7
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"homepage": "https://docs.rdlabo.dev/projects/ionic-theme-ios27",
"dependencies": {
"@rdlabo/ionic-theme-utils": "git+ssh://git@github.com/rdlabo-dev/ionic-theme-utils.git#66eb2fccca10646ebfccdfb3b6c2f3b4c9b00bf6"
"@rdlabo/ionic-theme-utils": "git+ssh://git@github.com/rdlabo-dev/ionic-theme-utils.git#ec42938042c0fb65ef6f3c312c4240d820a2cf6f"
},
"devDependencies": {
"@capacitor/core": "^8.5.2",
Expand Down
16 changes: 14 additions & 2 deletions scripts/verify-native-search.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ case "$scenario" in
esac
repo=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
fixture="$repo/demo/native-$scenario-fixture"
artifacts=$(mktemp -d "/tmp/ionic-native-$scenario-verification.XXXXXX")
if [ "${VERIFY_ARTIFACTS_DIR:-}" ]; then
artifacts=$VERIFY_ARTIFACTS_DIR
mkdir -p "$artifacts"
else
artifacts=$(mktemp -d "/tmp/ionic-native-$scenario-verification.XXXXXX")
fi
printf 'Native %s verification artifacts: %s\n' "$scenario" "$artifacts"
cd "$repo"
npm run build
Expand All @@ -28,7 +33,14 @@ const file = process.argv[2];
writeFileSync(file, readFileSync(file, 'utf8').replace('</body>', `<script src="${process.argv[3]}"></script></body>`));
JS
cd "$artifacts/consumer"
npm install --ignore-scripts "$artifacts/$archive" @capacitor/core@8.5.2 @capacitor/ios@8.5.2 @capacitor/cli@8.5.2 @capacitor/keyboard@8.0.5 @ionic/core@8.8.19
# --ignore-scripts would skip the git dependency's prepare script, leaving
# @rdlabo/ionic-theme-utils without its dist build.
npm install "$artifacts/$archive" @capacitor/core@8.5.2 @capacitor/ios@8.5.2 @capacitor/cli@8.5.2 @capacitor/keyboard@8.0.5 @ionic/core@8.8.19
# Some npm versions skip `prepare` for transitive git dependencies; build the
# utils dist explicitly when it was not produced.
if [ ! -f node_modules/@rdlabo/ionic-theme-utils/dist/index.js ]; then
(cd node_modules/@rdlabo/ionic-theme-utils && npm install --no-save --no-audit --no-fund typescript && npm run build)
fi
npx cap add ios --packagemanager SPM
xcodebuild -project ios/App/App.xcodeproj -scheme App -configuration Debug \
-sdk iphonesimulator -destination "platform=iOS Simulator,id=$simulator" \
Expand Down
16 changes: 14 additions & 2 deletions scripts/verify-native-ui-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ set -eu

simulator=${1:?Usage: sh scripts/verify-native-ui-shell.sh SIMULATOR_UDID}
repo=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
artifacts=$(mktemp -d /tmp/ionic-native-ui-shell-verification.XXXXXX)
if [ "${VERIFY_ARTIFACTS_DIR:-}" ]; then
artifacts=$VERIFY_ARTIFACTS_DIR
mkdir -p "$artifacts"
else
artifacts=$(mktemp -d /tmp/ionic-native-ui-shell-verification.XXXXXX)
fi
printf 'Native UI Shell verification artifacts: %s\n' "$artifacts"

cd "$repo"
Expand All @@ -26,7 +31,14 @@ mkdir -p "$artifacts/consumer/www"
cp "$repo/demo/native-package-fixture/app.js" "$repo/demo/native-package-fixture/capacitor.config.json" "$artifacts/consumer/"
cp "$repo/demo/native-package-fixture/index.html" "$artifacts/consumer/www/"
cd "$artifacts/consumer"
npm install --ignore-scripts "$artifacts/$archive" @capacitor/core@8.5.2 @capacitor/ios@8.5.2 @capacitor/cli@8.5.2 @ionic/core@8.8.19
# --ignore-scripts would skip the git dependency's prepare script, leaving
# @rdlabo/ionic-theme-utils without its dist build.
npm install "$artifacts/$archive" @capacitor/core@8.5.2 @capacitor/ios@8.5.2 @capacitor/cli@8.5.2 @ionic/core@8.8.19
# Some npm versions skip `prepare` for transitive git dependencies; build the
# utils dist explicitly when it was not produced.
if [ ! -f node_modules/@rdlabo/ionic-theme-utils/dist/index.js ]; then
(cd node_modules/@rdlabo/ionic-theme-utils && npm install --no-save --no-audit --no-fund typescript && npm run build)
fi
"$repo/demo/node_modules/.bin/esbuild" app.js --bundle --format=esm --outdir=www
npx cap add ios --packagemanager SPM
xcodebuild -project ios/App/App.xcodeproj -scheme App -configuration Debug \
Expand Down
Loading