Skip to content

Commit

Permalink
Merge branch 'strato-emu:master' into delete_pipeline_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
QuackingCanary committed Mar 4, 2024
2 parents 30dcf02 + a503ca1 commit 8881110
Show file tree
Hide file tree
Showing 22 changed files with 1,007 additions and 817 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# A workflow to verify the build on every push to the master branch
name: Build

on:
push:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Restore CCache
uses: hendrikmuhs/[email protected]
with:
max-size: 3Gi

- name: Restore Gradle Cache
uses: actions/cache@v4
with:
path: ~/.gradle/
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('app/**/*.xml') }}-${{ hashFiles('app/**.kt', 'app/**.java') }}
restore-keys: |
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('app/**/*.xml') }}-
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-
${{ runner.os }}-gradle-
- name: Install Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin' # Temurin should come pre-installed on GitHub-hosted runners
java-version: '17'

- name: Install Ninja Build
run: |
sudo apt-get install -y ninja-build
ln -s /usr/bin/ninja .
- name: Android Assemble
env:
CMAKE_C_COMPILER_LAUNCHER: "ccache"
CMAKE_CXX_COMPILER_LAUNCHER: "ccache"
CCACHE_COMPILERCHECK: "string:${{ env.NDK_VERSION }}" # Use NDK version instead of compiler timestamp
run: ./gradlew --no-daemon --stacktrace --build-cache --parallel --configure-on-demand assembleMainlineRelease
113 changes: 0 additions & 113 deletions .github/workflows/ci.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# A workflow to build and upload APKs for pull requests
name: PR Build

on:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ master ]

# Only allow the latest build to run for a given PR, and cancel any previous builds
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Restore CCache
uses: hendrikmuhs/[email protected]
with:
max-size: 3Gi

- name: Restore Gradle Cache
uses: actions/cache@v4
with:
path: ~/.gradle/
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('app/**/*.xml') }}-${{ hashFiles('app/**.kt', 'app/**.java') }}
restore-keys: |
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('app/**/*.xml') }}-
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-
${{ runner.os }}-gradle-
- name: Install Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin' # Temurin should come pre-installed on GitHub-hosted runners
java-version: '17'

- name: Install Ninja Build
run: |
sudo apt-get install -y ninja-build
ln -s /usr/bin/ninja .
- name: Android Assemble
env:
CMAKE_C_COMPILER_LAUNCHER: "ccache"
CMAKE_CXX_COMPILER_LAUNCHER: "ccache"
CCACHE_COMPILERCHECK: "string:${{ env.NDK_VERSION }}" # Use NDK version instead of compiler timestamp
PR_NUMBER: ${{ github.event.number }}
run: ./gradlew --no-daemon --stacktrace --build-cache --parallel --configure-on-demand assembleDevRelease assembleDevReldebug

- name: Rename APKs
if: ${{ vars.UPLOAD_PR_ARTIFACTS == 'true' }}
run: |
mv app/build/outputs/apk/dev/release/app-dev-release.apk strato-pr${{ github.event.number }}-release.apk
mv app/build/outputs/apk/dev/reldebug/app-dev-reldebug.apk strato-pr${{ github.event.number }}-reldebug.apk
- name: Upload Release APK
if: ${{ vars.UPLOAD_PR_ARTIFACTS == 'true' }}
uses: actions/upload-artifact@v4
with:
name: strato-pr${{ github.event.number }}-release.apk
path: strato-pr${{ github.event.number }}-release.apk

- name: Upload Debug APK
if: ${{ vars.UPLOAD_PR_ARTIFACTS == 'true' }}
uses: actions/upload-artifact@v4
with:
name: strato-pr${{ github.event.number }}-reldebug.apk
path: strato-pr${{ github.event.number }}-reldebug.apk
29 changes: 12 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ idea.module {
excludeDirs.add(file("libraries/boost"))
}

project.ext.isBuildSigned = (System.getenv("CI") == "true") && (System.getenv("IS_BUILD_SIGNED") == "true")

android {
namespace 'org.stratoemu.strato'
compileSdk 34
Expand Down Expand Up @@ -58,15 +56,6 @@ android {
jniLibs.useLegacyPackaging = true
}

signingConfigs {
ci {
storeFile file(System.getenv("SIGNING_STORE_PATH") ?: "${System.getenv("user.home")}/keystore.jks")
storePassword System.getenv("SIGNING_STORE_PASSWORD")
keyAlias System.getenv("SIGNING_KEY_ALIAS")
keyPassword System.getenv("SIGNING_KEY_PASSWORD")
}
}

buildTypes {
release {
debuggable true
Expand All @@ -78,7 +67,7 @@ android {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig = isBuildSigned ? signingConfigs.ci : signingConfigs.debug
signingConfig signingConfigs.debug
manifestPlaceholders["emulationProcess"] = ":emulationProcess"
}

Expand All @@ -91,14 +80,14 @@ android {
}
minifyEnabled false
shrinkResources false
signingConfig = isBuildSigned ? signingConfigs.ci : signingConfigs.debug
signingConfig signingConfigs.debug
}

debug {
debuggable true
minifyEnabled false
shrinkResources false
signingConfig = isBuildSigned ? signingConfigs.ci : signingConfigs.debug
signingConfig signingConfigs.debug
}
}

Expand Down Expand Up @@ -188,8 +177,10 @@ kapt {
* Returns the version name based on the current git state
* If HEAD is a tag, the tag name is used as the version name
* e.g. `1.0.0`
* If HEAD is not a tag, the tag name, the branch name and the short commit hash are used
* If HEAD is not a tag, the closest tag name, the branch name and the short commit hash are used
* e.g. `1.0.0-master-ab00cd11`
* If PR_NUMBER is set, prPR_NUMBER is used instead of the branch name
* e.g. `1.0.0-pr123-ab00cd11`
*/
def getGitVersionName() {
def versionName = '0.0.0'
Expand Down Expand Up @@ -248,13 +239,17 @@ def getGitShortHash() {
}

/**
* Returns the current branch name
* Returns the current branch name, or prPR_NUMBER if PR_NUMBER is set
*/
def getGitBranch() {
def branch = 'unk'

try {
branch = 'git rev-parse --abbrev-ref HEAD'.execute([], project.rootDir).text.trim()
def prNumber = System.getenv('PR_NUMBER') ?: ''
if (!prNumber.isEmpty())
branch = 'pr' + prNumber
else
branch = 'git rev-parse --abbrev-ref HEAD'.execute([], project.rootDir).text.trim()
} catch (Exception e) {
logger.error(e.toString() + ': defaulting to dummy branch ' + branch)
}
Expand Down
22 changes: 22 additions & 0 deletions app/src/main/cpp/skyline/common/wregister.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright © 2023 Strato Team and Contributors (https://github.com/strato-emu/)

#pragma once

#include <common/base.h>

namespace skyline {
struct WRegister {
u32 lower;
u32 upper;

constexpr operator u32() const {
return lower;
}

void operator=(u32 value) {
lower = value;
upper = 0;
}
};
}
Loading

0 comments on commit 8881110

Please sign in to comment.