From fce4e7893356fb708437f30f3b710b17a20ca864 Mon Sep 17 00:00:00 2001 From: Chris McCarthy Date: Wed, 26 Jul 2023 21:40:30 +0100 Subject: [PATCH] Synced with the github repo release --- .azure/.pypirc | 6 ++ .azure/artifact-release-pipeline.yaml | 38 +++++++++ .azure/azure-build-deploy-docs-pipeline.yml | 49 +++++++++++ .azure/azure-ci-build-pipeline.yaml | 90 +++++++++++++++++++++ .azuredevops/pull_request_template.md | 12 +++ 5 files changed, 195 insertions(+) create mode 100644 .azure/.pypirc create mode 100644 .azure/artifact-release-pipeline.yaml create mode 100644 .azure/azure-build-deploy-docs-pipeline.yml create mode 100644 .azure/azure-ci-build-pipeline.yaml create mode 100644 .azuredevops/pull_request_template.md diff --git a/.azure/.pypirc b/.azure/.pypirc new file mode 100644 index 00000000..9f89d0ea --- /dev/null +++ b/.azure/.pypirc @@ -0,0 +1,6 @@ +[distutils] +Index-servers = + PrimAITE + +[PrimAITE] +Repository = https://pkgs.dev.azure.com/ma-dev-uk/PrimAITE/_packaging/PrimAITE/pypi/upload/ diff --git a/.azure/artifact-release-pipeline.yaml b/.azure/artifact-release-pipeline.yaml new file mode 100644 index 00000000..47e9aacc --- /dev/null +++ b/.azure/artifact-release-pipeline.yaml @@ -0,0 +1,38 @@ +trigger: +- main + +pool: + vmImage: ubuntu-latest +strategy: + matrix: + Python310: + python.version: '3.10' + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + +- 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 twine + pip install keyring + pip install artifacts-keyring + displayName: 'Install build dependencies' + +- script: | + python -m build + displayName: 'Build PrimAITE sdist and wheel' + +- task: TwineAuthenticate@1 + displayName: 'Twine Authenticate' + inputs: + artifactFeed: PrimAITE/PrimAITE + +- script: | + python -m twine upload --verbose -r PrimAITE --config-file $(PYPIRC_PATH) dist/*.whl + displayName: 'Artifact Upload' diff --git a/.azure/azure-build-deploy-docs-pipeline.yml b/.azure/azure-build-deploy-docs-pipeline.yml new file mode 100644 index 00000000..0f44b0c8 --- /dev/null +++ b/.azure/azure-build-deploy-docs-pipeline.yml @@ -0,0 +1,49 @@ +name: Azure Static Web Apps CI/CD + +pr: none +trigger: + branches: + include: + - dev + +jobs: +- job: build_and_deploy_job + displayName: Build and Deploy Job + condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI'))) + pool: + vmImage: ubuntu-latest + variables: + - group: Azure-Static-Web-Apps-nice-bay-0ad032c03-variable-group + steps: + - checkout: self + submodules: true + + - 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 + displayName: 'Install build dependencies' + + - script: | + pip install -e .[dev] + displayName: 'Install Yawning-Titan for docs autosummary' + + - script: | + primaite setup + displayName: 'Perform PrimAITE Setup' + + - script: | + cd docs + make html + cd .. + cd .. + displayName: 'Build Docs' + + - task: AzureStaticWebApp@0 + inputs: + azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN_NICE_BAY_0AD032C03) + app_location: "/docs/_build/html" + api_location: "" + output_location: "/" + displayName: 'Deploy Docs to nice-bay-0ad032c03' diff --git a/.azure/azure-ci-build-pipeline.yaml b/.azure/azure-ci-build-pipeline.yaml new file mode 100644 index 00000000..0bb03594 --- /dev/null +++ b/.azure/azure-ci-build-pipeline.yaml @@ -0,0 +1,90 @@ +trigger: +- main +- dev +- feature/* +- hotfix/* +- bugfix/* +- release/* + +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 + +stages: + - stage: Test + jobs: + - ${{ each item in parameters.matrix }}: + - job: ${{ item.job_name }} + pool: + vmImage: ${{ item.img }} + + condition: or( eq(variables['Build.Reason'], 'PullRequest'), ${{ item.every_time }} ) + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: ${{ item.py }} + displayName: 'Use Python ${{ item.py }}' + + - script: | + python -m pip install pre-commit + pre-commit install + pre-commit run --all-files + displayName: 'Run pre-commits' + + - 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 build + displayName: 'Build PrimAITE' + + - 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: | + 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 setup + displayName: 'Perform PrimAITE Setup' + + - script: | + pytest -n 4 + displayName: 'Run tests' diff --git a/.azuredevops/pull_request_template.md b/.azuredevops/pull_request_template.md new file mode 100644 index 00000000..5ff03e18 --- /dev/null +++ b/.azuredevops/pull_request_template.md @@ -0,0 +1,12 @@ +## Summary +*Replace this text with an explanation of what the changes are and how you implemented them. Can this impact any other parts of the codebase that we should keep in mind?* + +## Test process +*How have you tested this (if applicable)?* + +## Checklist +- [ ] This PR is linked to a **work item** +- [ ] I have performed **self-review** of the code +- [ ] I have written **tests** for any new functionality added with this PR +- [ ] I have updated the **documentation** if this PR changes or adds functionality +- [ ] I have run **pre-commit** checks for code style