Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbaliasnikov committed Dec 17, 2024
1 parent e4cf3c2 commit dd7d6a7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 29 deletions.
1 change: 0 additions & 1 deletion .github/actions/slack-notify-release/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ runs:
using: composite
steps:
- name: Slack failure notification
if: failure()
uses: slackapi/[email protected]
with:
webhook: ${{ inputs.webhook }}
Expand Down
72 changes: 44 additions & 28 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,21 @@ on:
description: 'Run tests before release'
required: false
default: false
workspace-dirs:
type: string
description: 'Path to the workspace directories. To be used in configurations of release-please with merged PR for different components.'
required: false
default: '.'
publish-to-crates-io:
type: boolean
type: string
description: 'Whether to publish to crates.io'
required: false
default: false
default: 'false'
update-cargo-lock:
type: boolean
type: string
description: 'Whether to update Cargo.lock'
required: false
default: true
default: 'true'
org-owner:
type: string
description: 'Organization to add as owner of the crates.'
Expand All @@ -56,6 +61,11 @@ on:
description: 'Email of the user to use for git operations.'
required: false
default: '[email protected]'
cargo-lock-commit-message:
type: string
description: 'Commit message for Cargo.lock update.'
required: false
default: 'chore: update Cargo.lock'

jobs:

Expand All @@ -77,12 +87,18 @@ jobs:
config-file: ${{ inputs.config }}
manifest-file: ${{ inputs.manifest }}

- name: Slack notification
if: failure()
uses: matter-labs/zksync-ci-common/.github/actions/slack-notify-release@aba-release-please-support
with:
webhook: ${{ secrets.slack_webhook }}


update-cargo-lock:
name: Update Cargo.lock
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.prs_created == 'true' && inputs.update-cargo-lock }}
if: ${{ needs.release-please.outputs.prs_created == 'true' && inputs.update-cargo-lock == 'true' }}
strategy:
matrix:
pr_branch: ${{ fromJson(needs.release-please.outputs.prs).*.headBranchName }}
Expand All @@ -101,34 +117,39 @@ jobs:
- name: Install Rust toolchain
uses: moonrepo/setup-rust@v1

- name: Run cargo check
- name: Update Cargo.lock
shell: 'bash -ex {0}'
id: cargo-check
run: |
BRANCH="${{ matrix.pr_branch }}"
COMPONENT="${BRANCH##*components--}"
COMPONENT_PATH=$(cat ${{ inputs.config }} | jq -r --arg name "${COMPONENT}" '.packages[$name].path')
( cd "${COMPONENT_PATH}" && cargo update --workspace )
if [[ ${BRANCH} == *components* ]]; then
for COMPONENT in $(jq -r '.packages | keys[]' ${{ inputs.config }} ); do
( cd "${COMPONENT}" && cargo update --workspace )
done
else
for WORKSPACE in ${{ inputs.workspace-dirs }} ; do
( cd "${WORKSPACE}" && cargo update --workspace )
done
fi
if ! git diff --exit-code --quiet; then
echo "needs_update=true" >> "${GITHUB_OUTPUT}"
git config user.name "${{ inputs.git-user-name }}"
git config user.email "${{ inputs.git-user-email }}"
git add .
git commit -m "${{ inputs.cargo-lock-commit-message }}"
git push --set-upstream origin ${{ matrix.pr_branch }}
fi
- name: Update Cargo.lock
shell: 'bash -ex {0}'
if: steps.cargo-check.outputs.needs_update == 'true'
run: |
git config user.name "${{ inputs.git-user-name }}"
git config user.email "${{ inputs.git-user-email }}"
git add .
git commit -m "chore: update Cargo.lock"
git push --set-upstream origin ${{ matrix.pr_branch }}
- name: Slack notification
if: failure()
uses: matter-labs/zksync-ci-common/.github/actions/slack-notify-release@aba-release-please-support
with:
webhook: ${{ secrets.slack_webhook }}


publish-crates:
needs: release-please
name: Publish to crates.io
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.releases_created == 'true' && inputs.publish-to-crates-io }}
if: ${{ needs.release-please.outputs.releases_created == 'true' && inputs.publish-to-crates-io == 'true' }}
strategy:
matrix:
path: ${{ fromJson(needs.release-please.outputs.paths_released) }}
Expand Down Expand Up @@ -177,13 +198,8 @@ jobs:
cargo owner --list --quiet ${PKG} | grep ${ORG_OWNER} || cargo owner --add ${ORG_OWNER} ${PKG}
done
notify-slack-if-fail:
needs: [release-please, update-cargo-lock, publish-crates]
name: Notify Slack
runs-on: ubuntu-latest
if: failure()
steps:
- name: Send Slack notification if release failed
- name: Slack notification
if: failure()
uses: matter-labs/zksync-ci-common/.github/actions/slack-notify-release@aba-release-please-support
with:
webhook: ${{ secrets.slack_webhook }}

0 comments on commit dd7d6a7

Please sign in to comment.