Skip to content

Fingerprint

Fingerprint #181

Workflow file for this run

name: Fingerprint
on:
workflow_dispatch: {}
push:
branches: [main, 'sdk-*']
paths:
- .github/workflows/fingerprint.yml
- packages/@expo/fingerprint/**
- packages/create-expo/**
- yarn.lock
pull_request:
paths:
- .github/workflows/fingerprint.yml
- packages/@expo/fingerprint/**
- packages/create-expo/**
- yarn.lock
schedule:
- cron: 0 14 * * *
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: 👀 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 100
- name: ⬢ Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: 🚀 Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: ⬇️ Fetch commits from base branch
run: git fetch origin ${{ github.event.before || github.base_ref || 'main' }}:${{ github.event.before || github.base_ref || 'main' }} --depth 100
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
- name: ♻️ Restore caches
uses: ./.github/actions/expo-caches
id: expo-caches
with:
yarn-workspace: 'true'
- name: 🧶 Install node modules in root dir
if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
# NOTE(cedric): yarn v1 on Windows has networking issues, we need to set `--network-timeout` to a higher value
run: yarn install --frozen-lockfile --network-timeout 1000000
- name: E2E Test @expo/fingerprint
run: |
bun run tsc
bun run tsc --build cli
bun run jest --config e2e/jest.config.js --ci --runInBand
working-directory: packages/@expo/fingerprint
- name: ⚙️ Create temp project
run: |
cd ..
bunx create-expo-app -t blank@sdk-52 my-app
- name: 💾 Create fingerprint from the temp project
if: ${{ startsWith(matrix.os, 'windows') == false }}
env:
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: |
cd ../my-app
# Add dependencies with native binaries
bun add -D sharp
cat > fingerprint.config.js <<EOF
/** @type {import('expo/fingerprint').Config} */
const config = {
extraSources: [
{
type: 'dir',
filePath: 'node_modules/@img',
},
{
type: 'dir',
filePath: 'node_modules/sharp',
},
],
};
module.exports = config;
EOF
if [[ "${{ env.ACTIONS_STEP_DEBUG }}" == "true" ]]; then
../expo/packages/@expo/fingerprint/bin/cli.js fingerprint:generate --debug > ../expo/fingerprint-${{ matrix.os }}.json
else
../expo/packages/@expo/fingerprint/bin/cli.js fingerprint:generate > ../expo/fingerprint-${{ matrix.os }}.json
fi
- name: 💾 Create fingerprint from the temp project (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
env:
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
shell: pwsh
run: |
cd ../my-app
# Add dependencies with native binaries
bun add -D sharp
@"
/** @type {import('expo/fingerprint').Config} */
const config = {
extraSources: [
{
type: 'dir',
filePath: 'node_modules/@img',
},
{
type: 'dir',
filePath: 'node_modules/sharp',
},
],
};
module.exports = config;
"@ | Set-Content fingerprint.config.js
if ($env:ACTIONS_STEP_DEBUG -eq "true") {
node ../expo/packages/@expo/fingerprint/bin/cli.js fingerprint:generate --debug > ../expo/fingerprint-${{ matrix.os }}.json
} else {
node ../expo/packages/@expo/fingerprint/bin/cli.js fingerprint:generate > ../expo/fingerprint-${{ matrix.os }}.json
}
- name: 📤 Upload fingerprint
uses: actions/upload-artifact@v4
with:
name: fingerprint-${{ matrix.os }}
path: fingerprint-${{ matrix.os }}.json
cross-platform-checks:
needs: test
runs-on: ubuntu-latest
steps:
- name: 📥 Download fingerprint (macos)
uses: actions/download-artifact@v4
with:
name: fingerprint-macos-latest
- name: 📥 Download fingerprint (ubuntu)
uses: actions/download-artifact@v4
with:
name: fingerprint-ubuntu-latest
- name: 📥 Download fingerprint (windows)
uses: actions/download-artifact@v4
with:
name: fingerprint-windows-latest
- name: 👀 Check fingerprint consistency
shell: bash
run: |
hash_macos=$(jq -r '.hash' fingerprint-macos-latest.json)
hash_ubuntu=$(jq -r '.hash' fingerprint-ubuntu-latest.json)
hash_windows=$(jq -r '.hash' fingerprint-windows-latest.json)
echo "Hash from fingerprint-macos-latest.json: $hash_macos"
echo "Hash from fingerprint-ubuntu-latest.json: $hash_ubuntu"
echo "Hash from fingerprint-windows-latest.json: $hash_windows"
if [[ "$hash_macos" != "$hash_ubuntu" || "$hash_ubuntu" != "$hash_windows" ]]; then
echo "Hashes do not match!"
exit 1
else
echo "All hashes match!"
fi