#2648 - updated benchmark process to output markdown file instead of LaTeX. Added pipeline that runs benchmarking at 2am on a weekday and automatically upon creation of release branch
This commit is contained in:
83
.azure/azure-benchmark-pipeline.yaml
Normal file
83
.azure/azure-benchmark-pipeline.yaml
Normal file
@@ -0,0 +1,83 @@
|
||||
trigger:
|
||||
branches:
|
||||
exclude:
|
||||
- '*'
|
||||
include:
|
||||
- 'refs/heads/release/*' # Trigger on creation of release branches
|
||||
|
||||
schedules:
|
||||
- cron: "0 2 * * 1-5" # Run at 2 AM every weekday
|
||||
displayName: "Weekday Schedule"
|
||||
branches:
|
||||
include:
|
||||
- dev
|
||||
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
|
||||
variables:
|
||||
VERSION: ''
|
||||
MAJOR_VERSION: ''
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
|
||||
- script: |
|
||||
VERSION=$(cat src/primaite/VERSION | tr -d '\n')
|
||||
MAJOR_VERSION=$(echo $VERSION | cut -d. -f1)
|
||||
echo "##vso[task.setvariable variable=VERSION]$VERSION"
|
||||
echo "##vso[task.setvariable variable=MAJOR_VERSION]$MAJOR_VERSION"
|
||||
displayName: 'Set Version Variables'
|
||||
|
||||
- script: |
|
||||
if [[ "$(Build.SourceBranch)" == "refs/heads/dev" ]]; then
|
||||
DATE=$(date +%Y%m%d%H%M)
|
||||
echo "${VERSION}+dev.${DATE}" > src/primaite/VERSION
|
||||
fi
|
||||
displayName: 'Update VERSION file for Dev Benchmark'
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.11'
|
||||
addToPath: true
|
||||
|
||||
- script: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
primaite setup
|
||||
displayName: 'Install Dependencies'
|
||||
|
||||
- script: |
|
||||
mkdir -p benchmark/results/v$(MAJOR_VERSION)/v$(VERSION)
|
||||
python benchmark.py --output benchmark/results/v$(MAJOR_VERSION)/v$(VERSION)
|
||||
displayName: 'Run Benchmarking Script'
|
||||
|
||||
- script: |
|
||||
git config --global user.email "oss@dstl.gov.uk"
|
||||
git config --global user.name "Defence Science and Technology Laboratory UK"
|
||||
workingDirectory: $(System.DefaultWorkingDirectory)
|
||||
displayName: 'Configure Git'
|
||||
condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'))
|
||||
|
||||
- script: |
|
||||
git add benchmark/results/v$(MAJOR_VERSION)/v$(VERSION)/*
|
||||
git commit -m "Automated benchmark output commit for version $(VERSION)"
|
||||
git push origin HEAD:$(Build.SourceBranchName)
|
||||
displayName: 'Commit and Push Benchmark Results'
|
||||
workingDirectory: $(System.DefaultWorkingDirectory)
|
||||
env:
|
||||
GIT_CREDENTIALS: $(System.AccessToken)
|
||||
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'))
|
||||
|
||||
- script: |
|
||||
mkdir -p artifact_output/benchmark/results/v$(MAJOR_VERSION)
|
||||
cp -r benchmark/results/v$(MAJOR_VERSION)/v$(VERSION) artifact_output/benchmark/results/v$(MAJOR_VERSION)/
|
||||
displayName: 'Prepare Artifacts for Publishing'
|
||||
|
||||
- task: PublishPipelineArtifact@1
|
||||
inputs:
|
||||
targetPath: 'artifact_output/benchmark/results' # Path to the files you want to publish
|
||||
artifactName: 'benchmark-output' # Name of the artifact
|
||||
publishLocation: 'pipeline'
|
||||
displayName: 'Publish Benchmark Output as Artifact'
|
||||
Reference in New Issue
Block a user