mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
121 lines
3.2 KiB
YAML
121 lines
3.2 KiB
YAML
name: Test Windows
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
distro-slug:
|
|
type: string
|
|
required: true
|
|
description: The Distribution Slug
|
|
|
|
display-name:
|
|
type: string
|
|
required: true
|
|
description: The Display Name For The Job
|
|
|
|
runs-on:
|
|
type: string
|
|
required: true
|
|
description: The GitHub Windows Worker To Run Workflow On
|
|
|
|
instances:
|
|
type: string
|
|
required: true
|
|
description: The Instances To Test
|
|
|
|
timeout:
|
|
type: number
|
|
required: false
|
|
default: 20
|
|
description: The timeout(in minutes) for the workflow
|
|
|
|
env:
|
|
machine_user: kitchen
|
|
machine_pass: Password1
|
|
machine_port: 5985
|
|
KITCHEN_LOCAL_YAML: 'kitchen.windows.yml'
|
|
|
|
jobs:
|
|
Test:
|
|
name: ${{ matrix.instance }}
|
|
runs-on: ${{ inputs.runs-on }}
|
|
timeout-minutes: ${{ inputs.timeout }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
instance: ${{ fromJSON(inputs.instances) }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: 2.6.10
|
|
## ruby-version: 3.3.4
|
|
bundler-cache: true
|
|
|
|
- name: Install Chef
|
|
uses: actionshub/chef-install@1.1.0
|
|
with:
|
|
project: chef
|
|
version: 16.10.8
|
|
|
|
- name: Add Chef bindir to PATH
|
|
uses: myci-actions/export-env-var-powershell@1
|
|
with:
|
|
name: PATH
|
|
value: "C:\\opscode\\chef\\bin;C:\\opscode\\chef\\embedded\\bin;$env:PATH"
|
|
|
|
- name: Setup test user
|
|
run: |
|
|
$password = ConvertTo-SecureString $env:machine_pass -AsPlainText -Force
|
|
New-LocalUser $env:machine_user -Password $password
|
|
Add-LocalGroupMember -Group "Administrators" -Member $env:machine_user
|
|
Get-LocalUser
|
|
Get-LocalGroupMember -Group "Administrators"
|
|
|
|
- name: Set up WinRM
|
|
run: |
|
|
Set-WSManQuickConfig -Force
|
|
winrm set winrm/config/service '@{AllowUnencrypted="True"}'
|
|
env
|
|
|
|
- name: Set up Python 3.10
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install Python Dependencies
|
|
run: |
|
|
pip install -U pip
|
|
pip install -r tests/requirements.txt
|
|
|
|
- name: Create Test Instance
|
|
run: |
|
|
bundle exec kitchen create ${{ matrix.instance }}-${{ inputs.distro-slug }}
|
|
sleep 2
|
|
|
|
- name: Test Bootstrap
|
|
run: |
|
|
env
|
|
bundle exec kitchen verify ${{ matrix.instance }}-${{ inputs.distro-slug }}
|
|
sleep 2
|
|
|
|
- name: Destroy Test Instance
|
|
if: always()
|
|
run: |
|
|
bundle exec kitchen destroy ${{ matrix.instance }}-${{ inputs.distro-slug }}
|
|
sleep 2
|
|
|
|
- name: Set Exit Status
|
|
if: always()
|
|
run: |
|
|
mkdir exitstatus
|
|
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ matrix.instance }}-${{ inputs.distro-slug }}
|
|
|
|
- name: Upload Exit Status
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: exitstatus-${{ github.job }}-${{ matrix.instance }}-${{ inputs.distro-slug }}
|
|
path: exitstatus/
|