chore(docs): versionsrad v0.7.0 (#18) #63
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 + test + lint på varje PR och push till huvudbranchar. | |
| # Jobben är toleranta: tills backend/ resp. frontend/ finns hoppar de över | |
| # build/test så grund-commiten är grön. När koden landar blir de en riktig gate. | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| backend: | |
| name: Backend (.NET) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Hitta .NET-lösning | |
| id: detect | |
| run: | | |
| if [ -n "$(find backend -name '*.csproj' 2>/dev/null | head -1)" ]; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| echo "::notice::Ingen backend ännu — hoppar över .NET-build/test." | |
| fi | |
| - name: Setup .NET 10 | |
| if: steps.detect.outputs.exists == 'true' | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Restore | |
| if: steps.detect.outputs.exists == 'true' | |
| working-directory: backend | |
| run: dotnet restore | |
| - name: Build | |
| if: steps.detect.outputs.exists == 'true' | |
| working-directory: backend | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Test | |
| if: steps.detect.outputs.exists == 'true' | |
| working-directory: backend | |
| run: dotnet test --no-build --configuration Release --verbosity normal | |
| frontend: | |
| name: Frontend (React/Vite) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Hitta frontend | |
| id: detect | |
| run: | | |
| if [ -f frontend/package.json ]; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| echo "::notice::Ingen frontend ännu — hoppar över npm-build/test." | |
| fi | |
| - name: Setup Node | |
| if: steps.detect.outputs.exists == 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install | |
| if: steps.detect.outputs.exists == 'true' | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Lint | |
| if: steps.detect.outputs.exists == 'true' | |
| working-directory: frontend | |
| run: npm run lint --if-present | |
| - name: Test | |
| if: steps.detect.outputs.exists == 'true' | |
| working-directory: frontend | |
| run: npm test --if-present | |
| - name: Build | |
| if: steps.detect.outputs.exists == 'true' | |
| working-directory: frontend | |
| run: npm run build --if-present | |
| e2e: | |
| name: E2E (Playwright mot compose-stacken) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Starta stacken | |
| run: docker compose up -d --build | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Installera Playwright | |
| working-directory: frontend | |
| run: | | |
| npm ci | |
| npx playwright install chromium --with-deps | |
| - name: Vänta på API:t | |
| run: | | |
| for i in $(seq 1 30); do | |
| curl -fsS http://localhost:5080/health/ready && exit 0 || sleep 2 | |
| done | |
| echo "API:t blev aldrig redo"; docker compose logs api; exit 1 | |
| - name: Kör E2E | |
| working-directory: frontend | |
| run: npx playwright test | |
| - name: Ladda upp rapport vid fel | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: frontend/playwright-report | |
| retention-days: 7 | |
| - name: Stäng stacken | |
| if: always() | |
| run: docker compose down -v |