Skip to content

Commit

Permalink
Merge pull request #1 from chef/CHEF-12875-fork-core-tk-to-chef
Browse files Browse the repository at this point in the history
[CHEF-12875] Updated the workflows after forking to chef
  • Loading branch information
ashiqueps authored Sep 25, 2024
2 parents b9a9410 + 3712a8d commit 5fc2f6e
Show file tree
Hide file tree
Showing 12 changed files with 321 additions and 154 deletions.
44 changes: 44 additions & 0 deletions .expeditor/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Documentation available at https://expeditor.chef.io/docs/getting-started/
---
# Slack channel in Chef Software slack to send notifications about build failures, etc
slack:
notify_channel: chef-ws-notify

github:
# This deletes the GitHub PR branch after successfully merged into the release branch
delete_branch_on_merge: true
# The tag format to use (e.g. v1.0.0)
version_tag_format: "v{{version}}"
# allow bumping the minor release via label
minor_bump_labels:
- "Expeditor: Bump Version Minor"
# allow bumping the major release via label
major_bump_labels:
- "Expeditor: Bump Version Major"

changelog:
rollup_header: Changes not yet released to rubygems.org

subscriptions:
# These actions are taken, in order they are specified, anytime a Pull Request is merged.
- workload: pull_request_merged:{{github_repo}}:{{release_branch}}:*
actions:
- built_in:bump_version:
ignore_labels:
- "Expeditor: Skip Version Bump"
- "Expeditor: Skip All"
- bash:.expeditor/update_version.sh:
only_if: built_in:bump_version
- built_in:update_changelog:
ignore_labels:
- "Expeditor: Skip Changelog"
- "Expeditor: Skip All"

- workload: project_promoted:{{agent_id}}:*
actions:
- built_in:rollover_changelog

pipelines:
- verify:
description: Pull Request validation tests
public: true
16 changes: 16 additions & 0 deletions .expeditor/run_linux_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
#
# This script runs a passed in command, but first setups up the bundler caching on the repo

set -ue

export USER="root"
export LANG=C.UTF-8 LANGUAGE=C.UTF-8

echo "--- bundle install"

bundle config --local path vendor/bundle
bundle install --jobs=7 --retry=3

echo "+++ bundle exec task"
bundle exec $@
11 changes: 11 additions & 0 deletions .expeditor/run_windows_tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$ErrorActionPreference="stop"

Write-Host "--- bundle install"

bundle config --local path vendor/bundle
bundle config set --local without docs development profile
bundle install --jobs=7 --retry=3

Write-Host "+++ bundle exec task"
bundle exec $args
if ($LASTEXITCODE -ne 0) { throw "$args failed" }
12 changes: 12 additions & 0 deletions .expeditor/update_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
#
# After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file.
# It then executes this file to update any other files/components with that new version.
#

set -evx

sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" lib/kitchen/version.rb

# Once Expeditor finshes executing this script, it will commit the changes and push
# the commit as a new tag corresponding to the value in the VERSION file.
47 changes: 47 additions & 0 deletions .expeditor/verify.pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
expeditor:
cached_folders:
- vendor
defaults:
buildkite:
retry:
automatic:
limit: 1
timeout_in_minutes: 30

steps:
- label: run-specs-ruby-3.1
command:
- .expeditor/run_linux_tests.sh rake test
expeditor:
executor:
docker:
image: ruby:3.1

- label: run-specs-ruby-3.3
command:
- .expeditor/run_linux_tests.sh rake test
expeditor:
executor:
docker:
image: ruby:3.3

- label: run-specs-windows-ruby-3.1
command:
- powershell .expeditor/run_windows_tests.ps1 rake test
expeditor:
executor:
docker:
host_os: windows
shell: ["powershell", "-Command"]
image: rubydistros/windows-2019:3.1

- label: run-specs-windows-ruby-3.3
command:
- powershell .expeditor/run_windows_tests.ps1 rake test
expeditor:
executor:
docker:
host_os: windows
shell: ["powershell", "-Command"]
image: rubydistros/windows-2019:3.3
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@test-kitchen/maintainers
* @chef/chef-workstation-owners @chef/chef-workstation-approvers @chef/chef-workstation-reviewers
*.md @chef/docs-team
85 changes: 85 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: integration

"on":
pull_request:
push:
branches:
- main

concurrency:
group: integration-${{ github.ref }}
cancel-in-progress: true

