bitwarden_workflow_linter 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. bitwarden_workflow_linter-0.0.3/.editorconfig +138 -0
  2. bitwarden_workflow_linter-0.0.3/.gitattributes +1 -0
  3. bitwarden_workflow_linter-0.0.3/.github/CODEOWNERS +8 -0
  4. bitwarden_workflow_linter-0.0.3/.github/ISSUE_TEMPLATE/config.yml +14 -0
  5. bitwarden_workflow_linter-0.0.3/.github/PULL_REQUEST_TEMPLATE.md +31 -0
  6. bitwarden_workflow_linter-0.0.3/.github/renovate.json +22 -0
  7. bitwarden_workflow_linter-0.0.3/.github/workflows/_version_type.yml +60 -0
  8. bitwarden_workflow_linter-0.0.3/.github/workflows/cd.yml +156 -0
  9. bitwarden_workflow_linter-0.0.3/.github/workflows/ci.yml +33 -0
  10. bitwarden_workflow_linter-0.0.3/.github/workflows/enforce-labels.yml +21 -0
  11. bitwarden_workflow_linter-0.0.3/.github/workflows/scan.yml +78 -0
  12. bitwarden_workflow_linter-0.0.3/.gitignore +32 -0
  13. bitwarden_workflow_linter-0.0.3/.husky/pre-commit +1 -0
  14. bitwarden_workflow_linter-0.0.3/.python-version +1 -0
  15. bitwarden_workflow_linter-0.0.3/CONTRIBUTING.md +3 -0
  16. bitwarden_workflow_linter-0.0.3/LICENSE.txt +674 -0
  17. bitwarden_workflow_linter-0.0.3/PKG-INFO +182 -0
  18. bitwarden_workflow_linter-0.0.3/Pipfile +24 -0
  19. bitwarden_workflow_linter-0.0.3/Pipfile.lock +875 -0
  20. bitwarden_workflow_linter-0.0.3/README.md +156 -0
  21. bitwarden_workflow_linter-0.0.3/SECURITY.md +32 -0
  22. bitwarden_workflow_linter-0.0.3/Taskfile.yml +76 -0
  23. bitwarden_workflow_linter-0.0.3/package-lock.json +789 -0
  24. bitwarden_workflow_linter-0.0.3/package.json +30 -0
  25. bitwarden_workflow_linter-0.0.3/pylintrc +401 -0
  26. bitwarden_workflow_linter-0.0.3/pyproject.toml +45 -0
  27. bitwarden_workflow_linter-0.0.3/pyproject.toml.tpl +33 -0
  28. bitwarden_workflow_linter-0.0.3/settings.yaml +8 -0
  29. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/__about__.py +3 -0
  30. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/__init__.py +0 -0
  31. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/actions.py +218 -0
  32. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/cli.py +55 -0
  33. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/default_actions.json +262 -0
  34. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/default_settings.yaml +8 -0
  35. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/lint.py +173 -0
  36. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/load.py +146 -0
  37. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/models/__init__.py +0 -0
  38. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/models/job.py +56 -0
  39. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/models/step.py +48 -0
  40. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/models/workflow.py +45 -0
  41. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/rule.py +101 -0
  42. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/rules/__init__.py +0 -0
  43. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/rules/job_environment_prefix.py +72 -0
  44. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/rules/name_capitalized.py +56 -0
  45. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/rules/name_exists.py +59 -0
  46. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/rules/pinned_job_runner.py +52 -0
  47. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/rules/step_approved.py +101 -0
  48. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/rules/step_pinned.py +98 -0
  49. bitwarden_workflow_linter-0.0.3/src/bitwarden_workflow_linter/utils.py +179 -0
  50. bitwarden_workflow_linter-0.0.3/tests/__init__.py +0 -0
  51. bitwarden_workflow_linter-0.0.3/tests/conftest.py +3 -0
  52. bitwarden_workflow_linter-0.0.3/tests/fixtures/test-alt.yml +24 -0
  53. bitwarden_workflow_linter-0.0.3/tests/fixtures/test-min-incorrect.yaml +9 -0
  54. bitwarden_workflow_linter-0.0.3/tests/fixtures/test-min.yaml +13 -0
  55. bitwarden_workflow_linter-0.0.3/tests/fixtures/test.yml +49 -0
  56. bitwarden_workflow_linter-0.0.3/tests/fixtures/test_a.yaml +27 -0
  57. bitwarden_workflow_linter-0.0.3/tests/rules/__init__.py +0 -0
  58. bitwarden_workflow_linter-0.0.3/tests/rules/test_job_environment_prefix.py +110 -0
  59. bitwarden_workflow_linter-0.0.3/tests/rules/test_name_capitalized.py +107 -0
  60. bitwarden_workflow_linter-0.0.3/tests/rules/test_name_exists.py +75 -0
  61. bitwarden_workflow_linter-0.0.3/tests/rules/test_pinned_job_runner.py +65 -0
  62. bitwarden_workflow_linter-0.0.3/tests/rules/test_step_approved.py +113 -0
  63. bitwarden_workflow_linter-0.0.3/tests/rules/test_step_pinned.py +104 -0
  64. bitwarden_workflow_linter-0.0.3/tests/test_job.py +80 -0
  65. bitwarden_workflow_linter-0.0.3/tests/test_lint.py +47 -0
  66. bitwarden_workflow_linter-0.0.3/tests/test_load.py +94 -0
  67. bitwarden_workflow_linter-0.0.3/tests/test_rule.py +140 -0
  68. bitwarden_workflow_linter-0.0.3/tests/test_step.py +78 -0
  69. bitwarden_workflow_linter-0.0.3/tests/test_utils.py +35 -0
  70. bitwarden_workflow_linter-0.0.3/tests/test_workflow.py +97 -0
