Merge pull request 'Update deploy workflow to use 'master' branch and add unit tests for deployment triggers' (#4) from firmware_deploy into master
All checks were successful
Deploy firmware via FTP (master) / Build and FTP Sync (push) Successful in 3m31s
All checks were successful
Deploy firmware via FTP (master) / Build and FTP Sync (push) Successful in 3m31s
Reviewed-on: #4
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
name: Deploy firmware via FTP (main)
|
name: Deploy firmware via FTP (master)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- master
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: deploy-main
|
group: deploy-master
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
23
tests/test_deploy_workflow.py
Normal file
23
tests/test_deploy_workflow.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import re
|
||||||
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
class DeployWorkflowTests(unittest.TestCase):
|
||||||
|
def test_deploy_workflow_triggers_on_master_pushes(self):
|
||||||
|
workflow_path = Path(__file__).resolve().parents[1] / ".gitea" / "workflows" / "deploy-ftp.yml"
|
||||||
|
workflow_text = workflow_path.read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
branch_block_match = re.search(
|
||||||
|
r"on:\s*\n\s*push:\s*\n\s*branches:\s*\n(?P<branches>(?:\s*-\s*[^\n]+\n)+)",
|
||||||
|
workflow_text,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertIsNotNone(branch_block_match, "workflow should define push branches")
|
||||||
|
branches = re.findall(r"-\s*([^\n]+)", branch_block_match.group("branches"))
|
||||||
|
|
||||||
|
self.assertEqual(branches, ["master"])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in New Issue
Block a user