Skip to content

Commit

Permalink
Merge pull request #12 from lorengordon/salt-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lorengordon authored May 22, 2023
2 parents 594714a + 5a868e5 commit b1b7bdb
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.1.0
current_version = 1.2.0
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/test-salt-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Run salt formula tests on Linux

on:
workflow_call:
inputs:
salt-os-version:
description: OS version to run salt tests on
required: true
type: number
salt-state:
description: Salt state to execute
required: true
type: string
salt-pillar-root:
description: Relative paths to the salt pillar to test
required: true
type: string
salt-repo-url:
description: URL to the salt repo file, `salt-os-version` is templated as `{0}`
default: https://repo.saltproject.io/salt/py3/redhat/{0}/x86_64/3006.repo
type: string
salt-requirements-files:
description: Space-separated list of paths to requirements files installed by yum, `salt-os-version` is templated as `{0}`
default: ./tests/requirements.txt ./tests/requirements-el{0}.txt
type: string

defaults:
run:
shell: bash

jobs:
test:
runs-on: ubuntu-latest
container:
image: >-
${{ fromJson('{
7: "quay.io/centos/centos:centos7",
8: "quay.io/centos/centos:stream8"
}')[inputs.salt-os-version] }}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
- ${{ github.workspace }}:${{ github.workspace }}
options: --privileged
env:
SALT_REPO_URL: ${{ format(inputs.salt-repo-url, inputs.salt-os-version) }}
steps:
- name: Clone this git repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c

# Install salt
- run: touch /etc/fstab
- run: curl -sSL -o /etc/yum.repos.d/salt.repo ${{ env.SALT_REPO_URL }}
- run: >-
mapfile -t REQUIREMENTS < <(cat ${{ format(inputs.salt-requirements-files, inputs.salt-os-version) }}) &&
yum install -y "${REQUIREMENTS[@]}"
- run: salt-call --versions-report

- run: >-
salt-call --local --retcode-passthrough
--file-root=${{ github.workspace }} --pillar-root=${{ inputs.salt-pillar-root }}
saltutil.sync_all
# Run tests
- run: >-
salt-call --local --retcode-passthrough
--log-file /var/log/salt/minion --log-file-level debug
--file-root=${{ github.workspace }} --pillar-root=${{ inputs.salt-pillar-root }}
state.show_sls ${{ inputs.salt-state }}
- run: >-
salt-call --local --retcode-passthrough
--log-file /var/log/salt/minion --log-file-level debug
--file-root=${{ github.workspace }} --pillar-root=${{ inputs.salt-pillar-root }}
state.sls ${{ inputs.salt-state }} mock=True
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

### [1.2.0](https://github.com/plus3it/actions-workflows/releases/tag/1.2.0)

**Released**: 2023.05.22

**Summary**:

* Adds reusable workflow for testing salt formulas

### [1.1.0](https://github.com/plus3it/actions-workflows/releases/tag/1.1.0)

**Released**: 2023.03.27
Expand Down

0 comments on commit b1b7bdb

Please sign in to comment.