This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from kogitoapp/feature/add-pipelines
Added pipelines for tests on PRs and releases on tags
- Loading branch information
Showing
13 changed files
with
625 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: CI | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
setup_matrix: | ||
name: "Setup Test Matrix" | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
matrix: ${{ steps.get-outputs.outputs.matrix }} | ||
spec_matrix: ${{ steps.get-outputs.outputs.spec_matrix }} | ||
env: | ||
BUNDLE_WITHOUT: development:test:release | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: "2.7" | ||
bundler-cache: true | ||
- name: Run rake validate | ||
run: bundle exec rake validate | ||
|
||
- name: Setup Test Matrix | ||
id: get-outputs | ||
run: bundle exec matrix_from_metadata_v2 | ||
|
||
unit: | ||
needs: setup_matrix | ||
runs-on: ubuntu-20.04 | ||
if: ${{ needs.setup_matrix.outputs.spec_matrix != '{}' }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: ${{fromJson(needs.setup_matrix.outputs.spec_matrix)}} | ||
|
||
env: | ||
PUPPET_GEM_VERSION: ${{ matrix.puppet_version }} | ||
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' | ||
|
||
name: "Spec: puppet ${{ matrix.puppet_version }} (ruby ${{ matrix.ruby_version }})" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby_version }} | ||
bundler-cache: true | ||
|
||
- name: Print bundle environment | ||
run: | | ||
bundle env | ||
- name: Run Static & Syntax Tests | ||
run: | | ||
bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop | ||
- name: Run parallel_spec tests | ||
run: | | ||
bundle exec rake parallel_spec | ||
acceptance: | ||
needs: setup_matrix | ||
runs-on: ubuntu-20.04 | ||
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} | ||
|
||
name: "Acceptance: ${{matrix.platforms.label}}, ${{matrix.collection}}" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.7 | ||
bundler-cache: true | ||
|
||
- name: Print bundle environment | ||
run: | | ||
bundle env | ||
- name: Provision test environment | ||
run: | | ||
bundle exec rake 'litmus:provision[docker,${{ matrix.platforms.image }}]' | ||
- name: Install agent | ||
run: | | ||
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' | ||
- name: Install module | ||
run: | | ||
bundle exec rake 'litmus:install_module' | ||
# - name: Display sysctl settings | ||
# run: | | ||
# bundle exec bolt command run 'sysctl -a' --targets localhost:2222 -i spec/fixtures/litmus_inventory.yaml | ||
|
||
- name: Run acceptance tests | ||
run: | | ||
bundle exec rake 'litmus:acceptance:parallel' | ||
- name: Remove test environment | ||
if: ${{ always() }} | ||
continue-on-error: true | ||
run: | | ||
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then | ||
bundle exec rake 'litmus:tear_down' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
env: | ||
BUNDLE_WITHOUT: development:test:system_tests | ||
|
||
jobs: | ||
deploy: | ||
name: "deploy to forge" | ||
runs-on: ubuntu-latest | ||
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 |
Oops, something went wrong.