|
| 1 | +# suppress external PR pipelines: they duplicate the branch pipeline per PR |
| 2 | +# push (job rules key on CI_COMMIT_BRANCH, which is unset there yet matches) |
| 3 | +workflow: |
| 4 | + rules: |
| 5 | + - if: $CI_PIPELINE_SOURCE == "external_pull_request_event" |
| 6 | + when: never |
| 7 | + - when: always |
| 8 | + |
1 | 9 | stages: |
2 | 10 | - protos |
3 | 11 | - build |
@@ -340,7 +348,7 @@ test:backend: |
340 | 348 | - cp /app/.coverage.$CI_NODE_INDEX $CI_PROJECT_DIR/ |
341 | 349 | - cp /app/.test_durations.$CI_NODE_INDEX $CI_PROJECT_DIR/ |
342 | 350 | - mkdir -p $CI_PROJECT_DIR/artifacts/test_artifacts |
343 | | - - cp /app/test_artifacts/* $CI_PROJECT_DIR/artifacts/test_artifacts/ 2>/dev/null || true |
| 351 | + - cp -r /app/test_artifacts/* $CI_PROJECT_DIR/artifacts/test_artifacts/ 2>/dev/null || true |
344 | 352 | artifacts: |
345 | 353 | reports: |
346 | 354 | junit: junit-$CI_NODE_INDEX.xml |
@@ -762,6 +770,7 @@ preview:backend: |
762 | 770 | - aws s3 rm s3://$AWS_PREVIEW_BUCKET/test-artifacts/$CI_COMMIT_REF_SLUG/ --recursive |
763 | 771 | - aws s3 cp artifacts/test_artifacts s3://$AWS_PREVIEW_BUCKET/test-artifacts/$CI_COMMIT_REF_SLUG/ --recursive 2>/dev/null || true |
764 | 772 | - echo "Done, test artifacts available at https://$CI_COMMIT_SHORT_SHA--test-artifacts.$PREVIEW_DOMAIN/ and https://$CI_COMMIT_REF_SLUG--test-artifacts.$PREVIEW_DOMAIN/" |
| 773 | + - echo "Sample emails index at https://$CI_COMMIT_SHORT_SHA--test-artifacts.$PREVIEW_DOMAIN/emails/index.html and https://$CI_COMMIT_REF_SLUG--test-artifacts.$PREVIEW_DOMAIN/emails/index.html" |
765 | 774 | artifacts: |
766 | 775 | paths: |
767 | 776 | - artifacts/schema_dumps |
@@ -888,12 +897,19 @@ build:mobile-ota-devtool: |
888 | 897 | - npm ci |
889 | 898 | - npx expo config --type public --json > ota-expo-config.json |
890 | 899 | - | |
| 900 | + # develop's preview keeps the build default (staging web) |
| 901 | + WEB_BASE_URL="" |
| 902 | + if [ "$CI_COMMIT_BRANCH" != "$RELEASE_BRANCH" ]; then |
| 903 | + WEB_BASE_URL=$(node scripts/vercel-preview-url.mjs --branch "$CI_COMMIT_BRANCH" --sha "$CI_COMMIT_SHA") |
| 904 | + fi |
| 905 | + echo "web base url: ${WEB_BASE_URL:-(build default)}" |
891 | 906 | for P in $OTA_PLATFORMS; do |
892 | 907 | rm -rf dist |
893 | 908 | npx expo export --platform "$P" |
894 | 909 | RV=$(npx expo-updates fingerprint:generate --platform "$P" 2>/dev/null | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>process.stdout.write(JSON.parse(s).hash))') |
895 | 910 | echo "fingerprint($P) = $RV" |
896 | | - node scripts/ota-stage.mjs --platform "$P" --runtime-version "$RV" --base-url "https://$CI_COMMIT_SHORT_SHA--ota.$PREVIEW_DOMAIN" --dist dist --out ota-out --expo-config ota-expo-config.json |
| 911 | + node scripts/ota-bundle.mjs --platform "$P" --runtime-version "$RV" --base-url "https://$CI_COMMIT_SHORT_SHA--ota.$PREVIEW_DOMAIN" --dist dist --out ota-out --expo-config ota-expo-config.json ${WEB_BASE_URL:+--web-base-url "$WEB_BASE_URL"} |
| 912 | + node scripts/ota-open-page.mjs --manifest-url "https://$CI_COMMIT_SHORT_SHA--ota.$PREVIEW_DOMAIN/$P/manifest" --out "ota-out/$P/open.html" |
897 | 913 | npx --yes qrcode -o "ota-out/$P/qr.png" "couchers-devtool://expo-development-client/?url=https%3A%2F%2F$CI_COMMIT_SHORT_SHA--ota.$PREVIEW_DOMAIN%2F$P%2Fmanifest" < /dev/null |
898 | 914 | done |
899 | 915 | artifacts: |
@@ -938,26 +954,40 @@ preview:mobile-ota-devtool: |
938 | 954 | - app/mobile/**/* |
939 | 955 | - app/scripts/**/* |
940 | 956 |
|
| 957 | +# posts the comment placeholder within seconds of the push |
| 958 | +preview:pr-comment-stub: |
| 959 | + needs: [] |
| 960 | + stage: preview |
| 961 | + image: python:3.14-slim |
| 962 | + inherit: |
| 963 | + default: false |
| 964 | + # serialize comment writes across concurrent pipelines |
| 965 | + resource_group: pr-preview-comment |
| 966 | + script: |
| 967 | + - pip install --quiet --no-cache-dir requests |
| 968 | + - python app/scripts/pr_preview_comment.py --stub |
| 969 | + rules: |
| 970 | + - if: $CI_COMMIT_BRANCH != $RELEASE_BRANCH |
| 971 | + |
941 | 972 | preview:pr-comment: |
942 | 973 | needs: |
| 974 | + - job: preview:pr-comment-stub |
| 975 | + artifacts: false |
943 | 976 | - job: preview:mobile-ota-devtool |
944 | 977 | artifacts: false |
| 978 | + optional: true |
945 | 979 | stage: preview |
946 | 980 | image: python:3.14-slim |
947 | 981 | inherit: |
948 | 982 | default: false |
| 983 | + resource_group: pr-preview-comment |
949 | 984 | variables: |
950 | 985 | OTA_PLATFORMS: "ios android" |
951 | 986 | script: |
952 | 987 | - pip install --quiet --no-cache-dir requests |
953 | 988 | - python app/scripts/pr_preview_comment.py |
954 | 989 | rules: |
955 | | - - if: ($BUILD_MOBILE == "true") && ($CI_COMMIT_BRANCH == $RELEASE_BRANCH) |
956 | | - - if: ($BUILD_MOBILE == "true") && ($CI_COMMIT_BRANCH != $RELEASE_BRANCH) |
957 | | - changes: |
958 | | - - app/proto/**/* |
959 | | - - app/mobile/**/* |
960 | | - - app/scripts/**/* |
| 990 | + - if: $CI_COMMIT_BRANCH != $RELEASE_BRANCH |
961 | 991 |
|
962 | 992 | build:mobile-native-devtool: |
963 | 993 | needs: ["protos"] |
@@ -1009,7 +1039,7 @@ build:mobile-ota-staging: |
1009 | 1039 | npx sentry-expo-upload-sourcemaps dist |
1010 | 1040 | RV=$(npx expo-updates fingerprint:generate --platform "$P" 2>/dev/null | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>process.stdout.write(JSON.parse(s).hash))') |
1011 | 1041 | echo "fingerprint($P) = $RV" |
1012 | | - node scripts/ota-stage.mjs --platform "$P" --runtime-version "$RV" --base-url "$OTA_CDN_BASE" --dist dist --out ota-staging-out --expo-config ota-expo-config.json |
| 1042 | + node scripts/ota-bundle.mjs --platform "$P" --runtime-version "$RV" --base-url "$OTA_CDN_BASE" --dist dist --out ota-staging-out --expo-config ota-expo-config.json |
1013 | 1043 | node scripts/ota-sign.mjs --dir "ota-staging-out/$P" --key-file ota-staging-private-key.pem --key-id staging |
1014 | 1044 | done |
1015 | 1045 | - rm -f ota-staging-private-key.pem |
@@ -1216,7 +1246,7 @@ build:mobile-ota-prod: |
1216 | 1246 | npx sentry-expo-upload-sourcemaps dist |
1217 | 1247 | RV=$(npx expo-updates fingerprint:generate --platform "$P" 2>/dev/null | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>process.stdout.write(JSON.parse(s).hash))') |
1218 | 1248 | echo "fingerprint($P) = $RV" |
1219 | | - node scripts/ota-stage.mjs --platform "$P" --runtime-version "$RV" --base-url '__OTA_BUNDLE_BASE__' --dist dist --out ota-prod-out --expo-config ota-expo-config.json |
| 1249 | + node scripts/ota-bundle.mjs --platform "$P" --runtime-version "$RV" --base-url '__OTA_BUNDLE_BASE__' --dist dist --out ota-prod-out --expo-config ota-expo-config.json |
1220 | 1250 | tar -C ota-prod-out/"$P" -czf "native-ota-dist/native-ota-$P-$CI_PIPELINE_ID-$CI_COMMIT_SHA.tar.gz" . |
1221 | 1251 | done |
1222 | 1252 | artifacts: |
|
0 commit comments