Adds an integration test for running with the latest Cake version #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: [push, pull_request] | |
jobs: | |
test-with-script: | |
name: Test with Cake Script | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
env: | |
script-directory: integrationtests/script | |
tools-directory: integrationtests/script/tools | |
steps: | |
- name: Get the sources | |
uses: actions/checkout@v1 | |
- name: Install Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install the .NET 6 SDK | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Run a specific Cake script | |
uses: ./ | |
with: | |
script-path: ${{ env.script-directory }}/build.cake | |
- name: Run a specific target | |
uses: ./ | |
with: | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Successful-Task | |
- name: Remove the tools directory | |
run: rm -rf ${{ env.tools-directory }} | |
shell: bash | |
- name: Run with a specific Cake version | |
env: | |
EXPECTED_CAKE_VERSION: 2.1.0 | |
uses: ./ | |
with: | |
cake-version: 2.1.0 | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Test-Cake-Version | |
- name: Run with a different Cake version in the same build | |
env: | |
EXPECTED_CAKE_VERSION: 2.0.0 | |
uses: ./ | |
with: | |
cake-version: 2.0.0 | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Test-Cake-Version | |
- name: Run with a Cake version set by the tool manifest | |
env: | |
EXPECTED_CAKE_VERSION: 1.2.0 | |
uses: ./ | |
with: | |
cake-version: tool-manifest | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Test-Cake-Version | |
- name: Get the latest Cake release from GitHub | |
id: get-latest-cake-release | |
uses: octokit/request-action@v2.x | |
with: | |
route: GET /repos/cake-build/cake/releases/latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set the EXPECTED_CAKE_VERSION environment variable | |
shell: bash | |
run: | | |
version=$(echo ${{ fromJson(steps.get-latest-cake-release.outputs.data).tag_name }} | sed 's/v//') | |
echo "EXPECTED_CAKE_VERSION=$version" >> $GITHUB_ENV | |
- name: Run with the latest Cake version | |
uses: ./ | |
with: | |
cake-version: latest | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Test-Cake-Version | |
- name: Run automatic bootstrapping of Cake modules (Cake >= 1.0.0) | |
uses: ./ | |
with: | |
cake-bootstrap: auto | |
cake-version: 1.0.0 | |
script-path: ${{ env.script-directory }}/module.cake | |
- name: Remove the tools directory | |
run: rm -rf ${{ env.tools-directory }} | |
shell: bash | |
- name: Run automatic bootstrapping of Cake modules (Cake < 1.0.0) | |
uses: ./ | |
with: | |
cake-bootstrap: auto | |
cake-version: 0.38.5 | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Successful-Task | |
- name: Remove the tools directory | |
run: rm -rf ${{ env.tools-directory }} | |
shell: bash | |
- name: Run explicit bootstrapping of Cake modules (Cake >= 1.0.0) | |
uses: ./ | |
with: | |
cake-bootstrap: explicit | |
cake-version: 1.0.0 | |
script-path: ${{ env.script-directory }}/module.cake | |
- name: Remove the tools directory | |
run: rm -rf ${{ env.tools-directory }} | |
shell: bash | |
- name: Run explicit bootstrapping of Cake modules (Cake < 1.0.0) | |
uses: ./ | |
with: | |
cake-bootstrap: explicit | |
cake-version: 0.38.5 | |
script-path: ${{ env.script-directory }}/module.cake | |
- name: Remove the tools directory | |
run: rm -rf ${{ env.tools-directory }} | |
shell: bash | |
- name: Run skip bootstrapping of Cake modules (Cake >= 1.0.0) | |
uses: ./ | |
with: | |
cake-bootstrap: skip | |
cake-version: 1.0.0 | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Successful-Task | |
- name: Run skip bootstrapping of Cake modules (Cake < 1.0.0) | |
uses: ./ | |
with: | |
cake-bootstrap: skip | |
cake-version: 0.38.5 | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Successful-Task | |
- name: Run with a specific verbosity level | |
uses: ./ | |
env: | |
EXPECTED_VERBOSITY: Diagnostic | |
with: | |
verbosity: Diagnostic | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Test-Verbosity | |
- name: Do a dry run | |
uses: ./ | |
with: | |
dry-run: true | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Test-Dry-Run | |
- name: Run with custom script parameters | |
uses: ./ | |
env: | |
EXPECTED_STRING_ARGUMENT: '''value''' | |
EXPECTED_NUMERIC_ARGUMENT: '3' | |
EXPECTED_BOOLEAN_ARGUMENT: 'true' | |
with: | |
script-path: ${{ env.script-directory }}/build.cake | |
target: Test-Script-Parameters | |
arguments: | | |
string-parameter: 'value' | |
numeric-parameter: 3 | |
boolean-parameter: true |