|
| 1 | +name: Pipeline workflow |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout repo |
| 17 | + uses: actions/checkout@v3 |
| 18 | + |
| 19 | + - name: Install libssl |
| 20 | + run: | |
| 21 | + sudo apt-get update |
| 22 | + sudo apt-get install -y libssl-dev |
| 23 | +
|
| 24 | + - name: Setup .NET SDK |
| 25 | + uses: actions/setup-dotnet@v3 |
| 26 | + with: |
| 27 | + dotnet-version: '6.0.x' |
| 28 | + |
| 29 | + - name: Restore dependencies |
| 30 | + run: dotnet restore |
| 31 | + |
| 32 | + - name: Install Playwright CLI tool |
| 33 | + run: dotnet tool install --global Microsoft.Playwright.CLI |
| 34 | + |
| 35 | + - name: Install Playwright NuGet package |
| 36 | + run: dotnet add package Microsoft.Playwright |
| 37 | + |
| 38 | + - name: Install Allure NUnit Logger |
| 39 | + run: dotnet add package Allure.NUnit |
| 40 | + |
| 41 | + - name: Build project |
| 42 | + run: dotnet build |
| 43 | + |
| 44 | + - name: Install Chromium |
| 45 | + run: playwright install chromium |
| 46 | + |
| 47 | + - name: Clean allure-results folder |
| 48 | + run: rm -rf TestResults/allure-results |
| 49 | + |
| 50 | + - name: Run tests |
| 51 | + run: dotnet test --no-build |
| 52 | + continue-on-error: true |
| 53 | + |
| 54 | + - name: Install Allure CLI |
| 55 | + run: npm install -g allure-commandline --save-dev |
| 56 | + |
| 57 | + - name: Copy Allure results from any folder |
| 58 | + if: ${{ always() }} |
| 59 | + run: | |
| 60 | + mkdir -p TestResults/allure-results |
| 61 | + found=0 |
| 62 | + for dir in $(find . -type d -name allure-results); do |
| 63 | + cp -r "$dir"/* TestResults/allure-results/ 2>/dev/null || true |
| 64 | + found=1 |
| 65 | + done |
| 66 | + if [ $found -eq 0 ]; then |
| 67 | + echo "No Allure results found" |
| 68 | + fi |
| 69 | +
|
| 70 | + - name: Generate Allure Report |
| 71 | + if: ${{ always() }} |
| 72 | + run: | |
| 73 | + allure generate TestResults/allure-results --clean -o TestResults/allure-report |
| 74 | +
|
| 75 | + - name: Debug - Check allure-results folder |
| 76 | + if: ${{ always() }} |
| 77 | + run: ls -al TestResults/allure-results/ || echo "Folder does not exist or is empty" |
| 78 | + |
| 79 | + - name: Upload artifacts |
| 80 | + if: ${{ always() }} |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: allure-report |
| 84 | + path: TestResults/allure-report |
0 commit comments