Skip to content

Commit

Permalink
(maint) pdk and repo standards update
Browse files Browse the repository at this point in the history
  • Loading branch information
Heath Seals committed Jun 7, 2021
1 parent cdf0439 commit 3ca3ec0
Show file tree
Hide file tree
Showing 14 changed files with 641 additions and 107 deletions.
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM puppet/pdk:latest

# [Optional] Uncomment this section to install additional packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet
{
"name": "Puppet Development Kit (Community)",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"puppet.puppet-vscode",
"rebornix.Ruby"
]

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pdk --version",
}
28 changes: 28 additions & 0 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR Testing

on:
- pull_request

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
puppet_versions:
- '6'
- '7'

name: Puppet ${{ matrix.puppet_versions }}
steps:
- uses: actions/checkout@v1
- name: Install the PDK
run: |
source /etc/os-release
wget https://apt.puppet.com/puppet-tools-release-${UBUNTU_CODENAME}.deb
sudo dpkg -i puppet-tools-release-${UBUNTU_CODENAME}.deb
sudo apt-get update
sudo apt-get install pdk
- name: Syntax validation
run: pdk validate --puppet-version ${{ matrix.puppet_versions }}
- name: Unit tests
run: pdk test unit --puppet-version ${{ matrix.puppet_versions }}
78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish Module

on: workflow_dispatch

jobs:
publish-module:
name: Tag Release and Publish to Forge
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0
- name: Get Version
id: gv
run: |
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
- name: Install the PDK
run: |
source /etc/os-release
wget https://apt.puppet.com/puppet-tools-release-${UBUNTU_CODENAME}.deb
sudo dpkg -i puppet-tools-release-${UBUNTU_CODENAME}.deb
rm -f puppet-tools-release-${UBUNTU_CODENAME}.deb
sudo apt-get update
sudo apt-get install pdk
pdk bundle install
- name: Validate Docs
run: |
set -e
documentation=$(pdk bundle exec puppet strings generate --format markdown)
if [ $(echo $documentation | grep -Ec "[1-9]+ undocumented|\[warn\]") -gt 0 ]; then
echo "Please resolve documentation issues detected below:"
echo $documentation
exit 1
fi
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
echo "Here is the current git status:"
git status
echo
echo "The following changes were detected:"
git --no-pager diff
echo "Please submit a PR of changes after running 'pdk bundle exec puppet strings generate --format markdown'"
exit 1
fi
- name: Validate Changelog
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
pdk bundle exec rake changelog
check_prs=$(grep -c '### UNCATEGORIZED PRS; LABEL THEM ON GITHUB' CHANGELOG.md) || echo "Check PRs success"
if [ $check_prs -gt 0 ]; then
echo "Uncategorized PRs found. Please address missing labels in the PRs below:"
git --no-pager diff CHANGELOG.md
exit 1
fi
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
echo "Here is the current git status:"
git status
echo
echo "The following changes were detected:"
git --no-pager diff
echo "Uncommitted PRs found in the changelog. Please submit a PR of changes after running 'pdk bundle exec rake changelog'"
exit 1
fi
- name: Tag Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.gv.outputs.ver }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
- name: Build Module
run: pdk build
- name: Push to Forge
run: pdk release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force
3 changes: 3 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
/.gitignore
/.gitlab-ci.yml
/.pdkignore
/.puppet-lint.rc
/Rakefile
/rakelib/
/.rspec
Expand All @@ -40,3 +41,5 @@
/.yardopts
/spec/
/.vscode/
/.sync.yml
/.devcontainer/
1 change: 1 addition & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--fail-on-warnings
--relative
Loading

0 comments on commit 3ca3ec0

Please sign in to comment.