Skip to content

Commit

Permalink
Chore refactor GitHub Actions workflows
Browse files Browse the repository at this point in the history
- Removed linting and tests from release.yml
- Refactor multiple step names
- Removed multiple comments
  • Loading branch information
vagabondHustler committed Dec 2, 2023
1 parent ff644b7 commit 1474e1f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 86 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ jobs:
matrix:
os: [windows-latest]
python-version: ["3.10.*", "3.11.6"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
20 changes: 1 addition & 19 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "CodeQL"
name: CodeQL

on:
schedule:
Expand All @@ -12,7 +12,6 @@ jobs:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
Expand All @@ -22,31 +21,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'
name: Dependency review
on: [pull_request]

permissions:
Expand All @@ -13,8 +7,10 @@ permissions:
jobs:
dependency-review:
runs-on: ubuntu-latest

steps:
- name: 'Checkout Repository'
- name: Checkout repository
uses: actions/checkout@v4

- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
startsWith(github.head_ref, 'workflow/') ||
startsWith(github.head_ref, 'test/')
runs-on: ubuntu-latest

steps:
- name: Auto label
uses: TimonVS/pr-labeler-action@v4
Expand Down
60 changes: 4 additions & 56 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,68 +26,16 @@ jobs:
echo "past_valid_semver=$(python src/subsearch/data/version.py --get-version)" >> $GITHUB_ENV
echo "local_appdata=${LOCALAPPDATA}" >> $GITHUB_ENV
shell: bash

outputs:
past_valid_semver: "${{ env.past_valid_semver }}"
valid_semver: "${{ env.valid_semver }}"
past_ref_name: "${{ env.past_ref_name }}"
local_appdata: "${{ env.local_appdata }}"

test_tox:
name: Test with tox
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.10.*", "3.11.*"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox

black_isort:
name: Reformat codebase with black & isort
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_config_global: true

- name: Install black & isort
run: |
pip install black
pip install isort
isort ./src --profile 'black'
black ./src -l 125
isort ./tests --profile 'black'
black ./tests -l 125
- name: Push black & isort changes
run: |
git status
git add -A
git commit -S -m "Reformat codebase with black & isort"
git fetch origin main
git push origin HEAD:main

bump_version:
name: Bump version
needs: [variables, test_tox, black_isort]
needs: variables
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -106,10 +54,10 @@ jobs:
git_commit_gpgsign: true
git_config_global: true

- name: Bump version.py
- name: Bump version
run: python scripts/bump_version.py ${{ needs.variables.outputs.valid_semver }}

- name: Push new version
- name: Commit and push
run: |
git status
git add src/subsearch/data/version.py
Expand Down Expand Up @@ -363,7 +311,7 @@ jobs:
run: |
echo "${{ github.ref_name }}" > .github/configs/latest_release.yml
- name: Push origin HEAD:main
- name: Commit and push
run: |
git status
git add .github/configs/latest_release.yml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

jobs:
stale:

runs-on: ubuntu-latest
permissions:
issues: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/virustotal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
v_version=${{ github.ref_name }}
echo "current_version=${v_version:1}" >> $GITHUB_ENV
- name: VirusTotal Scan
- name: VirusTotal scan
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}
Expand Down

0 comments on commit 1474e1f

Please sign in to comment.