diff --git a/.github/workflows/EVENT_pull_request.yml b/.github/workflows/EVENT_pull_request.yml index b7ea05bed..b90ee75fc 100644 --- a/.github/workflows/EVENT_pull_request.yml +++ b/.github/workflows/EVENT_pull_request.yml @@ -20,30 +20,15 @@ jobs: permissions: contents: read - format: - name: Check format of python + python_checks: + name: Python Checks needs: get_changed_files if: needs.get_changed_files.outputs.python_changed_files != '' - uses: ./.github/workflows/JOB_format.yml - with: - files: ${{ needs.get_changed_files.outputs.python_changed_files }} - permissions: - contents: read - lint: - name: Lint python - needs: get_changed_files - if: needs.get_changed_files.outputs.python_changed_files != '' - uses: ./.github/workflows/JOB_lint.yml + uses: ./.github/workflows/JOB_python_checks.yml + with: files: ${{ needs.get_changed_files.outputs.python_changed_files }} permissions: contents: read - run_tests: - name: Run tests - needs: get_changed_files - if: needs.get_changed_files.outputs.python_changed_files != '' - uses: ./.github/workflows/JOB_tests.yml - permissions: - contents: read diff --git a/.github/workflows/JOB_python_checks.yml b/.github/workflows/JOB_python_checks.yml new file mode 100644 index 000000000..8f2f15c47 --- /dev/null +++ b/.github/workflows/JOB_python_checks.yml @@ -0,0 +1,24 @@ +name: Python Checks +on: + workflow_call: + inputs: + files: + required: true + type: string + +jobs: + format: + name: Check format + uses: ./.github/workflows/JOB_format.yml + with: + files: ${{ inputs.files }} + + lint: + name: Lint + uses: ./.github/workflows/JOB_lint.yml + with: + files: ${{ inputs.files }} + + run_tests: + name: Run tests + uses: ./.github/workflows/JOB_tests.yml diff --git a/.github/workflows/version_bump.yml b/.github/workflows/version_bump.yml index 26fb890ff..38d7c6495 100644 --- a/.github/workflows/version_bump.yml +++ b/.github/workflows/version_bump.yml @@ -47,28 +47,40 @@ jobs: - name: Bump version run: | + python deploy/increase_version.py --${{ inputs.bump_type }} + BASE_VERSION=$(cat .version) + if [[ "${{ inputs.test_mode }}" == "true" ]]; then TIMESTAMP=$(date +%Y%m%d%H%M%S) - echo "NEW_VERSION=0.0.0-test.${TIMESTAMP}" >> $GITHUB_ENV - echo "TAG_PREFIX=test-" >> $GITHUB_ENV - echo "BRANCH_NAME=test/version-bump" >> $GITHUB_ENV + TEST_VERSION="${BASE_VERSION}-test.${TIMESTAMP}" + # Update version in pyproject.toml and __init__.py + sed -i "s/^version = .*/version = \"${TEST_VERSION}\"/" pyproject.toml + sed -i "s/__version__ = .*/__version__ = \"${TEST_VERSION}\"/" darwin/__init__.py + NEW_VERSION="${BASE_VERSION}-test.${TIMESTAMP}" + TAG_PREFIX="test-" + BRANCH_NAME="test/version-bump" else - python deploy/increase_version.py --${{ inputs.bump_type }} - NEW_VERSION=$(cat .version) - echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV - echo "TAG_PREFIX=v" >> $GITHUB_ENV - echo "BRANCH_NAME=master" >> $GITHUB_ENV + NEW_VERSION="${BASE_VERSION}" + TAG_PREFIX="v" + BRANCH_NAME="master" fi + echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV + echo "TAG_PREFIX=${TAG_PREFIX}" >> $GITHUB_ENV + echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV - name: Commit and push changes + if: ${{ inputs.test_mode != 'true' }} run: | git add pyproject.toml darwin/__init__.py git commit -m "Version bump to ${{ env.NEW_VERSION }}" - if [[ "${{ inputs.test_mode }}" == "true" ]]; then - git checkout -b ${BRANCH_NAME} - fi git push origin HEAD:${BRANCH_NAME} + - name: Create test branch + if: ${{ inputs.test_mode == 'true' }} + run: | + git checkout -b ${BRANCH_NAME} + git push origin ${BRANCH_NAME} + - name: Create and push tag run: | git tag -a "${TAG_PREFIX}${NEW_VERSION}" -m "bump version to ${TAG_PREFIX}${NEW_VERSION}"