Skip to content

Commit

Permalink
android: publish nightly builds for aarch64
Browse files Browse the repository at this point in the history
Signed-off-by: Mukilan Thiyagarajan <[email protected]>
  • Loading branch information
mukilan committed Sep 13, 2024
1 parent db0aee6 commit 96d59e5
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 88 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ jobs:
name: cargo-timings-android-${{ matrix.arch }}
# Using a wildcard here ensures that the archive includes the path.
path: target/cargo-timings-*
- name: Upload nightly
if: ${{ inputs.upload && contains(matrix.arch, 'aarch64') }}
run: |
python3 ./mach upload-nightly linux \
--secret-from-environment \
--github-release-id ${{ inputs.github-release-id }}
env:
#S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }}
NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds
- name: Upload APK artifact for mach package
uses: actions/upload-artifact@v4
with:
Expand Down
68 changes: 34 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ on:
workflow_dispatch:

jobs:
build-win:
name: Windows
if: ${{ github.event_name != 'pull_request' }}
uses: ./.github/workflows/windows.yml
with:
unit-tests: true
secrets: inherit

build-mac:
name: Mac
if: ${{ github.event_name != 'pull_request' }}
uses: ./.github/workflows/mac.yml
with:
unit-tests: true
secrets: inherit

build-linux:
name: Linux
uses: ./.github/workflows/linux.yml
with:
unit-tests: true
wpt-layout: ${{ github.event_name == 'pull_request' && 'none' || '2020' }}
secrets: inherit

# build-win:
# name: Windows
# if: ${{ github.event_name != 'pull_request' }}
# uses: ./.github/workflows/windows.yml
# with:
# unit-tests: true
# secrets: inherit
#
# build-mac:
# name: Mac
# if: ${{ github.event_name != 'pull_request' }}
# uses: ./.github/workflows/mac.yml
# with:
# unit-tests: true
# secrets: inherit
#
# build-linux:
# name: Linux
# uses: ./.github/workflows/linux.yml
# with:
# unit-tests: true
# wpt-layout: ${{ github.event_name == 'pull_request' && 'none' || '2020' }}
# secrets: inherit
#
lint:
name: Lint
uses: ./.github/workflows/lint.yml
Expand All @@ -51,24 +51,24 @@ jobs:
profile: "release"
secrets: inherit

build-ohos:
name: OpenHarmony
if: ${{ github.event_name != 'pull_request' }}
uses: ./.github/workflows/ohos.yml
with:
profile: "release"
# build-ohos:
# name: OpenHarmony
# if: ${{ github.event_name != 'pull_request' }}
# uses: ./.github/workflows/ohos.yml
# with:
# profile: "release"

build-result:
name: Result
runs-on: ubuntu-latest
if: always()
# needs all build to detect cancellation
needs:
- "build-win"
- "build-mac"
- "build-linux"
# - "build-win"
# - "build-mac"
# - "build-linux"
- "build-android"
- "build-ohos"
# - "build-ohos"
- "lint"
steps:
- name: Merge build timings
Expand Down
51 changes: 1 addition & 50 deletions python/servo/package_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,56 +451,7 @@ def upload_to_github_release(platform, package, package_hash):
name=f'{asset_name}.sha256')

def upload_to_s3(platform, package, package_hash, timestamp):
(aws_access_key, aws_secret_access_key) = get_s3_secret()
s3 = boto3.client(
's3',
aws_access_key_id=aws_access_key,
aws_secret_access_key=aws_secret_access_key
)

cloudfront = boto3.client(
'cloudfront',
aws_access_key_id=aws_access_key,
aws_secret_access_key=aws_secret_access_key
)

BUCKET = 'servo-builds2'
DISTRIBUTION_ID = 'EJ8ZWSJKFCJS2'

nightly_dir = f'nightly/{platform}'
filename = nightly_filename(package, timestamp)
package_upload_key = '{}/{}'.format(nightly_dir, filename)
extension = path.basename(package).partition('.')[2]
latest_upload_key = '{}/servo-latest.{}'.format(nightly_dir, extension)

package_hash_fileobj = io.BytesIO(package_hash.encode('utf-8'))
latest_hash_upload_key = f'{latest_upload_key}.sha256'

s3.upload_file(package, BUCKET, package_upload_key)

copy_source = {
'Bucket': BUCKET,
'Key': package_upload_key,
}
s3.copy(copy_source, BUCKET, latest_upload_key)
s3.upload_fileobj(
package_hash_fileobj, BUCKET, latest_hash_upload_key, ExtraArgs={'ContentType': 'text/plain'}
)

# Invalidate previous "latest" nightly files from
# CloudFront edge caches
cloudfront.create_invalidation(
DistributionId=DISTRIBUTION_ID,
InvalidationBatch={
'CallerReference': f'{latest_upload_key}-{timestamp}',
'Paths': {
'Quantity': 1,
'Items': [
f'/{latest_upload_key}*'
]
}
}
)
pass

timestamp = datetime.utcnow().replace(microsecond=0)
for package in packages_for_platform(platform):
Expand Down
21 changes: 21 additions & 0 deletions support/android/apk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.text.SimpleDateFormat

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.1' apply false
Expand Down Expand Up @@ -79,3 +81,22 @@ ext.getSigningKeyInfo = { ->
return null
}
}

ext {
// Generate unique version code based on the build date and time to support nightly
// builds.
//
// The version scheme is currently: yyDDDHHmm
// where
// yy is the double digit year (e.g 24 for 2024)
// DDD is the 3 digit (zero padded) day of the year (e.g 257 for September 13)
// HHmm is the time of the day (e.g 1720 for 5.20 pm)
//
// TODO: check if this interferes with caching of local builds and add option to use
// a static version.
def today = new Date()
def year = new SimpleDateFormat("yy").format(today)
def day = String.format("%03d", (new SimpleDateFormat("D").format(today) as int))
def time = new SimpleDateFormat("HHmm").format(today)
generatedVersionCode = (year + day + time) as int
}
4 changes: 2 additions & 2 deletions support/android/apk/servoapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId "org.servo.servoshell"
minSdk 30
targetSdk 30
versionCode 1
versionName "1.0.0"
versionCode generatedVersionCode
versionName "0.0.1" // TODO: parse Servo's TOML and add git sha
}

compileOptions {
Expand Down
5 changes: 3 additions & 2 deletions support/android/apk/servoview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ android {
buildDir = rootDir.absolutePath + "/../../../target/android/gradle/servoview"

ndkPath = getNdkDir()

defaultConfig {
minSdk 30
targetSdk 30
versionCode 1
versionName "1.0"
versionCode generatedVersionCode
versionName "0.0.1" // TODO: parse Servo's TOML and add git sha
}

compileOptions {
Expand Down

0 comments on commit 96d59e5

Please sign in to comment.