Skip to content

Commit

Permalink
Working on CI/CD process
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljolley committed Feb 5, 2024
1 parent 26f2036 commit dc8a211
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,25 @@ on:
workflow_dispatch:

jobs:
build:
# test:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Install prerequisites
# shell: pwsh
# run: |
# ./_build/bootstrap.ps1

# - name: Run Pester tests
# shell: pwsh
# run: |
# Invoke-Pester -Path "./src"

deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -18,11 +36,7 @@ jobs:
shell: pwsh
run: |
. "./_build/build.ps1"
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to PowerShell Gallery
env:
PS_GALLERY_API_KEY: ${{ secrets.PS_GALLERY_API_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ Describe("Invoke-GitHubRepository") {

It("Should throw if branch doesn't exist") {
Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "config" } -MockWith { return $repoUrl }
Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "--show-current" } -MockWith { return "main" }
Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "--show-current" } -MockWith { return "blah" }
Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "-r" } -MockWith { return @("origin/main") }
Mock -CommandName "Start-Process" -MockWith {}

{ Invoke-GitHubRepository -Branch } | Should -Throw -ExpectedMessage "Git branch 'main' does not exist at $repoUrl"
{ Invoke-GitHubRepository -Branch } | Should -Throw -ExpectedMessage "Git branch 'blah' does not exist at $repoUrl"
}
}

0 comments on commit dc8a211

Please sign in to comment.