From 96d59e55fe050dd11602c8aa13f5e3f14d6e822e Mon Sep 17 00:00:00 2001 From: Mukilan Thiyagarajan Date: Fri, 13 Sep 2024 12:21:15 +0530 Subject: [PATCH] android: publish nightly builds for aarch64 Signed-off-by: Mukilan Thiyagarajan --- .github/workflows/android.yml | 10 ++++ .github/workflows/main.yml | 68 +++++++++++----------- python/servo/package_commands.py | 51 +--------------- support/android/apk/build.gradle | 21 +++++++ support/android/apk/servoapp/build.gradle | 4 +- support/android/apk/servoview/build.gradle | 5 +- 6 files changed, 71 insertions(+), 88 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 6f991c10587ff..b1fd1ba2b989e 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -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: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 446d4f36ef3e1..6c0472f85f8fb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -51,12 +51,12 @@ 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 @@ -64,11 +64,11 @@ jobs: 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 diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py index 90cba92cfa1ff..10f570bcf99c9 100644 --- a/python/servo/package_commands.py +++ b/python/servo/package_commands.py @@ -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): diff --git a/support/android/apk/build.gradle b/support/android/apk/build.gradle index 9ba3cee254e7c..5cc0a3e03da3d 100644 --- a/support/android/apk/build.gradle +++ b/support/android/apk/build.gradle @@ -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 @@ -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 +} diff --git a/support/android/apk/servoapp/build.gradle b/support/android/apk/servoapp/build.gradle index 44c71aa5c81bf..f4a94459a09e7 100644 --- a/support/android/apk/servoapp/build.gradle +++ b/support/android/apk/servoapp/build.gradle @@ -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 { diff --git a/support/android/apk/servoview/build.gradle b/support/android/apk/servoview/build.gradle index e3d5a3e19cf11..ae0b1a3231873 100644 --- a/support/android/apk/servoview/build.gradle +++ b/support/android/apk/servoview/build.gradle @@ -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 {