Skip to content

testing env vars

testing env vars #4

Workflow file for this run

name: Testing
on:
workflow_call:
inputs:
setup-vault:
required: false
type: boolean
default: false
jobs:
Linux:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
max-parallel: 5
matrix:
python-version:
- '3.8'
- '3.9'
salt-version:
- '3005.4'
- '3006.4'
include:
- python-version: '3.10'
salt-version: '3006.4'
steps:
- uses: actions/checkout@v4
- name: Decode credentials as env vars
env:
env_vars: ${{ secrets.env_vars }}
run: |
for i in $env_vars; do
i=$(echo $i | sed 's/=.*//g')=$(echo ${i#*=} | base64 -di | base64 -di)
echo ::add-mask::${i#*=}
printf '%s\n' "$i" >> $GITHUB_ENV
done
- name: Validate credentials
run: |
# Secrets are now available as masked env vars
echo $CREDENTIAL1
echo $CREDENTIAL2
echo $CREDENTIAL3
- name: Setup Vault
if: ${{ inputs.setup-vault }}
uses: eLco/[email protected]
with:
vault_version: 1.15.4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Test Requirements
env:
SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
run: |
nox --force-color -e tests-3 --install-only
- name: Test env vars
env:
env_vars: ${{ toJson(secrets.env_vars )}}
run: |
for secret in $(echo $env_vars | jq -r "to_entries|map(\"\(.key)=\(.value|@base64)\")|.[]"); do
key=$(echo $secret | cut -d "=" -f 1)
value=$(echo $secret | cut -d "=" -f 2 | base64 -d)
echo "export $key=\"$value\"" >> $GITHUB_ENV
done
- name: Test
env:
SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
SKIP_REQUIREMENTS_INSTALL: YES
run: |
echo $AZURE_CLIENT_ID
nox --force-color -e tests-3 -- -vv tests/
- name: Create CodeCov Flags
if: always()
id: codecov-flags
run: |
echo "flags=$(python -c "import sys; print('{},{},salt_{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))")" >> "$GITHUB_OUTPUT"
- name: Upload Project Code Coverage
if: always()
shell: bash
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},project
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project
REPORT_PATH: artifacts/coverage-project.xml
run: |
if [ ! -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
break
fi
n=$((n+1))
sleep 15
done
fi
if [ -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
break
fi
n=$((n+1))
sleep 15
done
fi
- name: Upload Tests Code Coverage
if: always()
shell: bash
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests
REPORT_PATH: artifacts/coverage-tests.xml
run: |
if [ ! -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
break
fi
n=$((n+1))
sleep 15
done
fi
if [ -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
break
fi
n=$((n+1))
sleep 15
done
fi
- name: Upload Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log
path: artifacts/runtests-*.log
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}-Py{{ matrix.python-version }}-Salt{{ matrix.salt-version }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v3
with:
name: exitstatus
path: exitstatus
if-no-files-found: error
Windows:
runs-on: windows-latest
timeout-minutes: 40
strategy:
fail-fast: false
max-parallel: 3
matrix:
include:
- python-version: '3.8'
salt-version: '3005.4'
- python-version: '3.8'
salt-version: '3006.4'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download libeay32.dll
run: |
export PY_LOC=$(which python.exe)
echo ${PY_LOC}
export PY_DIR=$(dirname ${PY_LOC})
echo ${PY_DIR}
curl https://repo.saltproject.io/windows/dependencies/64/libeay32.dll --output ${PY_DIR}/libeay32.dll
ls -l ${PY_DIR}
shell: bash
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Test Requirements
shell: bash
env:
SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
# EXTRA_REQUIREMENTS_INSTALL: Cython
run: |
export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH"
nox --force-color -e tests-3 --install-only
- name: Test
shell: bash
env:
SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
SKIP_REQUIREMENTS_INSTALL: YES
run: |
export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH"
nox --force-color -e tests-3 -- -vv tests/
- name: Create CodeCov Flags
if: always()
id: codecov-flags
run: |
echo "flags=$(python -c "import sys; print('{},{},salt_{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))")" >> "$GITHUB_OUTPUT"
- name: Upload Project Code Coverage
if: always()
shell: bash
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},project
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project
REPORT_PATH: artifacts/coverage-project.xml
run: |
if [ ! -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
break
fi
n=$((n+1))
sleep 15
done
fi
if [ -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
break
fi
n=$((n+1))
sleep 15
done
fi
- name: Upload Tests Code Coverage
if: always()
shell: bash
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests
REPORT_PATH: artifacts/coverage-tests.xml
run: |
if [ ! -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
break
fi
n=$((n+1))
sleep 15
done
fi
if [ -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
break
fi
n=$((n+1))
sleep 15
done
fi
- name: Upload Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log
path: artifacts/runtests-*.log
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}-Py{{ matrix.python-version }}-Salt{{ matrix.salt-version }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v3
with:
name: exitstatus
path: exitstatus
if-no-files-found: error
macOS:
runs-on: macOS-latest
timeout-minutes: 40
strategy:
fail-fast: false
max-parallel: 3
matrix:
include:
- python-version: '3.9'
salt-version: '3005.4'
- python-version: '3.10'
salt-version: '3006.4'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Test Requirements
env:
SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
run: |
nox --force-color -e tests-3 --install-only
- name: Test
env:
SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --force-color -e tests-3 -- -vv tests/
- name: Create CodeCov Flags
if: always()
id: codecov-flags
run: |
echo "flags=$(python -c "import sys; print('{},{},salt_{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))")" >> "$GITHUB_OUTPUT"
- name: Upload Project Code Coverage
if: always()
shell: bash
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},project
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project
REPORT_PATH: artifacts/coverage-project.xml
run: |
if [ ! -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
break
fi
n=$((n+1))
sleep 15
done
fi
if [ -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
break
fi
n=$((n+1))
sleep 15
done
fi
- name: Upload Tests Code Coverage
if: always()
shell: bash
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests
REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests
REPORT_PATH: artifacts/coverage-tests.xml
run: |
if [ ! -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
break
fi
n=$((n+1))
sleep 15
done
fi
if [ -f codecov.sh ]; then
n=0
until [ "$n" -ge 5 ]
do
if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
break
fi
n=$((n+1))
sleep 15
done
fi
- name: Upload Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log
path: artifacts/runtests-*.log
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}-Py{{ matrix.python-version }}-Salt{{ matrix.salt-version }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v3
with:
name: exitstatus
path: exitstatus
if-no-files-found: error