-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from MC-kit/devel
Devel
- Loading branch information
Showing
91 changed files
with
3,423 additions
and
1,275 deletions.
There are no files selected for viewing
This file contains 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,56 @@ | ||
[flake8] | ||
# select=ANN,B,B9,BLK,C,D,DAR,E,F,TC,I,S,W | ||
select=ANN,B,B9,BLK,C,D,DAR,E,F,TC,S,W | ||
max-complexity=10 | ||
max-line-length=88 | ||
ignore= | ||
# ANN001 Missing type annotation for function argument | ||
ANN001 | ||
# ANN101 Missing type annotation for self in method | ||
ANN101 | ||
# ANN102 Missing type annotation for cls in classmethod | ||
ANN102 | ||
#ANN204 Missing return type annotation for special method | ||
ANN204 | ||
# C812 Missing trailing comma: black compatibility | ||
C812 | ||
# D105 Missing docstring in magic method (__hash__, __eq__) | ||
D105 | ||
# Missing docstring in __init__ | ||
D107 | ||
# E203: Whitespace before ‘:' | ||
E203 | ||
# E501: Line too long | ||
E501 | ||
# W503: Line break before binary operator: for compatibility with black settings | ||
W503 | ||
# import is controlled by isort | ||
I100 | ||
I201 | ||
I202 | ||
exclude= | ||
.git | ||
__pycache__ | ||
docs/source/conf.py | ||
adhoc | ||
wrk | ||
build | ||
dist | ||
tools/install-poetry.py | ||
*.pyc | ||
*.egg-info | ||
.cache | ||
.eggs | ||
per-file-ignores = | ||
noxfile.py:ANN,DAR101 | ||
tools/clear-prev-dist-info.py:S404,S603,S607 | ||
src/tests/*:S101,ANN,DAR100,D100,D103,DAR101,DAR103 | ||
src/xpypact/Inventory.py:F811 | ||
src/xpypact/data_arrays.py:ANN401 | ||
src/xpypact/utils/resource.py:ANN202 | ||
ignore-decorators=click,pytest | ||
docstring-convention = google | ||
rst-roles = class,const,func,meth,mod,ref | ||
rst-directives = deprecated | ||
|
||
# vim: set ts=4 sw=0 tw=79 ss=0 ft=ini et ai : |
This file contains 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,4 @@ | ||
pip==22.2.2 | ||
nox==2022.8.7 | ||
poetry==1.2.0 | ||
virtualenv==20.16.4 |
This file contains 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 |
---|---|---|
@@ -1,9 +1,31 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: monthly | ||
time: "11:00" | ||
open-pull-requests-limit: 10 | ||
target-branch: devel | ||
|
||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: monthly | ||
day: monday | ||
time: "11:00" | ||
open-pull-requests-limit: 10 | ||
target-branch: devel | ||
|
||
- package-ecosystem: "github-actions" | ||
# Workflow files stored in the default location of `.github/workflows` | ||
directory: "/" | ||
schedule: | ||
interval: monthly | ||
day: tuesday | ||
time: "11:00" | ||
open-pull-requests-limit: 10 | ||
target-branch: devel | ||
|
||
- package-ecosystem: "gitsubmodule" | ||
directory: "/" | ||
schedule: | ||
interval: monthly | ||
day: wednesday | ||
time: "11:00" | ||
open-pull-requests-limit: 10 | ||
target-branch: devel |
This file contains 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,30 @@ | ||
name: Clean Workflow Logs | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
# days_old: | ||
# description: "The amount of days old to delete" | ||
# default: "7" | ||
# required: false | ||
dry: | ||
description: "Dry run" | ||
default: "false" | ||
required: false | ||
jobs: | ||
clean-logs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# - uses: igorjs/gh-actions-clean-workflow@v1 | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# owner: ${{ github.repository_owner }} | ||
# repo: ${{ github.event.repository.name }} | ||
# days_old: ${{ github.event.inputs.days_old }} | ||
- name: Clean workflow runs | ||
uses: dmvict/[email protected] | ||
with: | ||
token: ${{ secrets.MCKIT_GITHUB_TOKEN }} | ||
save_period: 30 | ||
save_min_runs_number: 10 | ||
dry: ${{ github.event.inputs.dry }} |
This file contains 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,143 @@ | ||
name: 'Combine PRs' | ||
|
||
# | ||
# Source: | ||
# https://dev.to/denvercoder1/keeping-your-dependencies-updated-automatically-with-dependabot-299g | ||
# https://github.com/hrvey/combine-prs-workflow/blob/master/combine-prs.yml | ||
# | ||
|
||
# Controls when the action will run - in this case triggered manually | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branchPrefix: | ||
description: 'Branch prefix to find combinable PRs based on' | ||
required: true | ||
default: 'dependabot' | ||
mustBeGreen: | ||
description: 'Only combine PRs that are green (status is success)' | ||
required: true | ||
type: boolean | ||
default: true | ||
combineBranchName: | ||
description: 'Name of the branch to combine PRs into' | ||
required: true | ||
default: 'combine-prs-branch' | ||
ignoreLabel: | ||
description: 'Exclude PRs with this label' | ||
required: true | ||
default: 'nocombine' | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "combine-prs" | ||
combine-prs: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- uses: actions/github-script@v6 | ||
id: create-combined-pr | ||
name: Create Combined PR | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
let branchesAndPRStrings = []; | ||
let baseBranch = null; | ||
let baseBranchSHA = null; | ||
for (const pull of pulls) { | ||
const branch = pull['head']['ref']; | ||
console.log('Pull for branch: ' + branch); | ||
if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) { | ||
console.log('Branch matched prefix: ' + branch); | ||
let statusOK = true; | ||
if(${{ github.event.inputs.mustBeGreen }}) { | ||
console.log('Checking green status: ' + branch); | ||
const statusResponse = await github.rest.repos.getCombinedStatusForRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: branch | ||
}); | ||
const state = statusResponse['data']['state']; | ||
console.log('Validating status: ' + state); | ||
if(state != 'success') { | ||
console.log('Discarding ' + branch + ' with status ' + state); | ||
statusOK = false; | ||
} | ||
} | ||
console.log('Checking labels: ' + branch); | ||
const labels = pull['labels']; | ||
for(const label of labels) { | ||
const labelName = label['name']; | ||
console.log('Checking label: ' + labelName); | ||
if(labelName == '${{ github.event.inputs.ignoreLabel }}') { | ||
console.log('Discarding ' + branch + ' with label ' + labelName); | ||
statusOK = false; | ||
} | ||
} | ||
if (statusOK) { | ||
console.log('Adding branch to array: ' + branch); | ||
const prString = '#' + pull['number'] + ' ' + pull['title']; | ||
branchesAndPRStrings.push({ branch, prString }); | ||
baseBranch = pull['base']['ref']; | ||
baseBranchSHA = pull['base']['sha']; | ||
} | ||
} else { | ||
console.log('Branch did not match prefix: ' + branch); | ||
} | ||
} | ||
if (branchesAndPRStrings.length == 0) { | ||
core.setFailed('No PRs/branches matched criteria'); | ||
return; | ||
} | ||
try { | ||
await github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/heads/' + '${{ github.event.inputs.combineBranchName }}', | ||
sha: baseBranchSHA | ||
}); | ||
} catch (error) { | ||
console.log(error); | ||
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?'); | ||
return; | ||
} | ||
let combinedPRs = []; | ||
let mergeFailedPRs = []; | ||
for(const { branch, prString } of branchesAndPRStrings) { | ||
try { | ||
await github.rest.repos.merge({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
base: '${{ github.event.inputs.combineBranchName }}', | ||
head: branch, | ||
}); | ||
console.log('Merged branch ' + branch); | ||
combinedPRs.push(prString); | ||
} catch (error) { | ||
console.log('Failed to merge branch ' + branch); | ||
mergeFailedPRs.push(prString); | ||
} | ||
} | ||
console.log('Creating combined PR'); | ||
const combinedPRsString = combinedPRs.join('\n'); | ||
let body = '✅ This PR was created by the Combine PRs action by combining the following PRs:\n' + combinedPRsString; | ||
if(mergeFailedPRs.length > 0) { | ||
const mergeFailedPRsString = mergeFailedPRs.join('\n'); | ||
body += '\n\n⚠️ The following PRs were left out due to merge conflicts:\n' + mergeFailedPRsString | ||
} | ||
await github.rest.pulls.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: 'Combined PR', | ||
head: '${{ github.event.inputs.combineBranchName }}', | ||
base: baseBranch, | ||
body: body | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,20 +1,34 @@ | ||
name: Labeler | ||
name: Create Repository Labels | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
- devel | ||
paths: | ||
- .github/labels.yaml | ||
- .github/workflows/repo-labels.yaml | ||
pull_request: | ||
branches: | ||
- trunk | ||
paths: | ||
- .github/labels.yaml | ||
- .github/workflows/labeler.yml | ||
schedule: | ||
- cron: "0 0 * * TUE" | ||
|
||
jobs: | ||
labeler: | ||
labels: | ||
name: Sycnchronize repository labels | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/[email protected] | ||
|
||
- name: Run Labeler | ||
uses: crazy-max/ghaction-github-labeler@v3.1.1 | ||
- name: Sync GitHub Issue Labels | ||
uses: crazy-max/ghaction-github-labeler@v4 | ||
with: | ||
github-token: ${{ secrets.MCKIT_GITHUB_TOKEN }} | ||
skip-delete: true | ||
dry-run: ${{ github.ref != 'refs/heads/master' }} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.