diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3639fd8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + web-app: + name: Web app (Jest + build) + runs-on: ubuntu-latest + defaults: + run: + working-directory: Workfolder/web-app-react + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version: 22 + cache: npm + cache-dependency-path: Workfolder/web-app-react/package-lock.json + - run: npm ci + - name: Jest + run: npm test -- --watchAll=false + env: + CI: true + - name: Build + run: npm run build + env: + CI: true + + powershell: + name: PowerShell module (Pester) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - name: Install Pester and ImportExcel + shell: pwsh + run: | + Set-PSRepository PSGallery -InstallationPolicy Trusted + Install-Module Pester -MinimumVersion 5.0 -Scope CurrentUser -Force -SkipPublisherCheck + Install-Module ImportExcel -Scope CurrentUser -Force + - name: Pester + shell: pwsh + run: | + $cfg = New-PesterConfiguration + $cfg.Run.Path = './Workfolder/powershell/tests' + $cfg.Run.Exit = $true + $cfg.Output.Verbosity = 'Detailed' + $cfg.TestResult.Enabled = $true + $cfg.TestResult.OutputPath = 'pester-results.xml' + Invoke-Pester -Configuration $cfg + - name: Upload Pester results + if: always() + uses: actions/upload-artifact@v7 + with: + name: pester-results + path: pester-results.xml diff --git a/README.md b/README.md index c8cc8e2..3a781ab 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # RoadRouteCardMaker +[![CI](https://github.com/PowerShellYoungTeam/RoadRouteCardMaker/actions/workflows/ci.yml/badge.svg)](https://github.com/PowerShellYoungTeam/RoadRouteCardMaker/actions/workflows/ci.yml) + Plan a road move on OpenStreetMap and produce a military-style **route card**: the INSTRUCTIONS block (items 1-16, short-form field book wording) plus the ROUTE DETAILS table. It is built with big and heavy vehicles in mind and flags height, weight and width limits along the route. @@ -76,6 +78,9 @@ cd Workfolder\web-app-react; npm test # Jest unit tes Invoke-Pester .\Workfolder\powershell\tests -Output Detailed # Pester 5 ``` +GitHub Actions ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)) runs Jest, the production build and +Pester on every pull request and push to `main`. + On Windows, Jest finds no tests if the repo path contains `\.` (for example `C:\Users\me\.copilot\...`). Clone the repo to a plain path such as `C:\dev\` to run them.