初始化提交
This commit is contained in:
3
ci-jobs/scripts/azure-print-tag-name.js
Normal file
3
ci-jobs/scripts/azure-print-tag-name.js
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
const branch = process.env.BUILD_SOURCEBRANCH || '';
|
||||
console.log(branch.replace(/^refs\/tags\//, '')); // eslint-disable-line no-console
|
||||
57
ci-jobs/scripts/build-webdriveragents.js
Normal file
57
ci-jobs/scripts/build-webdriveragents.js
Normal file
@@ -0,0 +1,57 @@
|
||||
const buildWebDriverAgent = require('./build-webdriveragent');
|
||||
const { asyncify } = require('asyncbox');
|
||||
const { fs, logger } = require('@appium/support');
|
||||
const { exec } = require('teen_process');
|
||||
const path = require('path');
|
||||
|
||||
const log = new logger.getLogger('WDABuild');
|
||||
|
||||
async function buildAndUploadWebDriverAgents () {
|
||||
// Get all xcode paths from /Applications/
|
||||
const xcodePaths = (await fs.readdir('/Applications/'))
|
||||
.filter((file) => file.toLowerCase().startsWith('xcode_'));
|
||||
|
||||
// Determine which xcodes need to be skipped
|
||||
let excludedXcodeArr = (process.env.EXCLUDE_XCODE || '').replace(/\s/g, '').split(',');
|
||||
log.info(`Will skip xcode versions: '${excludedXcodeArr}'`);
|
||||
|
||||
for (let xcodePath of xcodePaths) {
|
||||
if (xcodePath.includes('beta')) {
|
||||
log.info(`Skipping beta Xcode '${xcodePath}'`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip if .0 because redundant (example: skip 11.4.0 because it already does 11.4)
|
||||
const [, , patch] = xcodePath.split('.');
|
||||
if (patch === '0') {
|
||||
log.info(`Skipping xcode '${xcodePath}'`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Build webdriveragent for this xcode version
|
||||
log.info(`Running xcode-select for '${xcodePath}'`);
|
||||
await exec('sudo', ['xcode-select', '-s', `/Applications/${xcodePath}/Contents/Developer`]);
|
||||
const xcodeVersion = path.parse(xcodePath).name.split('_', 2)[1];
|
||||
|
||||
if (excludedXcodeArr.includes(xcodeVersion)) {
|
||||
log.info(`Skipping xcode version '${xcodeVersion}'`);
|
||||
continue;
|
||||
}
|
||||
|
||||
log.info('Building webdriveragent for xcode version', xcodeVersion);
|
||||
try {
|
||||
await buildWebDriverAgent(xcodeVersion);
|
||||
} catch (e) {
|
||||
log.error(`Skipping build for '${xcodeVersion} due to error: ${e}'`);
|
||||
}
|
||||
}
|
||||
|
||||
// Divider log line
|
||||
log.info('\n');
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
asyncify(buildAndUploadWebDriverAgents);
|
||||
}
|
||||
|
||||
module.exports = buildAndUploadWebDriverAgents;
|
||||
38
ci-jobs/templates/build.yml
Normal file
38
ci-jobs/templates/build.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
parameters:
|
||||
vmImage: 'macOS-11'
|
||||
name: macOS_11
|
||||
excludeXcode: $(excludeXcode)
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
variables:
|
||||
EXCLUDE_XCODE: ${{ parameters.excludeXcode }}
|
||||
pool:
|
||||
vmImage: ${{ parameters.vmImage }}
|
||||
dependsOn: create_github_release
|
||||
steps:
|
||||
- script: node ./ci-jobs/scripts/azure-print-tag-name
|
||||
displayName: Print Tag Name
|
||||
- script: ls /Applications/
|
||||
displayName: List Installed Applications
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: lts/*
|
||||
- script: npm install
|
||||
displayName: Install Node Modules
|
||||
- script: mkdir -p Resources/WebDriverAgent.bundle
|
||||
displayName: Make Resources Folder
|
||||
- script: node ./Scripts/build-webdriveragent.js
|
||||
displayName: Build WebDriverAgents
|
||||
- script: ls ./bundles
|
||||
displayName: List WDA Bundles
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: bundles/
|
||||
artifactName: ${{ parameters.name }}
|
||||
- script: |
|
||||
brew install ghr
|
||||
ghr $(node ./ci-jobs/scripts/azure-print-tag-name) bundles/
|
||||
env:
|
||||
GITHUB_TOKEN: $(GITHUB_TOKEN)
|
||||
displayName: Upload to GitHub Releases
|
||||
Reference in New Issue
Block a user