//process the strategy matrix public GitHubActions.Strategy ProcessStrategy(AzurePipelines.Strategy strategy) { //Azure DevOps //strategy: // matrix: // linux: // imageName: ubuntu - 16.04 // mac: // imageName: macos-10.13 // windows: // imageName: vs2017-win2016 //jobs: //- job: Build // pool: // vmImage: $(imageName) //GitHub Actions //runs-on: ${{ matrix.imageName }} //strategy: // matrix: // imageName: [ubuntu-16.04, macos-10.13, vs2017-win2016] if (strategy != null) { GitHubActions.Strategy processedStrategy = null; if (strategy.matrix != null) { if (processedStrategy == null) { processedStrategy = new GitHubActions.Strategy(); } string[] matrix = new string[strategy.matrix.Count]; KeyValuePair <string, Dictionary <string, string> > matrixVariable = strategy.matrix.First(); MatrixVariableName = matrixVariable.Value.Keys.First(); int i = 0; foreach (KeyValuePair <string, Dictionary <string, string> > entry in strategy.matrix) { matrix[i] = strategy.matrix[entry.Key][MatrixVariableName]; i++; } processedStrategy.matrix = new Dictionary <string, string[]> { { MatrixVariableName, matrix } }; } if (strategy.parallel != null) { ConversionUtility.WriteLine("This variable is not needed in actions: " + strategy.parallel, _verbose); } if (strategy.maxParallel != null) { if (processedStrategy == null) { processedStrategy = new GitHubActions.Strategy(); } processedStrategy.max_parallel = strategy.maxParallel; } if (strategy.runOnce != null) { //TODO: There is currently no conversion path for other strategies ConversionUtility.WriteLine("TODO: " + strategy.runOnce, _verbose); } return(processedStrategy); } else { return(null); } }
//process the strategy matrix private GitHubActions.Strategy ProcessStrategy(AzurePipelines.Strategy strategy) { //Azure DevOps //strategy: // matrix: // linux: // imageName: ubuntu - 16.04 // mac: // imageName: macos-10.13 // windows: // imageName: vs2017-win2016 //jobs: //- job: Build // pool: // vmImage: $(imageName) //GitHub Actions //runs-on: ${{ matrix.imageName }} //strategy: // matrix: // imageName: [ubuntu-16.04, macos-10.13, vs2017-win2016] if (strategy != null) { GitHubActions.Strategy newStrategy = null; if (strategy.matrix != null) { if (newStrategy == null) { newStrategy = new GitHubActions.Strategy(); } string[] matrix = new string[strategy.matrix.Count]; KeyValuePair <string, Dictionary <string, string> > matrixVariable = strategy.matrix.First(); MatrixVariableName = matrixVariable.Value.Keys.First(); //VariableList.Add("$(" + _matrixVariableName + ")"); int i = 0; foreach (KeyValuePair <string, Dictionary <string, string> > entry in strategy.matrix) { matrix[i] = strategy.matrix[entry.Key][MatrixVariableName]; i++; } newStrategy.matrix = new Dictionary <string, string[]> { { MatrixVariableName, matrix } }; } if (strategy.parallel != null) { Console.WriteLine("This variable is not needed in actions: " + strategy.parallel); } if (strategy.maxParallel != null) { if (newStrategy == null) { newStrategy = new GitHubActions.Strategy(); } newStrategy.max_parallel = strategy.maxParallel; } if (strategy.runOnce != null) { Console.WriteLine("TODO: " + strategy.runOnce); } return(newStrategy); } else { return(null); } }