Set up full input testing (#150)

* Extract main loop to something testable

* Revert "Extract main loop to something testable"

This reverts commit 35a78459698fe267933c554283212c2d06ed4bf0.

* Extract code that interacts with Google Play
We can now test our input flow as a whole

* Create some basic tests for `completed` status publishing

* Fix applying inputs
We don't want to be keeping values between runs

* Drop some redundant tests

* Create basic tests for draft rollout

* Run build

* Fix userFraction bug

* Improve readability of initialising inputs

* Fix runUpload mocking

* Migrate to github-action-ts-run-api
This commit is contained in:
Jack Boswell
2022-10-23 18:18:11 -07:00
committed by GitHub
parent 4d510d380a
commit b84eace68d
7 changed files with 901 additions and 36 deletions

View File

@@ -34,7 +34,47 @@ export interface EditOptions {
existingEditId?: string;
}
export async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]): Promise<string | void> {
export async function runUpload(
packageName: string,
track: string,
inAppUpdatePriority: number | undefined,
userFraction: number | undefined,
whatsNewDir: string | undefined,
mappingFile: string | undefined,
debugSymbols: string | undefined,
name: string | undefined,
changesNotSentForReview: boolean,
existingEditId: string | undefined,
status: string,
validatedReleaseFiles: string[]
) {
const auth = new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/androidpublisher']
});
const authClient = await auth.getClient();
const result = await uploadToPlayStore({
auth: authClient,
applicationId: packageName,
track: track,
inAppUpdatePriority: inAppUpdatePriority || 0,
userFraction: userFraction,
whatsNewDir: whatsNewDir,
mappingFile: mappingFile,
debugSymbols: debugSymbols,
name: name,
changesNotSentForReview: changesNotSentForReview,
existingEditId: existingEditId,
status: status
}, validatedReleaseFiles);
if (result) {
console.log(`Finished uploading to the Play Store: ${result}`)
}
}
async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]): Promise<string | void> {
// Check the 'track' for 'internalsharing', if so switch to a non-track api
if (options.track === 'internalsharing') {
core.debug("Track is Internal app sharing, switch to special upload api")