CI_build #825
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
name: CI_build | |
on: | |
# was [push, pull_request, workflow_dispatch] | |
# separated because want to add schedule, which needs a | |
# normal conditions | |
push: | |
pull_request: | |
# on demand, from Actions tab | |
workflow_dispatch: | |
# on schedule (using cron syntax) | |
# 16:00 UTC (8:00am PST) on 6=Saturday | |
schedule: | |
- cron: "0 16 * * 6" | |
jobs: | |
validate: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v5 | |
- name: Install python modules | |
working-directory: . | |
run: python -m pip install -r requirements.txt | |
- name: Validate folders of XML types (UDLs, autoCompletion, functionList) | |
working-directory: . | |
run: python .validators\validator_xml.py | |
- name: Validate json and rebuild udl-list.md | |
working-directory: . | |
run: python .validators\validator_json.py | |
- name: Generate autoCompletion for all UDLs that don't already have one, and revalidate (primary repo + branch only) | |
working-directory: . | |
if: ${{ contains('push workflow_dispatch', github.event_name) && github.ref == 'refs/heads/master' && github.repository == 'notepad-plus-plus/userDefinedLanguages' }} | |
run: | | |
python .validators\generate_ac.py | |
# since AC XML may have been added, re-validate XML | |
python .validators\validator_xml.py | |
# since AC may have been added to JSON, need to revalidate JSON and re-generate md | |
python .validators\validator_json.py | |
- name: Update repo with automated changes for the UDL list and autoCompletions | |
uses: stefanzweifel/git-auto-commit-action@v6 | |
if: contains('push workflow_dispatch', github.event_name) | |
with: | |
commit_message: Automatically re-build udl-list.md and add new autoCompletions | |
unitTest: | |
runs-on: windows-latest | |
needs: validate | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Check for Changes in functionList Files | |
id: get_changes | |
working-directory: . | |
run: | | |
# start assuming no changed FL files | |
$any_changed = $false | |
# | |
# grab the changes | |
if("${{ github.event_name }}" -eq "workflow_dispatch" -or | |
"${{ github.event.before }}" -eq "0000000000000000000000000000000000000000" -or | |
"${{ github.event.after }}" -eq "0000000000000000000000000000000000000000") { | |
#Write-Output "non-push or invalid object: use HEAD~1..HEAD, which isn't as specific, but better than nothing" | |
$changed_files = @( git diff --name-only HEAD~1..HEAD ) | |
} else { | |
#Write-Output "for-push: use before/after" | |
$changed_files = @( git diff --name-only ${{ github.event.before }} ${{ github.event.after }} ) | |
} | |
# | |
# check if each file is in functionList/ directory | |
foreach ($this_file in $changed_files) { | |
#Write-Output "the following is different: $this_file" | |
if ($this_file.Contains("functionList/")) { | |
Write-Output "+ Saw FunctionList changes in: $this_file" | |
$any_changed = $true | |
} | |
} | |
# | |
# set the output | |
if ($any_changed) { | |
echo "is_fl_changed=True" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
} | |
- name: Install Notepad++ | |
if: ${{ steps.get_changes.outputs.is_fl_changed }} | |
uses: crazy-max/ghaction-chocolatey@v3 | |
with: | |
args: install -y notepadplusplus | |
- name: Run FunctionList Unit Tests | |
if: ${{ steps.get_changes.outputs.is_fl_changed }} | |
working-directory: .\Test | |
run: | | |
$PowerEditorSource = "C:\Program Files\Notepad++\" | |
$PowerEditorLocal = ".\PowerEditor" | |
Copy-Item "$PowerEditorSource" -Destination "$PowerEditorLocal\bin" -Recurse -Force | |
New-Item "$PowerEditorLocal\bin\doLocalConf.xml" > $nul | |
New-Item "$PowerEditorLocal\bin\userDefineLangs" -ItemType Directory -ea 0 > $nul | |
python doUnitTests.py $PowerEditorLocal\bin |