@@ -0,0 +1,138 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+
3
+ # top-most EditorConfig file
4
+ root = true
5
+
6
+ # Don't use tabs for indentation.
7
+ [*]
8
+ indent_size = 4
9
+ indent_style = space
10
+ tab_width = 4
11
+ end_of_line = lf
12
+ charset = utf-8
13
+ trim_trailing_whitespace = true
14
+ insert_final_newline = true
15
+ guidelines = 120
16
+
17
+ # Code files
18
+ [*.{cs,csx,vb,vbx}]
19
+ indent_size = 4
20
+
21
+ # Xml project files
22
+ [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
23
+ indent_size = 2
24
+
25
+ # Xml config files
26
+ [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
27
+ indent_size = 2
28
+
29
+ # JSON files
30
+ [*.json]
31
+ indent_size = 2
32
+
33
+ # JS files
34
+ [*.{js,ts,scss,html}]
35
+ indent_size = 2
36
+
37
+ [*.{ts}]
38
+ quote_type = single
39
+
40
+ [*.{scss,yml,csproj}]
41
+ indent_size = 2
42
+
43
+ [*.sln]
44
+ indent_style = tab
45
+
46
+ # Dotnet code style settings:
47
+ [*.{cs,vb}]
48
+ # Sort using and Import directives with System.* appearing first
49
+ dotnet_sort_system_directives_first = true
50
+ # Avoid "this." and "Me." if not necessary
51
+ dotnet_style_qualification_for_field = false:suggestion
52
+ dotnet_style_qualification_for_property = false:suggestion
53
+ dotnet_style_qualification_for_method = false:suggestion
54
+ dotnet_style_qualification_for_event = false:suggestion
55
+
56
+ # Use language keywords instead of framework type names for type references
57
+ dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
58
+ dotnet_style_predefined_type_for_member_access = true:suggestion
59
+
60
+ # Suggest more modern language features when available
61
+ dotnet_style_object_initializer = true:suggestion
62
+ dotnet_style_collection_initializer = true:suggestion
63
+ dotnet_style_coalesce_expression = true:suggestion
64
+ dotnet_style_null_propagation = true:suggestion
65
+ dotnet_style_explicit_tuple_names = true:suggestion
66
+
67
+ # Prefix private members with underscore
68
+ dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
69
+ dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
70
+ dotnet_naming_rule.private_members_with_underscore.severity = suggestion
71
+
72
+ dotnet_naming_symbols.private_fields.applicable_kinds = field
73
+ dotnet_naming_symbols.private_fields.applicable_accessibilities = private
74
+
75
+ dotnet_naming_style.prefix_underscore.capitalization = camel_case
76
+ dotnet_naming_style.prefix_underscore.required_prefix = _
77
+
78
+ # Async methods should have "Async" suffix
79
+ dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods
80
+ dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
81
+ dotnet_naming_rule.async_methods_end_in_async.severity = suggestion
82
+
83
+ dotnet_naming_symbols.any_async_methods.applicable_kinds = method
84
+ dotnet_naming_symbols.any_async_methods.applicable_accessibilities = *
85
+ dotnet_naming_symbols.any_async_methods.required_modifiers = async
86
+
87
+ dotnet_naming_style.end_in_async.required_prefix =
88
+ dotnet_naming_style.end_in_async.required_suffix = Async
89
+ dotnet_naming_style.end_in_async.capitalization = pascal_case
90
+ dotnet_naming_style.end_in_async.word_separator =
91
+
92
+ # Obsolete warnings, this should be removed or changed to warning once we address some of the obsolete items.
93
+ dotnet_diagnostic.CS0618.severity = suggestion
94
+
95
+ # Obsolete warnings, this should be removed or changed to warning once we address some of the obsolete items.
96
+ dotnet_diagnostic.CS0612.severity = suggestion
97
+
98
+ # Remove unnecessary using directives https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005
99
+ dotnet_diagnostic.IDE0005.severity = warning
100
+
101
+ # CSharp code style settings:
102
+ [*.cs]
103
+ # Prefer "var" everywhere
104
+ csharp_style_var_for_built_in_types = true:suggestion
105
+ csharp_style_var_when_type_is_apparent = true:suggestion
106
+ csharp_style_var_elsewhere = true:suggestion
107
+
108
+ # Prefer method-like constructs to have a expression-body
109
+ csharp_style_expression_bodied_methods = true:none
110
+ csharp_style_expression_bodied_constructors = true:none
111
+ csharp_style_expression_bodied_operators = true:none
112
+
113
+ # Prefer property-like constructs to have an expression-body
114
+ csharp_style_expression_bodied_properties = true:none
115
+ csharp_style_expression_bodied_indexers = true:none
116
+ csharp_style_expression_bodied_accessors = true:none
117
+
118
+ # Suggest more modern language features when available
119
+ csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
120
+ csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
121
+ csharp_style_inlined_variable_declaration = true:suggestion
122
+ csharp_style_throw_expression = true:suggestion
123
+ csharp_style_conditional_delegate_call = true:suggestion
124
+
125
+ # Newline settings
126
+ csharp_new_line_before_open_brace = all
127
+ csharp_new_line_before_else = true
128
+ csharp_new_line_before_catch = true
129
+ csharp_new_line_before_finally = true
130
+ csharp_new_line_before_members_in_object_initializers = true
131
+ csharp_new_line_before_members_in_anonymous_types = true
132
+
133
+ # Namespace settings
134
+ csharp_style_namespace_declarations = file_scoped:warning
135
+
136
+ # Switch expression
137
+ dotnet_diagnostic.CS8509.severity = error # missing switch case for named enum value
138
+ dotnet_diagnostic.CS8524.severity = none # missing switch case for unnamed enum value
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,8 @@
1
+ # Please sort into logical groups with comment headers. Sort groups in order of specificity.
2
+ # For example, default owners should always be the first group.
3
+ # Sort lines alphabetically within these groups to avoid accidentally adding duplicates.
4
+ #
5
+ # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
6
+
7
+ # Default file owners
8
+ * @bitwarden/dept-devops
@@ -0,0 +1,14 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Feature Requests
4
+ url: https://community.bitwarden.com/c/feature-requests/
5
+ about: Request new features using the Community Forums. Please search existing feature requests before making a new one.
6
+ - name: Bitwarden Community Forums
7
+ url: https://community.bitwarden.com
8
+ about: Please visit the community forums for general community discussion, support and the development roadmap.
9
+ - name: Customer Support
10
+ url: https://bitwarden.com/contact/
11
+ about: Please contact our customer support for account issues and general customer support.
12
+ - name: Security Issues
13
+ url: https://hackerone.com/bitwarden
14
+ about: We use HackerOne to manage security disclosures.
@@ -0,0 +1,31 @@
1
+ ## 🎟️ Tracking
2
+
3
+ <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. -->
4
+
5
+ ## 📔 Objective
6
+
7
+ <!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. -->
8
+
9
+ ## ⏰ Reminders before review
10
+
11
+ - Contributor guidelines followed
12
+ - All formatters and local linters executed and passed
13
+ - Written new unit and / or integration tests where applicable
14
+ - Protected functional changes with optionality (feature flags)
15
+ - Used internationalization (i18n) for all UI strings
16
+ - CI builds passed
17
+ - Communicated to DevOps any deployment requirements
18
+ - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team
19
+
20
+ ## 🦮 Reviewer guidelines
21
+
22
+ <!-- Suggested interactions but feel free to use (or not) as you desire! -->
23
+
24
+ - 👍 (`:+1:`) or similar for great changes
25
+ - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info
26
+ - ❓ (`:question:`) for questions
27
+ - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
28
+ - 🎨 (`:art:`) for suggestions / improvements
29
+ - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention
30
+ - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt
31
+ - ⛏ (`:pick:`) for minor or nitpick changes
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": ["github>bitwarden/renovate-config"],
4
+ "enabledManagers": ["github-actions", "npm", "pipenv"],
5
+ "packageRules": [
6
+ {
7
+ "groupName": "gh minor",
8
+ "matchManagers": ["github-actions"],
9
+ "matchUpdateTypes": ["minor", "patch"]
10
+ },
11
+ {
12
+ "groupName": "npm minor",
13
+ "matchManagers": ["npm"],
14
+ "matchUpdateTypes": ["minor", "patch"]
15
+ },
16
+ {
17
+ "groupName": "pipenv minor",
18
+ "matchManagers": ["pipenv"],
19
+ "matchUpdateTypes": ["minor", "patch"]
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: _version_type
3
+ run-name: Get version type
4
+
5
+ on:
6
+ workflow_call:
7
+ outputs:
8
+ version_bump_type:
9
+ description: "version to be built"
10
+ value: ${{ jobs.version.outputs.bump_type }}
11
+
12
+ jobs:
13
+ version:
14
+ name: Calculate Version
15
+ runs-on: ubuntu-22.04
16
+ outputs:
17
+ bump_type: ${{ steps.bump-type.outputs.type }}
18
+ steps:
19
+ # - name: Get PR ID
20
+ # id: pr
21
+ # env:
22
+ # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23
+ # run: |
24
+ # commit_message=$(
25
+ # curl -s -L \
26
+ # -H "Accept: application/vnd.github+json" \
27
+ # -H "Authorization: Bearer $GH_TOKEN" \
28
+ # -H "X-GitHub-Api-Version: 2022-11-28" \
29
+ # https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} | \
30
+ # jq -r ".commit.message"
31
+ # )
32
+ # ID=$(echo "$commit_message" | head -1 | grep -o "(#.*)" | grep -o "[0-9]*")
33
+ # echo "id=$ID" >> $GITHUB_OUTPUT
34
+
35
+ - name: Get version bump type
36
+ id: bump-type
37
+ env:
38
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39
+ PR_NUMBER: ${{ steps.pr.outputs.id }}
40
+ run: |
41
+ # version_tag=$(
42
+ # curl -s -L \
43
+ # -H "Accept: application/vnd.github+json" \
44
+ # -H "Authorization: Bearer $GH_TOKEN" \
45
+ # -H "X-GitHub-Api-Version: 2022-11-28" \
46
+ # https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels | \
47
+ # jq -r ".[].name" | grep "version"
48
+ # )
49
+
50
+ version_tag="version:patch"
51
+
52
+ # Single Version label Enforcement (should go in CI...)
53
+ if [[ $(echo $version_tag | wc -w) -gt 1 ]]; then
54
+ echo "[!] multiple version labels found!"
55
+ exit 1
56
+ fi
57
+
58
+ version_type=$(echo $version_tag | cut -d ":" -f 2)
59
+ echo "Version Bump Type: $version_type"
60
+ echo "type=$version_type" >> $GITHUB_OUTPUT
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: CD
3
+ run-name: CD ${{ inputs.release_type }}
4
+
5
+ on:
6
+ push:
7
+ branches:
8
+ - main
9
+ paths:
10
+ - "src/**"
11
+ workflow_dispatch:
12
+ inputs:
13
+ release_type:
14
+ description: 'Release type'
15
+ required: true
16
+ type: choice
17
+ default: 'Dry Run'
18
+ options:
19
+ - 'Dry Run'
20
+ - 'Release'
21
+
22
+ jobs:
23
+ version-type:
24
+ uses: ./.github/workflows/_version_type.yml
25
+
26
+ version-bump:
27
+ name: Version bump
28
+ runs-on: ubuntu-22.04
29
+ needs: version-type
30
+ outputs:
31
+ version: ${{ steps.get-version.outputs.version }}
32
+ steps:
33
+ - name: Check out repo
34
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
35
+
36
+ - name: Set up Python
37
+ uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
38
+ with:
39
+ python-version-file: ".python-version"
40
+
41
+ - name: Install hatch
42
+ run: pip install hatch
43
+
44
+ - name: Get current version
45
+ run: echo "OLD_VERSION=$(hatch version)" >> $GITHUB_ENV
46
+
47
+ - name: Bump version
48
+ run: hatch version ${{ needs.version-type.outputs.version_bump_type }}
49
+
50
+ - name: Get bumped version
51
+ id: get-version
52
+ run: |
53
+ VERSION=$(hatch version)
54
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
55
+
56
+ - name: Login to Azure - CI Subscription
57
+ uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
58
+ with:
59
+ creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
60
+
61
+ - name: Retrieve secrets
62
+ id: retrieve-secrets
63
+ uses: bitwarden/gh-actions/get-keyvault-secrets@main
64
+ with:
65
+ keyvault: "bitwarden-ci"
66
+ secrets: "github-gpg-private-key,
67
+ github-gpg-private-key-passphrase,
68
+ github-pat-bitwarden-devops-bot-repo-scope"
69
+
70
+ - name: Import GPG key
71
+ uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
72
+ with:
73
+ gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
74
+ passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
75
+ git_user_signingkey: true
76
+ git_commit_gpgsign: true
77
+
78
+ - name: Setup git
79
+ run: |
80
+ git config --local user.email "106330231+bitwarden-devops-bot@users.noreply.github.com"
81
+ git config --local user.name "bitwarden-devops-bot"
82
+
83
+ - name: Commit version bump
84
+ env:
85
+ OLD_VERSION: ${{ env.OLD_VERSION }}
86
+ VERSION: ${{ steps.get-version.outputs.version }}
87
+ if: ${{ github.event_name == 'push' }} || ${{ inputs.release_type != 'Dry Run' }}
88
+ run: |
89
+ git commit -am "Bump version from $OLD_VERSION to $VERSION"
90
+ git tag $VERSION
91
+ git push
92
+ git push --tags
93
+
94
+ release:
95
+ name: GitHub release
96
+ runs-on: ubuntu-22.04
97
+ needs: version-bump
98
+ if: ${{ github.event_name == 'push' }} || ${{ inputs.release_type != 'Dry Run' }}
99
+ steps:
100
+ - name: Check out repo
101
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
102
+
103
+ - name: Create GitHub release
104
+ uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
105
+ with:
106
+ commit: ${{ github.sha }}
107
+ tag: v${{ steps.version-bump.outputs.version }}
108
+ name: Version version-bump
109
+ token: ${{ secrets.GITHUB_TOKEN }}
110
+ draft: false
111
+
112
+ deploy:
113
+ name: Deploy workflow-linter (v2)
114
+ runs-on: ubuntu-22.04
115
+ needs: version-bump
116
+ steps:
117
+ - name: Check out repo
118
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
119
+
120
+ - name: Set up Python
121
+ uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
122
+ with:
123
+ python-version-file: ".python-version"
124
+
125
+ - name: Install hatch
126
+ run: pip install hatch
127
+
128
+ - name: Login to Azure - CI Subscription
129
+ uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
130
+ with:
131
+ creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
132
+
133
+ - name: Retrieve pypi api token
134
+ id: retrieve-secret
135
+ uses: bitwarden/gh-actions/get-keyvault-secrets@main
136
+ with:
137
+ keyvault: "bitwarden-ci"
138
+ secrets: "pypi-api-token,
139
+ pypi-test-api-token"
140
+
141
+ - name: Build
142
+ run: hatch build
143
+
144
+ - name: Publish
145
+ if: ${{ github.event_name == 'push' }} || ${{ inputs.release_type != 'Dry Run' }}
146
+ env:
147
+ HATCH_INDEX_USER: __token__
148
+ HATCH_INDEX_AUTH: ${{ steps.retrieve-secret.outputs.pypi-api-token }}
149
+ run: hatch publish
150
+
151
+ - name: Dry Run - Publish
152
+ if: ${{ github.event_name == 'workflow_dispatch' }} && ${{ inputs.release_type == 'Dry Run' }}
153
+ env:
154
+ HATCH_INDEX_USER: __token__
155
+ HATCH_INDEX_AUTH: ${{ steps.retrieve-secret.outputs.pypi-test-api-token }}
156
+ run: hatch publish -r test
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - "src/**"
7
+ - "tests/**"
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ test:
12
+ name: CI workflow-linter (v2)
13
+ runs-on: ubuntu-22.04
14
+ steps:
15
+ - name: Check out repo
16
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
20
+ with:
21
+ python-version-file: ".python-version"
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install pipenv
27
+ pipenv install --dev
28
+
29
+ - name: Run pytest
30
+ run: pipenv run pytest tests --cov=src
31
+
32
+ - name: Check type hinting
33
+ run: pipenv run pytype src
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: Enforce PR labels
3
+
4
+ on:
5
+ pull_request:
6
+ types: [labeled, unlabeled, opened, reopened, synchronize]
7
+ jobs:
8
+ enforce-labels:
9
+ uses: bitwarden/gh-actions/.github/workflows/_enforce-labels.yml@main
10
+
11
+ enforce-version-label:
12
+ if: ${{ !contains(github.event.*.labels.*.name, 'version') }}
13
+ name: Enforce version label
14
+ runs-on: ubuntu-22.04
15
+
16
+ steps:
17
+ - name: Check for label
18
+ run: |
19
+ echo "PR without the version label cannot be merged."
20
+ echo "### :x: PR without the version label cannot be merged" >> $GITHUB_STEP_SUMMARY
21
+ exit 1
@@ -0,0 +1,78 @@
1
+ name: Scan
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches:
7
+ - "main"
8
+ - "rc"
9
+ - "hotfix-rc"
10
+ pull_request_target:
11
+ types: [opened, synchronize]
12
+
13
+ jobs:
14
+ check-run:
15
+ name: Check PR run
16
+ uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main
17
+
18
+ sast:
19
+ name: SAST scan
20
+ runs-on: ubuntu-22.04
21
+ needs: check-run
22
+ permissions:
23
+ contents: read
24
+ pull-requests: write
25
+ security-events: write
26
+
27
+ steps:
28
+ - name: Check out repo
29
+ uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
30
+ with:
31
+ ref: ${{ github.event.pull_request.head.sha }}
32
+
33
+ - name: Scan with Checkmarx
34
+ uses: checkmarx/ast-github-action@831a8d51a8a0535c0399f9c12728d8d3cc22d850 # 2.0.28
35
+ env:
36
+ INCREMENTAL: "${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}"
37
+ with:
38
+ project_name: ${{ github.repository }}
39
+ cx_tenant: ${{ secrets.CHECKMARX_TENANT }}
40
+ base_uri: https://ast.checkmarx.net/
41
+ cx_client_id: ${{ secrets.CHECKMARX_CLIENT_ID }}
42
+ cx_client_secret: ${{ secrets.CHECKMARX_SECRET }}
43
+ additional_params: |
44
+ --report-format sarif \
45
+ --filter "state=TO_VERIFY;PROPOSED_NOT_EXPLOITABLE;CONFIRMED;URGENT" \
46
+ --output-path . ${{ env.INCREMENTAL }}
47
+
48
+ - name: Upload Checkmarx results to GitHub
49
+ uses: github/codeql-action/upload-sarif@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
50
+ with:
51
+ sarif_file: cx_result.sarif
52
+
53
+ quality:
54
+ name: Quality scan
55
+ runs-on: ubuntu-22.04
56
+ needs: check-run
57
+ permissions:
58
+ contents: read
59
+ pull-requests: write
60
+
61
+ steps:
62
+ - name: Check out repo
63
+ uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
64
+ with:
65
+ fetch-depth: 0
66
+ ref: ${{ github.event.pull_request.head.sha }}
67
+
68
+ - name: Scan with SonarCloud
69
+ uses: sonarsource/sonarcloud-github-action@4006f663ecaf1f8093e8e4abb9227f6041f52216 # v2.2.0
70
+ env:
71
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
72
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73
+ with:
74
+ args: >
75
+ -Dsonar.organization=${{ github.repository_owner }}
76
+ -Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }}
77
+ -Dsonar.sources=src/
78
+ -Dsonar.tests=tests/
@@ -0,0 +1,32 @@
1
+ # General
2
+ .DS_Store
3
+ Thumbs.db
4
+
5
+ # IDEs and editors
6
+ .idea/
7
+ .project
8
+ .classpath
9
+ .c9/
10
+ *.launch
11
+ .settings/
12
+ *.sublime-workspace
13
+
14
+ # Visual Studio Code
15
+ .vscode/*
16
+ !.vscode/settings.json
17
+ !.vscode/tasks.json
18
+ !.vscode/launch.json
19
+ !.vscode/extensions.json
20
+ .history/*
21
+
22
+ # Node
23
+ node_modules
24
+ npm-debug.log
25
+
26
+ # Project Specific
27
+ .coverage
28
+ dist
29
+
30
+ ## Dev Environments
31
+ Session.vim
32
+ flake.*
@@ -0,0 +1 @@
1
+ npx lint-staged
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,3 @@
1
+ # How to Contribute
2
+
3
+ Our [Contributing Guidelines](https://contributing.bitwarden.com/contributing/) are located in our [Contributing Documentation](https://contributing.bitwarden.com/). The documentation also includes recommended tooling, code style tips, and lots of other great information to get you started.