-
Notifications
You must be signed in to change notification settings - Fork 3.4k
{CI} Add github workflows for azdev style & linter
#31284
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: GH Azdev Setup | ||
| description: 'azdev env setup' | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Check Init GH Event | ||
| env: | ||
| action: ${{ toJSON(github.event.action) }} | ||
| label: ${{ toJSON(github.event.label) }} | ||
| shell: bash | ||
| run: | | ||
| echo start azdev env setup | ||
| - name: Checkout CLI repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # checkout all branches | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} # checkout pull request branch | ||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v3 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Install azdev | ||
| shell: bash | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| set -ev | ||
| python -m venv env | ||
| chmod +x env/bin/activate | ||
| source ./env/bin/activate | ||
| pip install azdev | ||
| azdev --version | ||
| cd ../ | ||
| azdev setup -c azure-cli --debug | ||
| az --version | ||
| pip list -v |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| name: GH Check CLI Linter | ||
| on: | ||
| pull_request_target: | ||
| types: [opened, labeled, unlabeled, synchronize] | ||
| branches: | ||
| - dev | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| azdev-linter: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: read | ||
| contents: read | ||
| steps: | ||
| - name: Checkout CLI repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
| sparse-checkout: | | ||
| .github | ||
| - name: Azdev Env Setup | ||
| uses: ./.github/actions/env-setup | ||
| - name: Get Base Branch | ||
| env: | ||
| bash_sha: ${{ github.event.pull_request.base.sha }} | ||
| base_branch: ${{ github.event.pull_request.base.ref }} | ||
| base_repo: ${{ github.event.pull_request.base.repo.clone_url }} | ||
| base_branch_pre: "upstream" | ||
| diff_sha: ${{ github.event.pull_request.head.sha }} | ||
| diff_branch: ${{ github.event.pull_request.head.ref }} | ||
| repo_full_name: ${{ github.event.pull_request.head.repo.full_name }} | ||
| run: | | ||
| set -x | ||
| git --version | ||
| git log --oneline | head -n 10 | ||
| git branch -a | ||
| git fetch "$base_repo" "$base_branch":"$base_branch_pre"/"$base_branch" | ||
| git checkout "$base_branch_pre"/"$base_branch" | ||
| - name: Run Azdev Style | ||
| env: | ||
| pr_label_list: ${{ toJson(github.event.pull_request.labels.*.name) }} | ||
| pr_user: ${{ github.event.pull_request.user.login }} | ||
| base_branch: ${{ github.event.pull_request.base.ref }} | ||
| base_branch_pre: "upstream" | ||
| diff_branch: ${{ github.event.pull_request.head.ref }} | ||
| run: | | ||
| chmod +x env/bin/activate | ||
| source ./env/bin/activate | ||
| set -ev | ||
|
|
||
| git checkout -f "$diff_branch" | ||
| # always use the latest scripts from base branch | ||
| git checkout "$base_branch_pre"/"$base_branch" -- scripts | ||
| git checkout "$base_branch_pre"/"$base_branch" -- .github | ||
|
|
||
| python scripts/ci/service_name.py | ||
| merge_base=$(git merge-base HEAD "$base_branch_pre"/"$base_branch") | ||
| echo merge_base: "$merge_base" | ||
| azdev linter --ci-exclusions --min-severity medium --repo ./ --src "$diff_branch" --tgt "$merge_base" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: GH Check CLI Style | ||
| on: | ||
| pull_request_target: | ||
| types: [opened, labeled, unlabeled, synchronize] | ||
| branches: | ||
| - dev | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| azdev-style: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: read | ||
| contents: read | ||
| steps: | ||
| - name: Checkout CLI repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
| sparse-checkout: | | ||
| .github | ||
| - name: Azdev Env Setup | ||
| uses: ./.github/actions/env-setup | ||
| - name: Get Base Branch | ||
| env: | ||
| bash_sha: ${{ github.event.pull_request.base.sha }} | ||
| base_branch: ${{ github.event.pull_request.base.ref }} | ||
| base_repo: ${{ github.event.pull_request.base.repo.clone_url }} | ||
| base_branch_pre: "upstream" | ||
| diff_sha: ${{ github.event.pull_request.head.sha }} | ||
| diff_branch: ${{ github.event.pull_request.head.ref }} | ||
| repo_full_name: ${{ github.event.pull_request.head.repo.full_name }} | ||
| run: | | ||
| set -x | ||
| git --version | ||
| git log --oneline | head -n 10 | ||
| git branch -a | ||
| git fetch "$base_repo" "$base_branch":"$base_branch_pre"/"$base_branch" | ||
| git checkout "$base_branch_pre"/"$base_branch" | ||
| - name: Run Azdev Style | ||
| env: | ||
| pr_label_list: ${{ toJson(github.event.pull_request.labels.*.name) }} | ||
| pr_user: ${{ github.event.pull_request.user.login }} | ||
| base_branch: ${{ github.event.pull_request.base.ref }} | ||
| base_branch_pre: "upstream" | ||
| diff_branch: ${{ github.event.pull_request.head.ref }} | ||
| run: | | ||
| chmod +x env/bin/activate | ||
| source ./env/bin/activate | ||
| set -ev | ||
|
|
||
| git checkout -f "$diff_branch" | ||
| # always use the latest scripts from base branch | ||
| git checkout "$base_branch_pre"/"$base_branch" -- scripts | ||
| git checkout "$base_branch_pre"/"$base_branch" -- .github | ||
| merge_base=$(git merge-base HEAD "$base_branch_pre"/"$base_branch") | ||
| echo merge_base: "$merge_base" | ||
| # check azdev style on diff mod | ||
| azdev style | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is
azdev styleon diff mode without specifying these arguments?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now
azdev styleruns in full mode, to be consistent with ado pipeline: https://github.com/Azure/azure-cli/blob/dev/azure-pipelines.yml#L1055