Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Github CI builds and modulesync #104

Merged
merged 9 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# editorconfig.org

# MANAGED BY MODULESYNC
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

root = true

Expand Down
4 changes: 3 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ fixtures:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
docker: "https://github.com/puppetlabs/puppetlabs-docker.git"
ruby_task_helper: "https://github.com/puppetlabs/puppetlabs-ruby_task_helper.git"
translate: "https://github.com/puppetlabs/puppetlabs-translate.git"
yumrepo_core:
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git"
puppet_version: ">= 6.0.0"
39 changes: 5 additions & 34 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ By participating in this project you agree to abide by its terms.

Please be prepared to repeat some of these steps as our contributors review your code.

Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions!

## Writing proper commits - short version

* Make commits of logical units.
Expand Down Expand Up @@ -230,52 +232,21 @@ simple tests against it after applying the module. You can run this
with:

```sh
bundle exec rake acceptance
```

This will run the tests on the module's default nodeset. You can override the
nodeset used, e.g.,

```sh
BEAKER_set=centos-7-x64 bundle exec rake acceptance
```

There are default rake tasks for the various acceptance test modules, e.g.,

```sh
bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
```

If you don't want to have to recreate the virtual machine every time you can
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
created virtual machines will be in `.vagrant/beaker_vagrant_files`.

Beaker also supports docker containers. We also use that in our automated CI
pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant:

```sh
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
BEAKER_setfile=debian10-x64 bundle exec rake beaker
```

You can replace the string `debian10` with any common operating system.
The following strings are known to work:

* ubuntu1604
* ubuntu1804
* debian8
* ubuntu2004
* debian9
* debian10
* centos6
* centos7
* centos8

The easiest way to debug in a docker container is to open a shell:

```sh
docker exec -it -u root ${container_id_or_name} bash
```
For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests).

The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb)
repository.
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

name: CI

on: pull_request

jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
timeout-minutes: 40
outputs:
beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }}
puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }}
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
env:
BUNDLE_WITHOUT: development:release
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run static validations
run: bundle exec rake validate lint check
- name: Run rake rubocop
run: bundle exec rake rubocop
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false

unit:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
env:
BUNDLE_WITHOUT: development:system_tests:release
PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Create task helper symlink
run: ln -s puppet-gitlab_ci_runner/spec/fixtures/modules/ruby_task_helper ../
- name: Run tests
run: bundle exec rake parallel_spec

acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
matrix:
setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}}
puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Start gitlab
run: ./scripts/start-gitlab.sh
- name: Run tests
run: bundle exec rake beaker
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

name: Release

on:
push:
tags:
- '*'

env:
BUNDLE_WITHOUT: development:test:system_tests

jobs:
deploy:
name: 'deploy to forge'
runs-on: ubuntu-latest
if: github.repository_owner == 'voxpupuli'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Build and Deploy
env:
# Configure secrets here:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets
BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}'
BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}'
run: bundle exec rake module:push
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

pkg/
Gemfile.lock
Gemfile.local
Expand Down
6 changes: 5 additions & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
modulesync_config_version: '3.0.0'
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '4.1.0'
5 changes: 3 additions & 2 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Managed by https://github.com/voxpupuli/modulesync_configs
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
#
# Hooks are only enabled if you take action.
#
Expand Down Expand Up @@ -61,4 +62,4 @@ PrePush:
- 'validate'
- 'test'
- 'rubocop'
command: [ 'bundle', 'exec', 'rake' ]
command: ['bundle', 'exec', 'rake']
20 changes: 18 additions & 2 deletions .pmtignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

docs/
pkg/
Gemfile
Gemfile.lock
Gemfile.local
vendor/
.vendor/
spec/fixtures/manifests/
spec/fixtures/modules/
spec/
Rakefile
.vagrant/
.bundle/
.ruby-version
coverage/
log/
.idea/
.dependencies/
.github/
.librarian/
Puppetfile.lock
*.iml
.editorconfig
.fixtures.yml
.gitignore
.msync.yml
.overcommit.yml
.pmtignore
.rspec
.rspec_parallel
.rubocop.yml
.sync.yml
.*.sw?
.yardoc/
.yardopts
Dockerfile
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

--format documentation
--color
3 changes: 3 additions & 0 deletions .rspec_parallel
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

--format progress
Loading