Skip to content

build: [CG-10755] combine release.yml + auto-release.yml #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
15 changes: 15 additions & 0 deletions .github/actions/release-pypi/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Release PyPI"
description: "Release PyPI"
inputs:
pypi-token:
required: true
description: "PyPI token"
runs:
using: "composite"
steps:
- name: Release PyPI
shell: bash
run: |
export UV_PUBLISH_PASSWORD="${{ inputs.pypi-token }}"
export UV_PUBLISH_USERNAME="__token__"
uv publish --publish-url https://upload.pypi.org/legacy/
23 changes: 23 additions & 0 deletions .github/actions/release-slack-bot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Release Slack Bot"
description: "Release Slack Bot"
inputs:
slack-token:
required: true
description: "Slack token"
runs:
using: "composite"
steps:
# TODO: use python exec instead
- uses: slackapi/[email protected]
with:
method: chat.postMessage
token: ${{ inputs.slack-token }}
payload: |
username: ${{ job.status == 'success' && format('Released codegen@{0}', github.ref_name) || format('Failed to release codegen@{0}', github.ref_name) }}
channel: "#release"
icon_emoji: "${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}"
text: |
Actor: `${{ github.triggering_actor }}`
Author: `${{ github.event.head_commit.author.username }}`
${{ format('Commit: <{0}/{1}/commit/{2}|{1}@{2}>', github.server_url, github.repository, github.sha) || ''}}
View <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GHA logs>
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ runs:
run: |
uv run codecovcli create-commit -t ${{ inputs.codecov_token }}
uv run codecovcli create-report -t ${{ inputs.codecov_token }}
bash .github/actions/run_ats/ats.sh
bash .github/actions/run-ats/ats.sh

- name: Run tests
shell: bash
Expand Down
File renamed without changes.
39 changes: 0 additions & 39 deletions .github/workflows/auto-release.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/cache-warm-up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
ref: develop # Ensure we're operating on the 'develop' branch

- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment

warm-up-cache:
Expand All @@ -46,7 +46,7 @@ jobs:
with:
ref: develop # Ensure we're operating on the 'develop' branch

- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Cache oss-repos
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
fetch-depth: 0

- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Get changed files
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.REPO_SCOPED_TOKEN }}

- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Setup-pre-commit
Expand Down
84 changes: 64 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,71 @@ jobs:
name: wheels-${{ matrix.os }}-3.${{ matrix.python }}
path: ./wheelhouse/*.whl

release:
if: startsWith(github.ref, 'refs/tags/')
auto-release:
if: github.ref_name == 'develop'
environment: release
needs: build
runs-on: ubuntu-latest
permissions:
checks: read # to wait for required checks
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# TODO(CG-10743): clean-up once we remove LFS
- name: Remove pre-push hook
run: rm -f .git/hooks/pre-push

- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Wait for required checks
uses: poseidon/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
match_pattern: "(unit-tests|integration-tests)"

- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
pattern: wheels-*

- name: Github semantic release
uses: codfish/semantic-release-action@v3
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release PyPI
if: ${{ steps.semantic.outputs.new-release-published == 'true' }}
uses: ./.github/actions/release-pypi
with:
pypi-token: ${{ secrets.PYPI_TOKEN }}

- name: Slack notification
if: ${{ steps.semantic.outputs.new-release-published == 'true' }}
uses: ./.github/actions/release-slack-bot
with:
release-tag: ${{ steps.semantic.outputs.release-version }}
slack-token: ${{ secrets.SLACK_BOT_TOKEN }}

manual-release:
if: startsWith(github.ref, 'refs/tags/')
environment: release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write # grants permission to create a release on github
steps:
- uses: actions/checkout@v4

- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Download All Artifacts
Expand All @@ -90,10 +144,9 @@ jobs:
pattern: wheels-*

- name: Release PyPI
run: |
export UV_PUBLISH_PASSWORD="${{ secrets.PYPI_TOKEN }}"
export UV_PUBLISH_USERNAME="__token__"
uv publish --publish-url https://upload.pypi.org/legacy/
uses: ./.github/actions/release-pypi
with:
pypi-token: ${{ secrets.PYPI_TOKEN }}

- name: Github release
id: github-release
Expand All @@ -103,18 +156,9 @@ jobs:
fail_on_unmatched_files: true
generate_release_notes: true

# TODO: use python exec instead
- uses: slackapi/[email protected]
- name: Slack notification
if: always()
uses: ./.github/actions/release-slack-bot
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
username: ${{ job.status == 'success' && format('Released codegen@{0}', github.ref_name) || format('Failed to release codegen@{0}', github.ref_name) }}
channel: "#release"
icon_emoji: "${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}"
text: |
Actor: `${{ github.triggering_actor }}`
Author: `${{ github.event.head_commit.author.username }}`
${{ format('Commit: <{0}/{1}/commit/{2}|{1}@{2}>', github.server_url, github.repository, github.sha) || ''}}
View <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GHA logs>
release-tag: ${{ github.ref_name }}
slack-token: ${{ secrets.SLACK_BOT_TOKEN }}
12 changes: 6 additions & 6 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment
- name: Run ATS and Tests
uses: ./.github/actions/run_ats
uses: ./.github/actions/run-ats
timeout-minutes: 15
with:
default_tests: "tests/unit"
Expand Down Expand Up @@ -48,12 +48,12 @@ jobs:
name: "Codemod tests ${{matrix.size}}: Sync Graph=${{matrix.sync_graph}}"
steps:
- uses: actions/checkout@v4
- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment
- name: Cache oss-repos
uses: ./.github/actions/setup-oss-repos
- name: Run ATS and Tests
uses: ./.github/actions/run_ats
uses: ./.github/actions/run-ats
timeout-minutes: 15
with:
default_tests: "tests/integration/codemod/test_codemods.py"
Expand All @@ -71,7 +71,7 @@ jobs:
environment: parse-tests
steps:
- uses: actions/checkout@v4
- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Cache oss-repos
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
runs-on: ubuntu-latest-16
steps:
- uses: actions/checkout@v4
- name: Setup backend
- name: Setup environment
uses: ./.github/actions/setup-environment
- name: Test with pytest
timeout-minutes: 5
Expand Down