From c673a181ae91277b5d22cd8439fa2eeabde97bf9 Mon Sep 17 00:00:00 2001 From: Marc R Kellerman <9411143+mkellerman@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:51:27 -0800 Subject: [PATCH 01/10] Add package workflow --- .github/workflows/build_and_test.yml | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 98082eec..04a0a4bb 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -204,3 +204,37 @@ jobs: 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() }} + From 1feb1279ee227cd08e6ab6e39cc58730b4158c84 Mon Sep 17 00:00:00 2001 From: Marc R Kellerman <9411143+mkellerman@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:28:34 -0800 Subject: [PATCH 02/10] Add package and deploy workflow --- .github/workflows/package_deploy.yml | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/package_deploy.yml diff --git a/.github/workflows/package_deploy.yml b/.github/workflows/package_deploy.yml new file mode 100644 index 00000000..19aa3cab --- /dev/null +++ b/.github/workflows/package_deploy.yml @@ -0,0 +1,51 @@ +name: Package and Deploy + +on: + push: + branches: + - feature/package-artifact + workflow_dispatch: + + +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: Package + shell: pwsh + run: | + Invoke-Build -Task Package + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: JiraPS.zip + path: ./Release/JiraPS.zip + - name: Package + shell: pwsh + run: | + Invoke-Build -Task Package + - name: Deploy + if: ${{ github.ref == 'refs/heads/master' }} + shell: pwsh + run: | + # Invoke-Build -Task Deploy + Write-Warning "SKIPPING: Invoke-Build -Task Deploy" + if: ${{ success() }} + From 1239c967eadb5c98732af226856efc111ce55ab5 Mon Sep 17 00:00:00 2001 From: Marc R Kellerman <9411143+mkellerman@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:52:08 -0800 Subject: [PATCH 03/10] Add Prerelease support to UpdateManifest task --- JiraPS.build.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/JiraPS.build.ps1 b/JiraPS.build.ps1 index 8e52c6bc..7d125374 100644 --- a/JiraPS.build.ps1 +++ b/JiraPS.build.ps1 @@ -194,6 +194,13 @@ task UpdateManifest GetNextVersion, { if ($ModuleAlias) { BuildHelpers\Update-Metadata -Path "$env:BHBuildOutput/$env:BHProjectName/$env:BHProjectName.psd1" -PropertyName AliasesToExport -Value @($ModuleAlias.Name) } + + $Prerelease = '' + if ("$env:BHBranchName" -notin @('master','main')) { + $Prerelease = "$env:BHBranchName".ToLower() -replace '[^a-zA-Z0-9]' + } + BuildHelpers\Update-Metadata -Path "$env:BHBuildOutput/$env:BHProjectName/$env:BHProjectName.psd1" -PropertyName Prerelease -Value $Prerelease + } # Synopsis: Create a ZIP file with this build From dbeb881a50ca63845a71ca94d05c1890cbfcff45 Mon Sep 17 00:00:00 2001 From: Marc R Kellerman <9411143+mkellerman@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:52:39 -0800 Subject: [PATCH 04/10] Add Prerelease field to JiraPS.psd1 --- JiraPS/JiraPS.psd1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/JiraPS/JiraPS.psd1 b/JiraPS/JiraPS.psd1 index c57b900b..35bebaa0 100644 --- a/JiraPS/JiraPS.psd1 +++ b/JiraPS/JiraPS.psd1 @@ -113,6 +113,9 @@ # External dependent modules of this module # ExternalModuleDependencies = '' + # Prerelease string of this module + Prerelease = '' + } # End of PSData hashtable } # End of PrivateData hashtable From 417cf59d0b883a0070a791acab369d135aa188d0 Mon Sep 17 00:00:00 2001 From: Marc R Kellerman <9411143+mkellerman@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:52:45 -0800 Subject: [PATCH 05/10] Remove unnecessary steps in package_deploy.yml --- .github/workflows/package_deploy.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/package_deploy.yml b/.github/workflows/package_deploy.yml index 19aa3cab..7042edff 100644 --- a/.github/workflows/package_deploy.yml +++ b/.github/workflows/package_deploy.yml @@ -37,12 +37,7 @@ jobs: with: name: JiraPS.zip path: ./Release/JiraPS.zip - - name: Package - shell: pwsh - run: | - Invoke-Build -Task Package - name: Deploy - if: ${{ github.ref == 'refs/heads/master' }} shell: pwsh run: | # Invoke-Build -Task Deploy From ebe77cb715f3e250b4032b83d17be909013a4c0e Mon Sep 17 00:00:00 2001 From: Marc R Kellerman <9411143+mkellerman@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:56:39 -0800 Subject: [PATCH 06/10] Update workflow to deploy module --- .github/workflows/package_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package_deploy.yml b/.github/workflows/package_deploy.yml index 7042edff..32e53735 100644 --- a/.github/workflows/package_deploy.yml +++ b/.github/workflows/package_deploy.yml @@ -8,8 +8,8 @@ on: jobs: - build_module: - name: Build Module + build_package_deploy: + name: Deploy Module runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 93b30b88a7fcbbe722452789b9959846fd216e45 Mon Sep 17 00:00:00 2001 From: Oliver Lipkau Date: Wed, 20 Dec 2023 11:49:31 +0100 Subject: [PATCH 07/10] POC: Refactored CI pipeline --- .github/workflows/build_and_test.yml | 240 --------------------------- .github/workflows/ci.yml | 90 ++++++++++ .github/workflows/package_deploy.yml | 46 ----- .github/workflows/release.yml | 43 +++++ JiraPS.build.ps1 | 22 +-- 5 files changed, 140 insertions(+), 301 deletions(-) delete mode 100644 .github/workflows/build_and_test.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/package_deploy.yml create mode 100644 .github/workflows/release.yml 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..c6cad18a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: CI + +on: [pull_request] + +defaults: + run: + shell: pwsh + +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 + run: | + ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + + - name: Build + 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] + 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 + if: ${{ always() }} + + # 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: + # ... + # - name: Test + # run: | + # Invoke-Build -Task Test -Tag "Integration" -ExcludeTag "" + # if: ${{ env.JiraURI != '' }} + # ... diff --git a/.github/workflows/package_deploy.yml b/.github/workflows/package_deploy.yml deleted file mode 100644 index 32e53735..00000000 --- a/.github/workflows/package_deploy.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Package and Deploy - -on: - push: - branches: - - feature/package-artifact - workflow_dispatch: - - -jobs: - build_package_deploy: - name: Deploy 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: Package - shell: pwsh - run: | - Invoke-Build -Task Package - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: JiraPS.zip - path: ./Release/JiraPS.zip - - name: Deploy - shell: pwsh - run: | - # Invoke-Build -Task Deploy - Write-Warning "SKIPPING: Invoke-Build -Task Deploy" - if: ${{ success() }} - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..be94a053 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release + +on: + push: + branches: + - feature/package-artifact # TODO: what should be a trigger? + workflow_dispatch: + +defaults: + run: + shell: pwsh + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 # TODO: this file is not available, as it's an artefact from another pipeline + # https://github.com/actions/download-artifact#download-artifacts-from-other-workflow-runs-or-repositories + with: + name: Release + path: ./Release/ + + - uses: actions/cache@v3 + id: cacher + with: + path: "~/.local/share/powershell/Modules" + key: ${{ runner.os }}-PSModules + + - name: Setup + run: | + ./Tools/setup.ps1 + Invoke-Build -Task ShowInfo + + - name: Deploy + env: + NUGET_API_KEY: ${{ secrets.shhh }} # TODO: this is not the correct secret yet. + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Invoke-Build -Task Deploy + Write-Warning "SKIPPING: Invoke-Build -Task Deploy" diff --git a/JiraPS.build.ps1 b/JiraPS.build.ps1 index 7d125374..c4cc35c8 100644 --- a/JiraPS.build.ps1 +++ b/JiraPS.build.ps1 @@ -5,9 +5,7 @@ [System.Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidUsingEmptyCatchBlock', '')] param( [String[]]$Tag, - [String[]]$ExcludeTag = @("Integration"), - [String]$PSGalleryAPIKey, - [String]$GithubAccessToken + [String[]]$ExcludeTag = @("Integration") ) $WarningPreference = "Continue" @@ -168,7 +166,7 @@ task CompileModule Init, { Set-Content -LiteralPath $targetFile -Value $compiled -Encoding UTF8 -Force Remove-Utf8Bom -Path $targetFile - "Private", "Public" | Foreach-Object { Remove-Item -Path "$env:BHBuildOutput/$env:BHProjectName/$_" -Recurse -Force } + "Private", "Public" | ForEach-Object { Remove-Item -Path "$env:BHBuildOutput/$env:BHProjectName/$_" -Recurse -Force } } # Synopsis: Use PlatyPS to generate External-Help @@ -196,22 +194,13 @@ task UpdateManifest GetNextVersion, { } $Prerelease = '' - if ("$env:BHBranchName" -notin @('master','main')) { + if ("$env:BHBranchName" -notin @('master', 'main')) { $Prerelease = "$env:BHBranchName".ToLower() -replace '[^a-zA-Z0-9]' } BuildHelpers\Update-Metadata -Path "$env:BHBuildOutput/$env:BHProjectName/$env:BHProjectName.psd1" -PropertyName Prerelease -Value $Prerelease } -# 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" @@ -253,6 +242,7 @@ task Deploy Init, PublishToGallery, TagReplository, UpdateHomepage # Synpsis: Publish the $release to the PSGallery task PublishToGallery { + $PSGalleryAPIKey = $env:NUGET_API_KEY Assert-True (-not [String]::IsNullOrEmpty($PSGalleryAPIKey)) "No key for the PSGallery" Assert-True { Get-Module $env:BHProjectName -ListAvailable } "Module $env:BHProjectName is not available" @@ -263,6 +253,8 @@ task PublishToGallery { # Synopsis: push a tag with the version to the git repository task TagReplository GetNextVersion, Package, { + $GithubAccessToken = $env:GITHUB_TOKEN + Assert-True (-not [String]::IsNullOrEmpty($GithubAccessToken)) "No key for the PSGallery" $releaseText = "Release version $env:NextBuildVersion" Set-GitUser @@ -284,7 +276,7 @@ task TagReplository GetNextVersion, Package, { Name = "Version $env:NextBuildVersion" ReleaseText = $releaseText RepositoryOwner = "AtlassianPS" - Artifact = "$env:BHBuildOutput\$env:BHProjectName.zip" + Artifact = "$env:BHBuildOutput\$env:BHProjectName.zip" # TODO: probably not the right file } Publish-GithubRelease @release } From cc09a141cd6a9fdd7790d09ac3c4d1e8d786baf0 Mon Sep 17 00:00:00 2001 From: Oliver Lipkau Date: Thu, 21 Dec 2023 10:37:50 +0100 Subject: [PATCH 08/10] testing `workflow_run` for CI to trigger CD --- .github/workflows/{release.yml => cd.yml} | 16 +++++++++------- .github/workflows/ci.yml | 23 ++++++++++++++++++++--- 2 files changed, 29 insertions(+), 10 deletions(-) rename .github/workflows/{release.yml => cd.yml} (67%) diff --git a/.github/workflows/release.yml b/.github/workflows/cd.yml similarity index 67% rename from .github/workflows/release.yml rename to .github/workflows/cd.yml index be94a053..96bf10b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/cd.yml @@ -1,10 +1,11 @@ -name: Release +name: Continous Deployment on: - push: - branches: - - feature/package-artifact # TODO: what should be a trigger? - workflow_dispatch: + workflow_run: + workflows: ["Continous Integration"] + branches: ["master", "feature/package-artifact"] #TODO: remove test branch + types: + - completed defaults: run: @@ -17,11 +18,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 # TODO: this file is not available, as it's an artefact from another pipeline - # https://github.com/actions/download-artifact#download-artifacts-from-other-workflow-runs-or-repositories + - uses: actions/download-artifact@v4 with: name: Release path: ./Release/ + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} - uses: actions/cache@v3 id: cacher diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6cad18a..2e3de958 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,23 @@ -name: CI - -on: [pull_request] +name: Continous Integration + +on: + push: + branches: [master] + paths: + - "docs/**" + - "JiraPS/**" + - "Tests/**" + pull_request: + branches: [master] + paths: + - ".github/workflows/**" + - "docs/**" + - "JiraPS/**" + - "Tests/**" + - "Tools/**" + - "JiraPS.build.ps1" + - "PSScriptAnalyzerSettings.psd1" + workflow_dispatch: defaults: run: From ca217bc07172dcd92bdd9b1d64ab5795fcb24311 Mon Sep 17 00:00:00 2001 From: Oliver Lipkau Date: Thu, 21 Dec 2023 12:20:19 +0100 Subject: [PATCH 09/10] testing caching --- .github/workflows/cd.yml | 10 ++++++---- .github/workflows/ci.yml | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 96bf10b9..e572b7b7 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -28,13 +28,15 @@ jobs: - uses: actions/cache@v3 id: cacher with: - path: "~/.local/share/powershell/Modules" key: ${{ runner.os }}-PSModules + path: "~/.local/share/powershell/Modules" - name: Setup - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo + if: ${{ steps.cacher.outputs.cache-hit != 'true' }} + run: ./Tools/setup.ps1 + + - name: CI Context Info + run: Invoke-Build -Task ShowInfo - name: Deploy env: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e3de958..2428748e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,17 +33,18 @@ jobs: - uses: actions/cache@v3 id: cacher with: - path: "~/.local/share/powershell/Modules" key: ${{ runner.os }}-PSModules + path: "~/.local/share/powershell/Modules" - name: Setup - run: | - ./Tools/setup.ps1 - Invoke-Build -Task ShowInfo + if: ${{ steps.cacher.outputs.cache-hit != 'true' }} + run: ./Tools/setup.ps1 + + - name: CI Context Info + run: Invoke-Build -Task ShowInfo - name: Build - run: | - Invoke-Build -Task Clean, Build + run: Invoke-Build -Task Clean, Build - uses: actions/upload-artifact@v4 with: @@ -51,7 +52,7 @@ jobs: path: ./Release/ test: - needs: build + needs: [build] strategy: matrix: @@ -74,11 +75,15 @@ jobs: - uses: actions/cache@v3 id: cacher with: - path: "~/.local/share/powershell/Modules" key: ${{ runner.os }}-PSModules + path: "~/.local/share/powershell/Modules" - name: Setup - run: ${{ matrix.shell }} -c ". ./Tools/setup.ps1; Invoke-Build -Task ShowInfo" + if: ${{ steps.cacher.outputs.cache-hit != 'true' }} + run: ${{ matrix.shell }} -c ". ./Tools/setup.ps1" + + - name: CI Context Info + run: ${{ matrix.shell }} -c "Invoke-Build -Task ShowInfo" - name: Test run: ${{ matrix.shell }} -c "Invoke-Build -Task Test" @@ -88,7 +93,7 @@ jobs: name: ${{ runner.os }}-${{ matrix.shell }}-Unit-Tests path: Test*.xml if-no-files-found: error - if: ${{ always() }} + if: ${{ always() }} # test_against_cloud: # env: From 248785aca497eb1e860eeafda337ce93996ff200 Mon Sep 17 00:00:00 2001 From: Oliver Lipkau Date: Thu, 21 Dec 2023 14:26:50 +0100 Subject: [PATCH 10/10] Updated pipeline, as I forgot about the `develop` branch --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2428748e..d118465a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,13 @@ name: Continous Integration on: push: - branches: [master] + branches: [master, develop] paths: - "docs/**" - "JiraPS/**" - "Tests/**" pull_request: - branches: [master] + branches: [master, develop] paths: - ".github/workflows/**" - "docs/**"