Skip to content

Commit

Permalink
[RN][CI]Update the testing-script to use github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
cipolleschi committed Jun 13, 2024
1 parent b19bf2b commit 5ad1e44
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/release-testing/test-e2e-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const argv = yargs
default: true,
})
.option('c', {
alias: 'circleciToken',
alias: 'ciToken',
type: 'string',
})
.option('useLastSuccessfulPipeline', {
Expand Down Expand Up @@ -338,7 +338,7 @@ async function main() {

let circleCIArtifacts = await setupCircleCIArtifacts(
// $FlowIgnoreError[prop-missing]
argv.circleciToken,
argv.ciToken,
branchName,
// $FlowIgnoreError[prop-missing]
argv.useLastSuccessfulPipeline,
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-testing/utils/github-actions-utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env node
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/

'use strict';

const chalk = require('chalk');
const fetch = require('node-fetch');

async function initialize(
ciToken /*: string */,
baseTempPath /*: string */,
branchName /*: string */,
useLastSuccessfulPipeline /*: boolean */ = false,
) {
console.info('Getting GHA information');
// circleCIHeaders = {'Circle-Token': ciToken};
// baseTemporaryPath = baseTempPath;
// exec(`mkdir -p ${baseTemporaryPath}`);
// const pipeline = await (
// useLastSuccessfulPipeline ? _getLastSuccessfulPipeline : _getLatestPipeline
// )(branchName);
// const testsWorkflow = await _getTestsWorkflow(pipeline.id);
// const jobsResults = await _getCircleCIJobs(testsWorkflow.id);

// jobs = jobsResults.flatMap(j => j);
}

module.exports = {
initialize
}
27 changes: 27 additions & 0 deletions scripts/release-testing/utils/testing-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const {
generateiOSArtifacts,
} = require('../../releases/utils/release-utils');
const circleCIArtifactsUtils = require('./circle-ci-artifacts-utils.js');
const ghaArtifactsUtils = require('./github-actions-utils.js');
const fs = require('fs');
// $FlowIgnore[cannot-resolve-module]
const {spawn} = require('node:child_process');
Expand Down Expand Up @@ -177,6 +178,32 @@ async function setupCircleCIArtifacts(
return circleCIArtifactsUtils;
}

/**
* Setups the CircleCIArtifacts if a token has been passed
*
* Parameters:
* - @circleciToken a valid CircleCI Token.
* - @branchName the branch of the name we want to use to fetch the artifacts.
*/
async function setupGHAArtifacts(
ciToken /*: ?string */,
branchName /*: string */,
useLastSuccessfulPipeline /*: boolean */,
) /*: Promise<?typeof ghaArtifactsUtils> */ {
if (ciToken == null) {
return null;
}

const baseTmpPath = '/tmp/react-native-tmp';
await ghaArtifactsUtils.initialize(
ciToken,
baseTmpPath,
branchName,
useLastSuccessfulPipeline,
);
return ghaArtifactsUtils;
}

async function downloadArtifactsFromCircleCI(
circleCIArtifacts /*: typeof circleCIArtifactsUtils */,
mavenLocalPath /*: string */,
Expand Down

0 comments on commit 5ad1e44

Please sign in to comment.