jobs:
integration-linux:
name: Linux Dokken Integration Tests
env:
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ["3.3"]
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec kitchen test

integration-macos:
name: MacOS Integration Tests
runs-on: macos-13
strategy:
fail-fast: false
matrix:
ruby: ["3.3"]
steps:
- name: Install Vagrant VirtualBox
run: brew install --cask virtualbox vagrant
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Kitchen Test
run: |
export LOGNAME=$USER
bundle exec kitchen test almalinux-9
integration-windows:
name: Windows Integration Tests
env:
BUNDLE_without: integration
machine_user: test_user
machine_pass: Pass@word1
machine_port: 5985
SPEC_OPTS: --format progress
KITCHEN_LOCAL_YAML: kitchen.windows.yml
runs-on: windows-latest
timeout-minutes: 600
strategy:
fail-fast: false
matrix:
ruby: ["3.3"]
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Unit Tests
run: bundle exec rake unit
- name: Quality Tests
run: bundle exec rake quality
- name: Setup Machine
run: |
winrm.cmd quickconfig -q
net user /add ${{ env.machine_user }} ${{ env.machine_pass }}
net localgroup administrators ${{ env.machine_user }} /add
bundle config set --local with 'integration'
bundle install
- name: Verify Windows
run: bundle exec kitchen verify windows
125 changes: 53 additions & 72 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,76 @@
---
name: 'Lint, Unit & Integration Tests'
name: lint

"on":
pull_request:
push:
branches:
- main

jobs:
lint-unit:
uses: test-kitchen/.github/.github/workflows/lint-unit.yml@main

markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/[email protected]
with:
use-quiet-mode: "yes"
use-verbose-mode: "yes"
check-modified-files-only: "yes"
base-branch: "main"
concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: true

integration-linux:
name: Linux Dokken Integration Tests
needs: [lint-unit]
jobs:
chefstyle:
env:
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
BUNDLE_WITH: ${{ inputs.bundle_with }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ["3.3"]
name: Chefstyle on Ruby
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
- name: Checkout code
uses: actions/checkout@v4
- name: Check for Gemfile
id: check
run: |
if [ -f Gemfile ]; then
echo "gemfile=true" >> $GITHUB_OUTPUT
else
echo "gemfile=false" >> $GITHUB_OUTPUT
fi
- name: Setup Ruby
if: steps.check.outputs.gemfile == 'true'
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec kitchen test
- uses: r7kamura/rubocop-problem-matchers-action@v1
if: steps.check.outputs.gemfile == 'true'
- name: Chef Style
if: steps.check.outputs.gemfile == 'true'
run: bundle exec chefstyle

integration-macos:
name: MacOS Integration Tests
needs: [lint-unit]
runs-on: macos-13
strategy:
fail-fast: false
matrix:
ruby: ["3.3"]
yamllint:
runs-on: ubuntu-latest
steps:
- name: Install Vagrant VirtualBox
run: brew install --cask virtualbox vagrant
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
- name: Checkout code
uses: actions/checkout@v4

- name: Run yaml Lint
uses: actionshub/yamllint@main

markdown-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Markdown lint
uses: DavidAnson/markdownlint-cli2-action@v16
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Kitchen Test
run: |
export LOGNAME=$USER
bundle exec kitchen test almalinux-9
globs: "**/*.md"

integration-windows:
name: Windows Integration Tests
needs: [lint-unit]
env:
BUNDLE_without: integration
machine_user: test_user
machine_pass: Pass@word1
machine_port: 5985
SPEC_OPTS: --format progress
KITCHEN_LOCAL_YAML: kitchen.windows.yml
runs-on: windows-latest
timeout-minutes: 600
strategy:
fail-fast: false
matrix:
ruby: ["3.3"]
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
- uses: gaurav-nelson/[email protected]
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Unit Tests
run: bundle exec rake unit
- name: Quality Tests
run: bundle exec rake quality
- name: Setup Machine
run: |
winrm.cmd quickconfig -q
net user /add ${{ env.machine_user }} ${{ env.machine_pass }}
net localgroup administrators ${{ env.machine_user }} /add
bundle config set --local with 'integration'
bundle install
- name: Verify Windows
run: bundle exec kitchen verify windows
use-quiet-mode: "yes"
use-verbose-mode: "yes"
check-modified-files-only: "yes"
base-branch: "main"
Loading

0 comments on commit 5fc2f6e

Please sign in to comment.