From 60ca36586acdcbe08aeabdd1c8186cf06d8d6f76 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 18 Jun 2021 18:55:03 +0100 Subject: [PATCH] Fix codecov flags and report name --- .github/workflows/testing.yml | 331 ++++++++++++++++++++-------------- changelog/73.trivial.rst | 1 + 2 files changed, 196 insertions(+), 136 deletions(-) create mode 100644 changelog/73.trivial.rst diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index b95ab733..3c0c5f04 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -75,8 +75,8 @@ jobs: run: | nox --force-color -e docs - Linux_3_5: - name: Linux-3.5 + + Linux-System-Install: runs-on: ubuntu-20.04 needs: Pre-Commit @@ -84,66 +84,73 @@ jobs: strategy: fail-fast: false - max-parallel: 4 matrix: - python-version: - - 3.5 - salt-version: - - salt==3002.6 - - salt==3003 pytest-version: - - "~=6.0.0" - - "~=6.1.0" + - "<=7.0.0" steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install Nox run: | - python -m pip install --upgrade pip - pip install nox + sudo -E apt-get update + sudo -E apt-get install -y python3-setuptools python-is-python3 + sudo -E python3 -m pip install --upgrade pip + sudo -E python3 -m pip install nox 'pytest${{ matrix.pytest-version }}' + sudo mv /usr/bin/pip /usr/bin/pip2 + sudo ln -sf /usr/bin/pip3 /usr/bin/pip + + - name: Install Salt + run: | + curl -L https://bootstrap.saltstack.com | sudo sh -s -- -M -X -x python3 stable + sudo apt-get install -y salt-api salt-ssh salt-syndic salt-cloud python3-pip + # We need to upgrade pyzmq or we'll get coredumps + sudo python3 -m pip install --ignore-installed -U pyzmq==19.0.0 + for service in $(sudo systemctl list-unit-files | grep salt | grep -v @ | awk '{ print $1 }'); do sudo systemctl stop $service; done + + - name: Gather CodeCov Info + if: always() + id: codecov-info + run: | + echo ::set-output name=flag-python-version::$(python3 -c "import sys; print('Py{}{}'.format(*sys.version_info))") + echo ::set-output name=flag-pytest-version::$(python3 -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") + echo ::set-output name=flag-salt-version::Salt$(salt --version | awk '{ print $2 }') + echo ::set-output name=flag-runner-os::$(python3 -c "print('${{ runner.os }}'.replace('-latest', ''))") + echo ::set-output name=uploader-url::$(python3 -c "print('https://uploader.codecov.io/latest/codecov-linux')") + + - name: Create CodeCov Flags + if: always() + id: codecov + run: | + echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") + echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") - name: Install Test Requirements - env: - SALT_REQUIREMENT: ${{ matrix.salt-version }} - PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | - nox --force-color -e tests-${{ matrix.python-version }} --install-only + sudo -E nox --force-color -e tests --no-venv --install-only - name: Test id: run-tests env: - SALT_REQUIREMENT: ${{ matrix.salt-version }} SKIP_REQUIREMENTS_INSTALL: YES run: | - nox --force-color -e tests-${{ matrix.python-version }} -- -vv tests/ - - - name: Create CodeCov Flags - if: always() - id: codecov-flags - run: | - echo ::set-output name=flags::$(python -c "import sys; print('{},{},{},pytest${{ matrix.pytest-version }}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))") + sudo -E nox --force-color -e tests --no-venv -- -vv tests/ - name: Upload Salt Factories Code Coverage if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-${{ matrix.salt-version }}-PyTest${{ matrix.pytest-version }}-factories + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},system,src + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-system-src REPORT_PATH: artifacts/coverage-saltfactories.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov-linux --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -167,15 +174,15 @@ jobs: if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-${{ matrix.salt-version }}-PyTest${{ matrix.pytest-version }}-tests + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},system,tests + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-system-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov-linux --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -199,31 +206,27 @@ jobs: if: always() uses: actions/upload-artifact@main with: - name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.salt-version }}-pytest${{ matrix.pytest-version }}.log + name: runtests-${{ steps.codecov.outputs.report-name }}-system.log path: artifacts/runtests-*.log - Linux: - runs-on: ubuntu-20.04 + + Windows: + runs-on: windows-latest needs: Pre-Commit - timeout-minutes: 25 + timeout-minutes: 40 strategy: fail-fast: false - max-parallel: 16 + max-parallel: 3 matrix: python-version: - - 3.6 - 3.7 - - 3.8 - - 3.9 salt-version: - salt==3002.6 - salt==3003 pytest-version: - - "~=6.0.0" - - "~=6.1.0" - - "" + - "<=7.0.0" steps: - uses: actions/checkout@v2 @@ -238,42 +241,56 @@ jobs: - name: Install Nox run: | python -m pip install --upgrade pip - pip install nox + pip install nox 'pytest${{ matrix.pytest-version }}' + + - name: Gather CodeCov Info + if: always() + id: codecov-info + run: | + echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") + echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") + echo ::set-output name=flag-salt-version::$(python -c "print('Salt{}'.format('_'.join(str(v) for v in '${{ matrix.salt-version }}'.split('==')[-1].split('.'))))") + echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") + echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov.exe')") + + - name: Create CodeCov Flags + if: always() + id: codecov + run: | + echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") + echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") - name: Install Test Requirements + shell: bash env: SALT_REQUIREMENT: ${{ matrix.salt-version }} - PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | + export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH" nox --force-color -e tests-${{ matrix.python-version }} --install-only - name: Test id: run-tests + shell: bash env: SALT_REQUIREMENT: ${{ 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-${{ matrix.python-version }} -- -vv tests/ - - name: Create CodeCov Flags - if: always() - id: codecov-flags - run: | - echo ::set-output name=flags::$(python -c "import sys; print('{},{},{},pytest${{ matrix.pytest-version }}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))") - - name: Upload Salt Factories Code Coverage if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-${{ matrix.salt-version }}-PyTest${{ matrix.pytest-version }}-factories + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},src + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-src REPORT_PATH: artifacts/coverage-saltfactories.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov-linux --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -297,15 +314,15 @@ jobs: if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-${{ matrix.salt-version }}-PyTest${{ matrix.pytest-version }}-tests + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},tests + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov-linux --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -329,78 +346,87 @@ jobs: if: always() uses: actions/upload-artifact@main with: - name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.salt-version }}-pytest${{ matrix.pytest-version }}.log + name: runtests-${{ steps.codecov.outputs.report-name }}.log path: artifacts/runtests-*.log - Linux-System-Install: - runs-on: ubuntu-20.04 + macOS: + runs-on: macOS-latest needs: Pre-Commit - timeout-minutes: 25 + timeout-minutes: 60 strategy: fail-fast: false + max-parallel: 3 + matrix: + python-version: + - 3.7 + salt-version: + - salt==3002.6 + - salt==3003 + pytest-version: + - "<=7.0.0" steps: - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Nox run: | - sudo -E apt-get update - sudo -E apt-get install -y python3-setuptools python-is-python3 - sudo -E python3 -m pip install --upgrade pip - sudo -E python3 -m pip install nox - sudo mv /usr/bin/pip /usr/bin/pip2 - sudo ln -sf /usr/bin/pip3 /usr/bin/pip + python -m pip install --upgrade pip + pip install nox 'pytest${{ matrix.pytest-version }}' - - name: Get Python Version + - name: Gather CodeCov Info if: always() - id: python-version + id: codecov-info run: | - echo ::set-output name=long::$(python -c "import sys; print('Py{}.{}'.format(*sys.version_info))") - echo ::set-output name=short::$(python -c "import sys; print('{}{}'.format(*sys.version_info))") + echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") + echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") + echo ::set-output name=flag-salt-version::$(python -c "print('Salt{}'.format('_'.join(str(v) for v in '${{ matrix.salt-version }}'.split('==')[-1].split('.'))))") + echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") + echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-macos')") - - name: Install Salt + - name: Create CodeCov Flags + if: always() + id: codecov run: | - curl -L https://bootstrap.saltstack.com | sudo sh -s -- -M -X -x python3 stable - sudo apt-get install -y salt-api salt-ssh salt-syndic salt-cloud python3-pip - # We need to upgrade pyzmq or we'll get coredumps - sudo python3 -m pip install --ignore-installed -U pyzmq==19.0.0 - for service in $(sudo systemctl list-unit-files | grep salt | grep -v @ | awk '{ print $1 }'); do sudo systemctl stop $service; done + echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") + echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") - name: Install Test Requirements + env: + SALT_REQUIREMENT: ${{ matrix.salt-version }} run: | - sudo -E nox --force-color -e tests --no-venv --install-only + nox --force-color -e tests-${{ matrix.python-version }} --install-only - name: Test id: run-tests env: + SALT_REQUIREMENT: ${{ matrix.salt-version }} SKIP_REQUIREMENTS_INSTALL: YES run: | - sudo -E nox --force-color -e tests --no-venv -- -vv tests/ - - - name: Create CodeCov Flags - if: always() - id: codecov-flags - run: | - echo ::set-output name=flags::$(python -c "import sys; print('{},{},{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), 'system'))") + nox --force-color -e tests-${{ matrix.python-version }} -- -vv tests/ - name: Upload Salt Factories Code Coverage if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-${{ steps.python-version.outputs.long }}-system-factories + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},src + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-src REPORT_PATH: artifacts/coverage-saltfactories.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov-linux --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -424,15 +450,15 @@ jobs: if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests - REPORT_NAME: ${{ runner.os }}-${{ steps.python-version.outputs.long }}-system-tests + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},tests + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov-linux --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -456,25 +482,29 @@ jobs: if: always() uses: actions/upload-artifact@main with: - name: runtests-${{ runner.os }}-py${{ steps.python-version.outputs.short }}-system.log + name: runtests-${{ steps.codecov.outputs.report-name }}.log path: artifacts/runtests-*.log - Windows: - runs-on: windows-latest + Linux_3_5: + name: Linux-3.5 + runs-on: ubuntu-20.04 needs: Pre-Commit - timeout-minutes: 40 + timeout-minutes: 25 strategy: fail-fast: false - max-parallel: 3 + max-parallel: 4 matrix: python-version: - - 3.7 + - 3.5 salt-version: - salt==3002.6 - salt==3003 + pytest-version: + - "~=6.0.0" + - "~=6.1.0" steps: - uses: actions/checkout@v2 @@ -489,45 +519,53 @@ jobs: - name: Install Nox run: | python -m pip install --upgrade pip - pip install nox + pip install nox 'pytest${{ matrix.pytest-version }}' + + - name: Gather CodeCov Info + if: always() + id: codecov-info + run: | + echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") + echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") + echo ::set-output name=flag-salt-version::$(python -c "print('Salt{}'.format('_'.join(str(v) for v in '${{ matrix.salt-version }}'.split('==')[-1].split('.'))))") + echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") + echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-linux')") + + - name: Create CodeCov Flags + if: always() + id: codecov + run: | + echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") + echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") - name: Install Test Requirements - shell: bash env: SALT_REQUIREMENT: ${{ matrix.salt-version }} + PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | - export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH" nox --force-color -e tests-${{ matrix.python-version }} --install-only - name: Test id: run-tests - shell: bash env: SALT_REQUIREMENT: ${{ 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-${{ matrix.python-version }} -- -vv tests/ - - name: Create CodeCov Flags - if: always() - id: codecov-flags - run: | - echo ::set-output name=flags::$(python -c "import sys; print('{},{},{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))") - - name: Upload Salt Factories Code Coverage if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-${{ matrix.salt-version }}-factories + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},src + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-src REPORT_PATH: artifacts/coverage-saltfactories.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov.exe --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -535,6 +573,7 @@ jobs: done fi if [ -f codecov-uploader ]; then + chmod +x codecov-uploader n=0 until [ "$n" -ge 5 ] do @@ -550,15 +589,15 @@ jobs: if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-${{ matrix.salt-version }}-tests + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},tests + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov.exe --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -566,6 +605,7 @@ jobs: done fi if [ -f codecov-uploader ]; then + chmod +x codecov-uploader n=0 until [ "$n" -ge 5 ] do @@ -581,25 +621,32 @@ jobs: if: always() uses: actions/upload-artifact@main with: - name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.salt-version }}.log + name: runtests-${{ steps.codecov.outputs.report-name }}.log path: artifacts/runtests-*.log - macOS: - runs-on: macOS-latest + Linux: + runs-on: ubuntu-20.04 needs: Pre-Commit - timeout-minutes: 60 + timeout-minutes: 25 strategy: fail-fast: false - max-parallel: 3 + max-parallel: 16 matrix: python-version: + - 3.6 - 3.7 + - 3.8 + - 3.9 salt-version: - salt==3002.6 - salt==3003 + pytest-version: + - "~=6.0.0" + - "~=6.1.0" + - "<=7.0.0" steps: - uses: actions/checkout@v2 @@ -614,11 +661,29 @@ jobs: - name: Install Nox run: | python -m pip install --upgrade pip - pip install nox + pip install nox 'pytest${{ matrix.pytest-version }}' + + - name: Gather CodeCov Info + if: always() + id: codecov-info + run: | + echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") + echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") + echo ::set-output name=flag-salt-version::$(python -c "print('Salt{}'.format('_'.join(str(v) for v in '${{ matrix.salt-version }}'.split('==')[-1].split('.'))))") + echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") + echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-linux')") + + - name: Create CodeCov Flags + if: always() + id: codecov + run: | + echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") + echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-salt-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") - name: Install Test Requirements env: SALT_REQUIREMENT: ${{ matrix.salt-version }} + PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | nox --force-color -e tests-${{ matrix.python-version }} --install-only @@ -630,25 +695,19 @@ jobs: run: | nox --force-color -e tests-${{ matrix.python-version }} -- -vv tests/ - - name: Create CodeCov Flags - if: always() - id: codecov-flags - run: | - echo ::set-output name=flags::$(python -c "import sys; print('{},{},{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))") - - name: Upload Salt Factories Code Coverage if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-${{ matrix.salt-version }}-factories + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},src + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-src REPORT_PATH: artifacts/coverage-saltfactories.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov-macos --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -672,15 +731,15 @@ jobs: if: always() shell: bash env: - REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},factories - REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-${{ matrix.salt-version }}-tests + REPORT_FLAGS: ${{ steps.codecov.outputs.flags }},tests + REPORT_NAME: ${{ steps.codecov.outputs.report-name }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ ! -f codecov-uploader ]; then n=0 until [ "$n" -ge 5 ] do - if curl --max-time 30 -L https://uploader.codecov.io/latest/codecov-macos --output codecov-uploader; then + if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output codecov-uploader; then break fi n=$((n+1)) @@ -704,5 +763,5 @@ jobs: if: always() uses: actions/upload-artifact@main with: - name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.salt-version }}.log + name: runtests-${{ steps.codecov.outputs.report-name }}.log path: artifacts/runtests-*.log diff --git a/changelog/73.trivial.rst b/changelog/73.trivial.rst new file mode 100644 index 00000000..978cd559 --- /dev/null +++ b/changelog/73.trivial.rst @@ -0,0 +1 @@ +Fix codecov flags, report name, and coverage