diff --git a/.azure/azure-ci-build-pipeline.yaml b/.azure/azure-ci-build-pipeline.yaml index 902eb38d..066c66b2 100644 --- a/.azure/azure-ci-build-pipeline.yaml +++ b/.azure/azure-ci-build-pipeline.yaml @@ -6,69 +6,85 @@ trigger: - bugfix/* - release/* -strategy: - matrix: - UbuntuPython38: - python.version: '3.8' - imageName: 'ubuntu-latest' - UbuntuPython310: - python.version: '3.10' - imageName: 'ubuntu-latest' - WindowsPython38: - python.version: '3.8' - imageName: 'windows-latest' - WindowsPython310: - python.version: '3.10' - imageName: 'windows-latest' - MacOSPython38: - python.version: '3.8' - imageName: 'macOS-latest' - MacOSPython310: - python.version: '3.10' - imageName: 'macOS-latest' +parameters: + # https://stackoverflow.com/a/70046417 + - name: matrix + type: object + default: + - job_name: 'UbuntuPython38' + py: '3.8' + img: 'ubuntu-latest' + every_time: false + - job_name: 'UbuntuPython310' + py: '3.10' + img: 'ubuntu-latest' + every_time: true + - job_name: 'WindowsPython38' + py: '3.8' + img: 'windows-latest' + every_time: false + - job_name: 'WindowsPython310' + py: '3.10' + img: 'windows-latest' + every_time: false + - job_name: 'MacOSPython38' + py: '3.8' + img: 'macOS-latest' + every_time: false + - job_name: 'MacOSPython310' + py: '3.10' + img: 'macOS-latest' + every_time: false -pool: - vmImage: $(imageName) +stages: + - stage: Test + jobs: + - ${{ each item in parameters.matrix }}: + - job: ${{ item.job_name }} + pool: + vmImage: ${{ item.img }} -steps: -- task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - displayName: 'Use Python $(python.version)' + condition: or( eq(variables['Build.Reason'], 'PullRequest'), ${{ item.every_time }} ) -- script: | - python -m pip install pre-commit - pre-commit install - pre-commit run --all-files - displayName: 'Run pre-commits' + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: ${{ item.py }} + displayName: 'Use Python ${{ item.py }}' -- script: | - python -m pip install --upgrade pip==23.0.1 - pip install wheel==0.38.4 --upgrade - pip install setuptools==66 --upgrade - pip install build==0.10.0 - pip install pytest-azurepipelines - displayName: 'Install build dependencies' + - script: | + python -m pip install pre-commit + pre-commit install + pre-commit run --all-files + displayName: 'Run pre-commits' -- script: | - python -m build - displayName: 'Build PrimAITE' + - script: | + python -m pip install --upgrade pip==23.0.1 + pip install wheel==0.38.4 --upgrade + pip install setuptools==66 --upgrade + pip install build==0.10.0 + pip install pytest-azurepipelines + displayName: 'Install build dependencies' -- script: | - PRIMAITE_WHEEL=$(ls ./dist/primaite*.whl) - python -m pip install $PRIMAITE_WHEEL[dev] - displayName: 'Install PrimAITE' - condition: or(eq( variables['Agent.OS'], 'Linux' ), eq( variables['Agent.OS'], 'Darwin' )) + - script: | + python -m build + displayName: 'Build PrimAITE' -- script: | - forfiles /p dist\ /m *.whl /c "cmd /c python -m pip install @file[dev]" - displayName: 'Install PrimAITE' - condition: eq( variables['Agent.OS'], 'Windows_NT' ) + - script: | + PRIMAITE_WHEEL=$(ls ./dist/primaite*.whl) + python -m pip install $PRIMAITE_WHEEL[dev] + displayName: 'Install PrimAITE' + condition: or(eq( variables['Agent.OS'], 'Linux' ), eq( variables['Agent.OS'], 'Darwin' )) -- script: | - primaite setup - displayName: 'Perform PrimAITE Setup' + - script: | + forfiles /p dist\ /m *.whl /c "cmd /c python -m pip install @file[dev]" + displayName: 'Install PrimAITE' + condition: eq( variables['Agent.OS'], 'Windows_NT' ) -- script: | - pytest tests/ - displayName: 'Run tests' + - script: | + primaite setup + displayName: 'Perform PrimAITE Setup' + + - script: | + pytest tests/ + displayName: 'Run tests'