diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml deleted file mode 100644 index 04a0a4bb..00000000 --- a/.github/workflows/build_and_test.yml +++ /dev/null @@ -1,240 +0,0 @@ -name: Build and Test - -on: - pull_request: - branches: - - master - push: - branches: - - master - -jobs: - build_module: - name: Build Module - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup PowerShell module cache - id: cacher - uses: actions/cache@v3 - with: - path: "~/.local/share/powershell/Modules" - key: ${{ runner.os }}-PSModules - - name: Setup - shell: pwsh - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo - - name: Build - shell: pwsh - run: | - Invoke-Build -Task Clean, Build - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: Release - path: ./Release/ - - test_on_windows_v5: - name: Test Module on Windows (PS v5) - needs: build_module - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: Download - uses: actions/download-artifact@v3 - with: - name: Release - path: ./Release/ - - name: Setup PowerShell module cache - id: cacher - uses: actions/cache@v3 - with: - path: "~/.local/share/powershell/Modules" - key: ${{ runner.os }}-PSModules - - name: Setup - shell: powershell - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo - - name: Test - shell: powershell - run: | - Invoke-Build -Task Test - - name: Upload test results - uses: actions/upload-artifact@v3 - with: - name: ${{ runner.os }}-Unit-Tests - path: Test*.xml - if: ${{ always() }} - - test_on_windows_v7: - name: Test Module on Windows (PS v7) - needs: build_module - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: Download - uses: actions/download-artifact@v3 - with: - name: Release - path: ./Release/ - - name: Setup PowerShell module cache - id: cacher - uses: actions/cache@v3 - with: - path: "~/.local/share/powershell/Modules" - key: ${{ runner.os }}-PSModules - - name: Setup - shell: pwsh - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo - - name: Test - shell: pwsh - run: | - Invoke-Build -Task Test - - name: Upload test results - uses: actions/upload-artifact@v3 - with: - name: ${{ runner.os }}-Unit-Tests - path: Test*.xml - if: ${{ always() }} - - test_on_ubuntu: - name: Test Module on Ubuntu - needs: build_module - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Download - uses: actions/download-artifact@v3 - with: - name: Release - path: ./Release/ - - name: Setup PowerShell module cache - id: cacher - uses: actions/cache@v3 - with: - path: "~/.local/share/powershell/Modules" - key: ${{ runner.os }}-PSModules - - name: Setup - shell: pwsh - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo - - name: Test - shell: pwsh - run: | - Invoke-Build -Task Test - - name: Upload test results - uses: actions/upload-artifact@v3 - with: - name: ${{ runner.os }}-Unit-Tests - path: Test*.xml - if: ${{ always() }} - - test_on_macos: - name: Test Module on macOS - needs: build_module - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: Download - uses: actions/download-artifact@v3 - with: - name: Release - path: ./Release/ - - name: Setup PowerShell module cache - id: cacher - uses: actions/cache@v3 - with: - path: "~/.local/share/powershell/Modules" - key: ${{ runner.os }}-PSModules - - name: Setup - shell: pwsh - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo - - name: Test - shell: pwsh - run: | - Invoke-Build -Task Test - - name: Upload test results - uses: actions/upload-artifact@v3 - with: - name: ${{ runner.os }}-Unit-Tests - path: Test*.xml - if: ${{ always() }} - - test_against_cloud: - env: - JiraURI: ${{ secrets.JiraURI }} - JiraUser: ${{ secrets.JiraUser }} - JiraPass: ${{ secrets.JiraPass }} - name: Test Module against Cloud Server - needs: build_module - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Download - uses: actions/download-artifact@v3 - with: - name: Release - path: ./Release/ - - name: Setup PowerShell module cache - id: cacher - uses: actions/cache@v3 - with: - path: "~/.local/share/powershell/Modules" - key: ${{ runner.os }}-PSModules - - name: Setup - shell: pwsh - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo - - name: Test - shell: pwsh - run: | - Invoke-Build -Task Test -Tag "Integration" -ExcludeTag "" - if: ${{ env.JiraURI != '' }} - - name: Upload test results - uses: actions/upload-artifact@v3 - with: - name: ${{ runner.os }}-Unit-Tests - path: Test*.xml - if: ${{ always() }} - - package: - name: Package - needs: [build_module, test_on_windows_v5, test_on_windows_v7, test_on_ubuntu, test_on_macos, test_against_cloud] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Download - uses: actions/download-artifact@v3 - with: - name: Release - path: ./Release/ - - name: Setup PowerShell module cache - id: cacher - uses: actions/cache@v3 - with: - path: "~/.local/share/powershell/Modules" - key: ${{ runner.os }}-PSModules - - name: Setup - shell: pwsh - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo - - name: Package - shell: pwsh - run: | - Invoke-Build -Task Package - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: JiraPS.zip - path: ./Release/JiraPS.zip - if: ${{ success() }} - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2df0ce6d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,109 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/cache@v3 + id: cacher + with: + path: "~/.local/share/powershell/Modules" + key: ${{ runner.os }}-PSModules + + - name: Setup + shell: pwsh + run: | + ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + + - name: Build + shell: pwsh + run: | + Invoke-Build -Task Clean, Build + + - uses: actions/upload-artifact@v4 + with: + name: Release + path: ./Release/ + + test: + needs: build + + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + shell: [pwsh, pwsh-preview] + include: + - os: windows-latest + shell: powershell + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: Release + path: ./Release/ + + - uses: actions/cache@v3 + id: cacher + with: + path: "~/.local/share/powershell/Modules" + key: ${{ runner.os }}-PSModules + + - name: Setup + run: ${{ matrix.shell }} -c ". ./Tools/setup.ps1; Invoke-Build -Task ShowInfo" + + - name: Test + run: ${{ matrix.shell }} -c "Invoke-Build -Task Test" + + - uses: actions/upload-artifact@v4 + with: + name: ${{ runner.os }}-${{ matrix.shell }}-Unit-Tests + path: Test*.xml + if-no-files-found: error + + # test_against_cloud: + # env: + # JiraURI: ${{ secrets.JiraURI }} + # JiraUser: ${{ secrets.JiraUser }} + # JiraPass: ${{ secrets.JiraPass }} + # name: Test Module against Cloud Server + # needs: build + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - name: Download + # uses: actions/download-artifact@v4 + # with: + # name: Release + # path: ./Release/ + # - name: Setup PowerShell module cache + # id: cacher + # uses: actions/cache@v3 + # with: + # path: "~/.local/share/powershell/Modules" + # key: ${{ runner.os }}-PSModules + # - name: Setup + # shell: pwsh + # run: | + # ./Tools/setup.ps1 + # Invoke-Build -Task ShowInfo + # - name: Test + # shell: pwsh + # run: | + # Invoke-Build -Task Test -Tag "Integration" -ExcludeTag "" + # if: ${{ env.JiraURI != '' }} + # - name: Upload test results + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ runner.os }}-Unit-Tests + # path: Test*.xml + # if: ${{ always() }} diff --git a/JiraPS.build.ps1 b/JiraPS.build.ps1 index 7d125374..f6001407 100644 --- a/JiraPS.build.ps1 +++ b/JiraPS.build.ps1 @@ -203,15 +203,6 @@ task UpdateManifest GetNextVersion, { } -# Synopsis: Create a ZIP file with this build -task Package Init, { - Assert-True { Test-Path "$env:BHBuildOutput\$env:BHProjectName" } "Missing files to package" - - Remove-Item "$env:BHBuildOutput\$env:BHProjectName.zip" -ErrorAction SilentlyContinue - $null = Compress-Archive -Path "$env:BHBuildOutput\$env:BHProjectName" -DestinationPath "$env:BHBuildOutput\$env:BHProjectName.zip" -} -#endregion BuildRelease - #region Test task Test Init, { Assert-True { Test-Path $env:BHBuildOutput -PathType Container } "Release path must exist"