Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native tests with pre-release native notifiers #1367

Merged
merged 9 commits into from
Apr 28, 2021
Merged
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
13 changes: 13 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ steps:
# Publish/package notifier
#
- label: ':docker: Prepare package.json'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
key: 'package-js'
timeout_in_minutes: 3
plugins:
Expand All @@ -41,11 +42,15 @@ steps:
- docker-compose#v3.3.0:
build: publisher
image-repository: 855461928731.dkr.ecr.us-west-1.amazonaws.com/js
env:
BUILD_RN_WITH_LATEST_NATIVES: ${BUILD_RN_WITH_LATEST_NATIVES}


#
# Trigger individual pipelines
#
- label: 'Trigger Browser pipeline'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
depends_on: 'package-js'
trigger: 'bugsnag-js-browser'
build:
Expand All @@ -55,6 +60,7 @@ steps:
async: true

- label: 'Trigger Node pipeline'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
depends_on: 'package-js'
trigger: 'bugsnag-js-node'
build:
Expand All @@ -64,6 +70,7 @@ steps:
async: true

- label: 'Trigger Expo pipeline'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
depends_on: 'publish-js'
trigger: 'bugsnag-js-expo'
build:
Expand All @@ -84,6 +91,7 @@ steps:
async: true

- label: 'Trigger React Native CLI pipeline'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
depends_on:
- 'publish-js'
- 'android-builder-base'
Expand All @@ -95,6 +103,7 @@ steps:
async: true

- label: ':aws-lambda: AWS Lambda tests'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
timeout_in_minutes: 35
agents:
queue: 'opensource-mac-aws-sam'
Expand All @@ -110,6 +119,7 @@ steps:
# Core tests and checks
#
- label: ':docker: Build CI image'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
key: 'ci-image'
depends_on: 'package-js'
timeout_in_minutes: 20
Expand All @@ -129,6 +139,7 @@ steps:
- ci:855461928731.dkr.ecr.us-west-1.amazonaws.com/js:ci-base

- label: 'Lint'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
depends_on: 'ci-image'
timeout_in_minutes: 10
plugins:
Expand All @@ -137,6 +148,7 @@ steps:
command: 'npm run test:lint'

- label: 'Unit tests'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
depends_on: 'ci-image'
timeout_in_minutes: 10
plugins:
Expand All @@ -145,6 +157,7 @@ steps:
command: 'npm run test:unit'

- label: 'Type checks/tests'
if: build.env("BUILD_RN_WITH_LATEST_NATIVES") != "true"
depends_on: 'ci-image'
timeout_in_minutes: 10
plugins:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
- REG_NPM_EMAIL
- PUBLISH_URL
- BRANCH_NAME

- BUILD_RN_WITH_LATEST_NATIVES
ci:
build:
context: .
Expand Down
15 changes: 11 additions & 4 deletions dockerfiles/Dockerfile.publisher
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# CI test image for unit/lint/type tests
FROM node:lts-alpine
# CI test image for unit/lint/type tests, but also needs to be capable of building
# the Android notifier as part of a React Native integration test run.
FROM 855461928731.dkr.ecr.us-west-1.amazonaws.com/android:latest as android

RUN apk add --update bash git curl
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y rsync npm nodejs

# Android setup
ENV ANDROID_HOME="/sdk/"
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false"

# NPM setup
RUN rm -f ~/.npmrc

ARG REG_BASIC_CREDENTIAL
Expand All @@ -21,4 +27,5 @@ COPY scripts/ scripts/
ARG PUBLISH_URL
ARG BUILDKITE
ARG BRANCH_NAME
RUN BUILDKITE=${BUILDKITE} BRANCH_NAME=${BRANCH_NAME} node scripts/publish.js $PUBLISH_URL
ARG BUILD_RN_WITH_LATEST_NATIVES
RUN BUILDKITE=${BUILDKITE} BRANCH_NAME=${BRANCH_NAME} BUILD_RN_WITH_LATEST_NATIVES=${BUILD_RN_WITH_LATEST_NATIVES} node scripts/publish.js $PUBLISH_URL
15 changes: 11 additions & 4 deletions scripts/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ module.exports = {
branchName = this.run('git rev-parse --abbrev-ref HEAD').replace(regex, '-')
}

// Distinguish from local use
const ciIndicator = (process.env.BUILDKITE ? 'ci-' : '')

// Get the current version from lerna.json
const lernaVersion = lerna.version.match(/^[1-9][0-9]*\.[0-9]+\.[0-9]+/)[0]

return `${lernaVersion}-${ciIndicator}${branchName}.${commitId}`
// Base version for RN integration builds on the current time
if (process.env.BUILD_RN_WITH_LATEST_NATIVES) {
const timestamp = Math.round(Date.now() / 1000)

return `${lernaVersion}-rn-integration.${timestamp}`
} else {
// Distinguish from local use
const ciIndicator = (process.env.BUILDKITE ? 'ci-' : '')

return `${lernaVersion}-${ciIndicator}${branchName}.${commitId}`
twometresteve marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
9 changes: 9 additions & 0 deletions scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ function publish (publishUrl) {
}

if (myVersions.length === 0) {
if (process.env.BUILD_RN_WITH_LATEST_NATIVES) {
// For RN integration builds, dynamically update the native notifiers
common.changeDir('packages/react-native')
common.run('./update-android.sh --sha next', true)
common.run('./update-ios.sh --sha next', true)
common.changeDir('../..')
}

// Build and publish packages
console.log(`Publishing as '${version}'`)

common.run('npm install', true)
Expand Down