Feature distance metrics #960
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Compare the package version of the PR with the main branch | |
| # The workflow gets triggered by pushes and pull requests | |
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| compare-versions: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| # Checks out the code in the repository | |
| - uses: actions/checkout@v3 | |
| - name: Compile CLUEstering modules | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| git fetch | |
| RED="\033[0;31m" | |
| pr_version=$(cat setup.py | grep "__version__ " | awk -F '"' '{print $2}') | |
| pr_major=$(echo "$pr_version" | awk -F '.' '{print $1}') | |
| pr_minor=$(echo "$pr_version" | awk -F '.' '{print $2}') | |
| pr_patch=$(echo "$pr_version" | awk -F '.' '{print $3}') | |
| echo "Switching to 'main' branch" | |
| git switch main | |
| main_version=$(cat setup.py | grep "__version__ " | awk -F '"' '{print $2}') | |
| main_major=$(echo "$main_version" | awk -F '.' '{print $1}') | |
| main_minor=$(echo "$main_version" | awk -F '.' '{print $2}') | |
| main_patch=$(echo "$main_version" | awk -F '.' '{print $3}') | |
| if [ "$pr_major" -gt "$main_major" ]; then | |
| exit 0 | |
| elif [ "$pr_major" -lt "$main_major" ]; then | |
| echo -e "${RED}ERROR: Major version is behind main." | |
| exit 1 | |
| fi | |
| if [ "$pr_minor" -gt "$main_minor" ]; then | |
| exit 0 | |
| elif [ "$pr_minor" -lt "$main_minor" ]; then | |
| echo -e "${RED}ERROR: Minor version is behind main." | |
| exit 1 | |
| fi | |
| if [ "$pr_patch" -gt "$main_patch" ]; then | |
| exit 0 | |
| elif [ "$pr_patch" -lt "$main_patch" ]; then | |
| echo -e "${RED}ERROR: Patch version is behind main." | |
| exit 1 | |
| fi | |