fixes debug v2 #124
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
--- | |
name: Molecule Testsing | |
on: # yamllint disable-line rule:truthy | |
push: null | |
pull_request: | |
branches: | |
- main | |
- master | |
permissions: read-all | |
concurrency: | |
group: >- | |
${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
test_bareos: | |
runs-on: ubuntu-latest | |
container: | |
image: ubuntu:latest | |
volumes: | |
- "/sys/fs/cgroup:/sys/fs/cgroup:rw" | |
options: --privileged --cap-add SYS_ADMIN | |
permissions: | |
statuses: write | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# role: | |
# - bareos | |
# - something | |
steps: | |
- name: Install docker | |
uses: papodaca/install-docker-action@v1 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install and configure Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install other apt packages | |
run: apt-get install gnupg2 rsync openssh-client openssh-server -y | |
- name: Poetry install dependecies | |
run: | | |
export PATH="/github/home/.local/bin:$PATH" | |
ls -lha | |
poetry install --no-root --no-cache --ansi --no-interaction | |
- name: Show installed versions | |
run: | | |
poetry run python --version | |
poetry --version || true | |
ESC="$(printf "\033")" | |
printf "Packages:\n%s\n \n" "$(poetry --ansi run pip list | sed -e "s/ /${ESC}[1;35m /g; s/$/${ESC}[0m/g")" | |
sudo --version || true | |
poetry --ansi run ansible --version | |
poetry --ansi run ansible-galaxy --version | |
ls -lha /tmp || true | |
ls -lh / | grep tmp || true | |
- name: Molecule test | |
shell: bash | |
run: | | |
printf "[defaults]\nremote_tmp = /tmp/.ansible-\${USER}/tmp" > $HOME/.ansible.cfg | |
cd roles/bareos | |
DEBUG_OPT=$([[ "$COMMIT_MSG" =~ .(debug) ]] && echo "--debug") | |
VERBOSE_OPT=$([[ "$COMMIT_MSG" =~ .(debug).v([1-3]) ]] && echo "-v ${COMMIT_MSG/*debug v/}") | |
echo "DEBUG_OPT: $DEBUG_OPT" | |
echo "VERBOSE_OPT: $VERBOSE_OPT" | |
set -x | |
if [[ -f "molecule/default/requirements.yml" ]]; then | |
poetry --ansi run ansible-galaxy install -r molecule/default/requirements.yml \ | |
--server https://old-galaxy.ansible.com --timeout 300 $VERBOSE_OPT | |
fi | |
poetry --ansi run molecule $DEBUG_OPT $VERBOSE_OPT test | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |