Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 34 additions & 11 deletions azure/azure_style.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
parameters:
- name: REPO_NAME
type: string
- name: IMAGE
type: string
# The following parameters have defaults because this template could be used by repos directly
- name: TIMEOUT
type: number
Expand Down Expand Up @@ -162,24 +164,45 @@ jobs:
timeoutInMinutes: ${{ parameters.TIMEOUT }}
continueOnError: ${{ parameters.IGNORE_STYLE }}
condition: ${{ parameters.MYPY }}
strategy:
matrix:
"u24-gcc-ompi-latest":
DOCKER_TAG: u24-gcc-ompi-latest
variables:
- group: Docker
- name: SCRITICAL_HOMEDIR
value: /home/scriticaluser
- name: DOCKER_WORKING_DIR
value: ${{ variables.SCRITICAL_HOMEDIR }}/repos/${{ parameters.REPO_NAME }}
- name: DOCKER_MOUNT_DIR
value: ${{ variables.SCRITICAL_HOMEDIR }}/azure/${{ parameters.REPO_NAME }}
- name: BASHRC
value: ${{ variables.SCRITICAL_HOMEDIR }}/.bashrc_scritical
steps:
- checkout: self
- checkout: azure_template
- task: UsePythonVersion@0
inputs:
versionSpec: "3.11"
- script: |
cd ${{ parameters.REPO_NAME }}

pip install wheel
pip install mypy

# Check if the local repo has a requirements.txt file and install it if present
if [[ -f "requirements.txt" ]]; then
pip install -r requirements.txt
# This is a trusted build if DOCKER_USERNAME is defined
if [[ ! -z $(DOCKER_USERNAME) ]] ; then
echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_USERNAME) --password-stdin;
fi

# Run mypy check (should pick up local config from mypy.ini or .mypy.ini if present)
mypy
# "auto" pulls the private image for trusted builds
if [[ "${{ parameters.IMAGE }}" == "private" ]] || [[ "${{ parameters.IMAGE }}" == "auto" && ! -z $(DOCKER_USERNAME) ]] ; then
export DOCKER_IMAGE=private-dev;
else
export DOCKER_IMAGE=public-dev;
fi
docker pull scritical/$DOCKER_IMAGE:$(DOCKER_TAG);
docker run -t -d --name app --mount "type=bind,src=$(pwd)/${{ parameters.REPO_NAME }},target=${{ variables.DOCKER_MOUNT_DIR }}" scritical/$DOCKER_IMAGE:$(DOCKER_TAG) /bin/bash;
docker exec app /bin/bash -c "rm -rf ${{ variables.DOCKER_WORKING_DIR }} && cp -r ${{ variables.DOCKER_MOUNT_DIR }} ${{ variables.DOCKER_WORKING_DIR }}";
displayName: Prepare Repository
- script: |
set -e
docker exec app /bin/bash -c ". ${{ variables.BASHRC }} && cd ${{ variables.DOCKER_WORKING_DIR }} && mypy"
displayName: Run mypy
condition: and(succeeded())


1 change: 1 addition & 0 deletions azure/azure_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ stages:
- template: azure_style.yaml
parameters:
REPO_NAME: ${{ parameters.REPO_NAME }}
IMAGE: ${{ parameters.IMAGE }}
TIMEOUT: ${{ parameters.TIMEOUT_STYLE }}
IGNORE_STYLE: ${{ parameters.IGNORE_STYLE }}
BASE_FORMAT_AND_LINT: ${{ parameters.BASE_FORMAT_AND_LINT }}
Expand Down