Skip to content

Commit 10f94c6

Browse files
committed
(MAINT) Update ci workflows
This commit fixes a few bugs and also refreshes the workflows so they are inline with the reusable workflow templates. Note: this repo is an exception and cannot use the reusable workflows because it contains a library and a Puppet module. To avoid duplication and conflicts the workflows are defined explicitly here.
1 parent baac86c commit 10f94c6

File tree

4 files changed

+94
-100
lines changed

4 files changed

+94
-100
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,60 @@
1-
name: CI
1+
name: "ci"
22

33
on:
44
pull_request:
55
branches:
6-
- main
6+
- "main"
77
schedule:
88
- cron: "0 0 * * *"
99
workflow_dispatch:
1010

1111
jobs:
12-
rubocop:
12+
spec:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
fail-fast: false
1616
matrix:
1717
os:
18-
- windows-latest
19-
- ubuntu-latest
20-
ruby: ["2.7"]
18+
- "windows-latest"
19+
- "windows-2019"
20+
- "ubuntu-latest"
21+
ruby:
22+
- 2.5
23+
- 2.7
24+
2125
steps:
22-
- name: Checkout Source
23-
uses: actions/checkout@v3
26+
- name: "checkout"
27+
uses: "actions/checkout@v3"
2428

25-
- name: Activate Ruby
26-
uses: ruby/setup-ruby@v1
29+
- name: "setup ruby"
30+
uses: "ruby/setup-ruby@v1"
2731
with:
2832
ruby-version: ${{ matrix.ruby }}
2933
bundler-cache: true
3034

31-
- name: Print Test Environment
35+
- name: "bundle environment"
3236
run: |
33-
ruby -v
34-
gem -v
35-
bundle -v
36-
pwsh -v
37+
echo ::group::bundler environment
38+
bundle env
39+
echo ::endgroup::
3740
38-
- name: Run Rubocop Tests
41+
- name: "rubocop"
3942
run: |
40-
bundle exec rake rubocop
43+
bundle exec rubocop
4144
42-
spec:
43-
runs-on: ${{ matrix.os }}
44-
strategy:
45-
fail-fast: false
46-
matrix:
47-
os:
48-
- windows-latest
49-
- windows-2016
50-
- ubuntu-latest
51-
- ubuntu-20.04
52-
ruby: ["2.5", "2.7"]
53-
steps:
54-
- name: Checkout Source
55-
uses: actions/checkout@v3
56-
57-
- name: Activate Ruby
58-
uses: ruby/setup-ruby@v1
59-
with:
60-
ruby-version: ${{ matrix.ruby }}
61-
bundler-cache: true
62-
63-
- name: Print Test Environment
64-
run: |
65-
ruby -v
66-
gem -v
67-
bundle -v
68-
pwsh -v
69-
70-
- name: Run Spec Tests
45+
- name: "spec"
7146
run: |
7247
bundle exec rake spec
7348
74-
acceptance-dsc:
49+
acceptance:
50+
needs: "spec"
7551
runs-on: ${{ matrix.os }}
7652
strategy:
7753
fail-fast: false
7854
matrix:
7955
os:
80-
- windows-latest
81-
- windows-2016
56+
- "windows-latest"
57+
- "windows-2019"
8258
puppet:
8359
- 6
8460
- 7
@@ -89,25 +65,25 @@ jobs:
8965
ruby: 2.7
9066
env:
9167
PUPPET_GEM_VERSION: ${{ matrix.puppet }}
68+
9269
steps:
93-
- name: Checkout Source
94-
uses: actions/checkout@v3
70+
- name: "checkout"
71+
uses: "actions/checkout@v3"
9572

96-
- name: Activate Ruby
97-
uses: ruby/setup-ruby@v1
73+
- name: "setup ruby"
74+
uses: "ruby/setup-ruby@v1"
9875
with:
9976
ruby-version: ${{ matrix.ruby }}
10077
bundler-cache: true
10178

102-
- name: Print Test Environment
79+
- name: "bundle environment"
10380
run: |
104-
ruby -v
105-
gem -v
106-
bundle -v
107-
pwsh -v
81+
echo ::group::bundler environment
82+
bundle env
83+
echo ::endgroup::
10884
109-
- name: Ensure WinRM is working
110-
shell: powershell
85+
- name: "setup winrm"
86+
shell: "powershell"
11187
run: |
11288
Get-ChildItem WSMan:\localhost\Listener\ -OutVariable Listeners | Format-List * -Force
11389
$HTTPListener = $Listeners | Where-Object -FilterScript { $_.Keys.Contains('Transport=HTTP') }
@@ -116,8 +92,8 @@ jobs:
11692
winrm e winrm/config/listener
11793
}
11894
119-
- name: Run Acceptance Tests
120-
shell: powershell
95+
- name: "acceptance"
96+
shell: "powershell"
12197
run: |
12298
bundle exec rake dsc:acceptance:spec_prep
12399
bundle exec rake dsc:acceptance:spec

