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

Issue 44 fix ut #47

Merged
merged 3 commits into from
May 2, 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
10 changes: 6 additions & 4 deletions .github/actions/lint-it/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ runs:
steps:
- name: Create venv.
run: |
python3 -m venv --clear venv
pushd $HOME
python3 -m venv --clear .venv-linter
popd
shell: bash
- name: Install dependencies
run: |
./venv/bin/python3 -m pip install -U setuptools pip
./venv/bin/python3 -m pip install -e .[dev]
"$HOME/.venv-linter/bin/python" -m pip install -U setuptools pip
"$HOME/.venv-linter/bin/python" -m pip install -e .[dev]
shell: bash
- name: Test with pytest
run: |
./venv/bin/python3 -m py.test -m "linter" --lint-code
"$HOME/.venv-linter/bin/python" -m py.test -m "linter" --lint-code
shell: bash

8 changes: 0 additions & 8 deletions .github/actions/pip-freeze-v2/action.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .github/actions/pip-freeze/action.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/actions/test-it-v2/action.yml

This file was deleted.

46 changes: 36 additions & 10 deletions .github/actions/test-it/action.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
name: 'Test it!'
description: 'Test this repo.'

inputs:
python-version:
required: true

runs:
using: "composite"
steps:
- name: Create venv.
run: |
python3 -m venv --clear venv
- name: Setup test env.
run: |-
my_venv_bin="$HOME/.venv${{inputs.python-version}}/bin/python"

sudo apt-get update -y
sudo apt-get install -y python-pip-whl python3-venv

if [[ "${{inputs.python-version}}" == "2.7" ]] ; then
python2.7 -m pip install --user -U setuptools pip
python2.7 -m pip install --user -U virtualenv
pushd $HOME
$HOME/.local/bin/virtualenv -p python2.7 --clear --no-wheel .venv2.7
popd
else
pushd $HOME
python${{inputs.python-version}} -m venv --clear .venv${{inputs.python-version}}
popd
fi

"$my_venv_bin" -m pip install -U setuptools pip
if [[ "${{inputs.python-version}}" == "2.7" ]] ; then
"$my_venv_bin" -m pip install -U 'ansible<2.0.0'
elif [[ "${{inputs.python-version}}" == "3.5" ]] ; then
"$my_venv_bin" -m pip install -U 'cryptography==3.2.1'
fi
"$my_venv_bin" -m pip install -e .[dev]
shell: bash
- name: Install dependencies

- name: Test with pytest
run: |
_pyver=$(./venv/bin/python3 -c 'import sys;print("".join(sys.version.split(".")[0:2]))')
./venv/bin/python3 -m pip install -U setuptools pip
[[ "$_pyver" == "35" ]] && ./venv/bin/python3 -m pip install -U 'cryptography==3.2.1'
./venv/bin/python3 -m pip install -e .[dev]
"$HOME/.venv${{inputs.python-version}}/bin/python" -m py.test -m "not linter"
shell: bash
- name: Test with pytest

- name: Output req.txt for cache
run: |
./venv/bin/python3 -m py.test -m "not linter"
"$HOME/.venv${{inputs.python-version}}/bin/python" -m pip freeze > requirements.txt
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
pull_request_target:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/linter.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: super-linter

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]
pull_request_target:
branches: [ "master" ]

jobs:
Expand Down
27 changes: 18 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@ name: test
on:
push:
branches: [ "*" ]
pull_request:
pull_request_target:
branches: [ "master" ]
schedule:
- cron: '30 6 * * *'

jobs:
code-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ansible-vault-${{ runner.os }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: ansible-vault-${{ runner.os }}-
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- uses: ./.github/actions/lint-it

unittest:
runs-on: ubuntu-latest
strategy:
Expand All @@ -24,11 +38,6 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: tomoh1r/ansible-vault/.github/actions/test-it@master
if: "matrix.python-version != '2.7'"
- uses: tomoh1r/ansible-vault/.github/actions/test-it-v2@master
if: "matrix.python-version == '2.7'"
- uses: tomoh1r/ansible-vault/.github/actions/pip-freeze@master
if: "matrix.python-version != '2.7'"
- uses: tomoh1r/ansible-vault/.github/actions/pip-freeze-v2@master
if: "matrix.python-version == '2.7'"
- uses: ./.github/actions/test-it
with:
python-version: ${{ matrix.python-version }}
6 changes: 5 additions & 1 deletion .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: wiki

on: push
on:
push:
branches: [ "master" ]
pull_request_target:
branches: [ "master" ]

jobs:
build:
Expand Down