From 0f30b68ead10016dbaa81e1b122399d567ad08a5 Mon Sep 17 00:00:00 2001 From: David Chalco Date: Fri, 18 Dec 2020 03:49:05 -0800 Subject: [PATCH] enable compatibility with git action + create autorelease action --- .github/scripts/kernel_checker.py | 10 ++++++---- .../{release-packager.yml => auto-release.yml} | 13 +++++++------ .../{header-checks.yml => kernel-checks.yml} | 10 +++++----- 3 files changed, 18 insertions(+), 15 deletions(-) rename .github/workflows/{release-packager.yml => auto-release.yml} (79%) rename .github/workflows/{header-checks.yml => kernel-checks.yml} (88%) diff --git a/.github/scripts/kernel_checker.py b/.github/scripts/kernel_checker.py index 46d93c1e0..3d96d05fc 100755 --- a/.github/scripts/kernel_checker.py +++ b/.github/scripts/kernel_checker.py @@ -29,7 +29,9 @@ KERNEL_IGNORED_EXTENSIONS = [ '.sh' ] -KERNEL_IGNORED_PATTERNS = [r'.*\.git.*'] +KERNEL_IGNORED_PATTERNS = [ + r'.*\.git.*' +] KERNEL_HEADER = [ '/*\n', @@ -62,15 +64,15 @@ KERNEL_HEADER = [ def main(): parser = HeaderChecker.configArgParser() + args = parser.parse_args() + # Configure the checks then run checker = HeaderChecker(KERNEL_HEADER) checker.ignoreExtension(*KERNEL_IGNORED_EXTENSIONS) checker.ignorePattern(*KERNEL_IGNORED_PATTERNS) - checker.ignoreFile(os.path.split(__file__)[-1]) - n_failed = 0 - return n_failed + return checker.processArgs(args) if __name__ == '__main__': exit(main()) diff --git a/.github/workflows/release-packager.yml b/.github/workflows/auto-release.yml similarity index 79% rename from .github/workflows/release-packager.yml rename to .github/workflows/auto-release.yml index 36cf89792..18712c464 100644 --- a/.github/workflows/release-packager.yml +++ b/.github/workflows/auto-release.yml @@ -26,18 +26,19 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Currently FreeRTOS/.github/scripts houses the release script. Download it for upcoming usage - name: Checkout FreeRTOS Release Tools uses: actions/checkout@v2 with: - repository: dachalco/FreeRTOS # TODO: This is only for my debugging. Before merging upstream this should be updated - ref: autorelease/enhancements + repository: FreeRTOS/FreeRTOS path: tools - token: ${{ secrets.GITHUB_TOKEN }} - + + # Simpler git auth if we use checkout action and forward the repo to release script - name: Checkout FreeRTOS Kernel uses: actions/checkout@v2 with: path: local_kernel + fetch-depth: 0 - name: Release run: | @@ -45,9 +46,9 @@ jobs: git config --global user.name ${{ github.actor }} git config --global user.email ${{ github.actor }}@users.noreply.github.com - # Run the release script + # Install deps and run pip install -r ./tools/.github/scripts/release-requirements.txt - ./tools/.github/scripts/release.py dachalco --kernel-repo-path=local_kernel --kernel-commit=${{ github.event.inputs.commit_id }} --new-kernel-version=${{ github.event.inputs.version_number }} + ./tools/.github/scripts/release.py FreeRTOS --kernel-repo-path=local_kernel --kernel-commit=${{ github.event.inputs.commit_id }} --new-kernel-version=${{ github.event.inputs.version_number }} exit $? env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/header-checks.yml b/.github/workflows/kernel-checks.yml similarity index 88% rename from .github/workflows/header-checks.yml rename to .github/workflows/kernel-checks.yml index 33e32bb91..8c644873d 100644 --- a/.github/workflows/header-checks.yml +++ b/.github/workflows/kernel-checks.yml @@ -1,10 +1,10 @@ -name: FreeRTOS-Header-Checker +name: Kernel-Checker on: [pull_request] jobs: - header-checker: - name: File Header Checks + kernel-checker: + name: FreeRTOS Kernel Header Checks runs-on: ubuntu-latest steps: # Install python 3 @@ -36,12 +36,12 @@ jobs: uses: lots0logs/gh-action-get-changed-files@2.1.4 with: token: ${{ secrets.GITHUB_TOKEN }} - + # Run checks - name: Check File Headers run: | + mv tools/.github/scripts/common inspect/.github/scripts cd inspect - export PYTHONPATH=../tools/.github/scripts:${PYTHONPATH} .github/scripts/kernel_checker.py --json ${HOME}/files_modified.json ${HOME}/files_added.json ${HOME}/files_renamed.json exit $?