.github/workflows/labeller.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
name: community-labeller
1+
name: "community-labeller"
22

33
on:
44
issues:
55
types:
6-
- opened
6+
- "opened"
77
pull_request_target:
88
types:
9-
- opened
9+
- "opened"
1010

1111
jobs:
1212
label:
13-
runs-on: ubuntu-latest
13+
runs-on: "ubuntu-latest"
1414
steps:
15-
- uses: puppetlabs/community-labeller@v0
16-
name: Label issues or pull requests
15+
- uses: "puppetlabs/community-labeller@v0"
16+
name: "Label issues or pull requests"
1717
with:
18-
label_name: community
19-
label_color: '5319e7'
20-
org_membership: puppetlabs
18+
label_name: "community"
19+
label_color: "5319e7"
20+
org_membership: "puppetlabs"
2121
token: ${{ secrets.IAC_COMMUNITY_LABELER }}
Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,82 @@
1-
name: "Publish"
1+
name: "release"
22

33
on:
44
workflow_dispatch:
55

66
jobs:
7-
create-github-release:
8-
name: Deploy GitHub Release
9-
runs-on: ubuntu-20.04
7+
github-release:
8+
name: "create release"
9+
runs-on: "ubuntu-latest"
10+
if: github.repository_owner == 'puppetlabs'
11+
1012
steps:
11-
- name: Checkout code
12-
uses: actions/checkout@v3
13+
- name: "checkout"
14+
uses: "actions/checkout@v3"
1315
with:
1416
ref: ${{ github.ref }}
1517
clean: true
1618
fetch-depth: 0
1719

18-
- name: Get Version
19-
id: get_version
20+
- name: "get version"
21+
id: "get_version"
2022
run: |
2123
echo "::set-output name=version::$(jq --raw-output .version metadata.json)"
2224
23-
- name: Create Release
25+
- name: "create release"
2426
run: |
25-
gh release create "${{ steps.get_version.outputs.version"
27+
gh release create "${{ steps.get_version.outputs.version }}"
2628
env:
2729
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2830

2931
publish-gem:
30-
name: Deploy to rubygems
31-
runs-on: ubuntu-20.04
32-
needs: create-github-release
32+
name: "publish gem"
33+
runs-on: "ubuntu-latest"
34+
needs: "github-release"
3335
steps:
34-
- name: Checkout code
35-
uses: actions/checkout@v3
36+
- name: "checkout"
37+
uses: "actions/checkout@v3"
3638
with:
3739
ref: ${{ github.ref }}
3840
clean: true
3941
fetch-depth: 0
4042

41-
- name: Activate Ruby
43+
- name: "setup ruby"
4244
uses: ruby/setup-ruby@v1
4345
with:
4446
ruby-version: 2.7
4547
bundler-cache: true
4648

47-
- name: Bundle Install
48-
run: |
49-
bundle install
50-
51-
- name: Build Gem
49+
- name: "build"
5250
run: |
5351
bundle exec rake build
5452
55-
- name: Publish Gem
53+
- name: "publish"
5654
run: |
5755
bundle exec rake push
5856
env:
5957
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
6058

6159
publish-module:
62-
name: Deploy to Forge
60+
name: "publish module"
6361
runs-on: ubuntu-20.04
6462
needs: publish-gem
6563
steps:
66-
- name: Checkout code
67-
uses: actions/checkout@v3
64+
- name: "checkout"
65+
uses: "actions/checkout@v3"
6866
with:
6967
ref: ${{ github.ref }}
7068
clean: true
7169

72-
- name: "PDK Build"
73-
uses: docker://puppet/pdk:latest
70+
- name: "update readme"
71+
run: |
72+
mv pwshlib.md README.md
73+
74+
- name: "build"
75+
uses: "docker://puppet/pdk:latest"
7476
with:
7577
args: 'build'
7678

77-
- name: "Push to Forge"
78-
uses: docker://puppet/pdk:latest
79+
- name: "publish"
80+
uses: "docker://puppet/pdk:latest"
7981
with:
8082
args: 'release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force'

.github/workflows/release_prep.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "release prep"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
target:
7+
description: "The target for the release. This can be a commit sha or a branch."
8+
required: false
9+
default: "main"
10+
11+
jobs:
12+
release_prep:
13+
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release_prep.yml@main"
14+
with:
15+
target: "${{ github.event.inputs.target }}"
16+
secrets: "inherit"

0 commit comments

Comments
 (0)