From a8d39f422bc377f17732c3fe6728cec22a1dfec2 Mon Sep 17 00:00:00 2001 From: bothzoli Date: Wed, 1 Jul 2020 09:06:20 +0200 Subject: [PATCH] Create GitHub actions CI pipeline for running test scripts (#265) * Create CI pipeline running test scripts * Fix CI definition * Add execute access to test.sh * Fix CI definition * Make test.ps1 go through all exercises * Add git user for submodules kata * Add git user for submodules kata * Fix setup.ps1 for submodules kata * Add MacOS to GitHub actions jobs --- .github/workflows/test.yml | 42 ++++++++++++++++++++++++++++++++++++++ submodules/setup.ps1 | 13 +++++++++++- test.ps1 | 13 +++++++++--- 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..56e46890 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + setup-bash: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run bash test scripts + shell: bash + run: | + chmod +x ./test.sh + ./test.sh + + setup-bash-macos: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run bash test scripts + shell: bash + run: | + chmod +x ./test.sh + ./test.sh + + setup-pwsh: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run PowerShell Core test scripts + run: ./test.ps1 + shell: pwsh diff --git a/submodules/setup.ps1 b/submodules/setup.ps1 index b91e7143..6eb8beb0 100644 --- a/submodules/setup.ps1 +++ b/submodules/setup.ps1 @@ -10,11 +10,17 @@ Set-Location .\exercise # Create remote repo git init --bare remote + +git config --local user.name "git-katas trainer bot" +git config --local user.email "git-katas@example.com" + + # Clone it so that it is ready for the exercise git clone remote component # Commit a file to the component repo & push it to the remote Set-Location .\component + Set-Content -Value "" -Path component.h git add component.h git commit -m "Touch component header" @@ -23,8 +29,13 @@ Set-Location .. # Create a product repo git init product + Set-Location -Path .\product + +git config --local user.name "git-katas trainer bot" +git config --local user.email "git-katas@example.com" + Set-Content -Value "" -Path .\product.h -git add .\product.h +git add . git commit -m "Touch product header" Set-Location .. diff --git a/test.ps1 b/test.ps1 index b4d62623..8cd267b9 100644 --- a/test.ps1 +++ b/test.ps1 @@ -1,3 +1,10 @@ -cd basic-commits -.\setup.ps1 -cd .. \ No newline at end of file +Get-ChildItem -Attributes Directory | + ForEach-Object { + if ($(Get-ChildItem $_.Name setup.ps1)) + { + Push-Location $_.Name + Write-Output "`nRunning setup script for kata $($_.Name)" + .\setup.ps1 + Pop-Location + } + }