mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
All package tests use the same nox session now.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
b0a5d454c9
commit
a6b89f1640
7 changed files with 160 additions and 152 deletions
|
@ -27,7 +27,7 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
description: The python version to run tests with
|
||||
default: "3.9"
|
||||
default: "3.10"
|
||||
package-name:
|
||||
required: false
|
||||
type: string
|
||||
|
@ -42,7 +42,7 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
description: The nox session to run
|
||||
default: test-download-pkgs
|
||||
default: test-pkgs-onedir
|
||||
|
||||
|
||||
env:
|
||||
|
@ -190,7 +190,7 @@ jobs:
|
|||
SKIP_INITIAL_GH_ACTIONS_FAILURES: "1"
|
||||
SKIP_CODE_COVERAGE: "${{ inputs.skip-code-coverage && '1' || '0' }}"
|
||||
run: |
|
||||
nox -e ${{ inputs.nox-session }}
|
||||
nox -e ${{ inputs.nox-session }} -- download-pkgs
|
||||
|
||||
- name: Run Package Download Tests
|
||||
env:
|
||||
|
@ -206,7 +206,7 @@ jobs:
|
|||
SALT_REPO_TYPE: ${{ inputs.environment }}
|
||||
SALT_REPO_DOMAIN: ${{ env.SALT_REPO_DOMAIN || 'staging.repo.saltproject.io' }}
|
||||
run: |
|
||||
nox -e ${{ inputs.nox-session }}
|
||||
nox -e ${{ inputs.nox-session }} -- download-pkgs
|
||||
|
||||
- name: Fix file ownership
|
||||
run: |
|
||||
|
@ -230,14 +230,14 @@ jobs:
|
|||
if: always() && job.status != 'cancelled'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.arch }}
|
||||
path: |
|
||||
artifacts
|
||||
!artifacts/salt/*
|
||||
!artifacts/salt-*.tar.*
|
||||
|
||||
report:
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ inputs.nox-session }})
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.arch }})
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped'
|
||||
needs:
|
||||
|
@ -256,7 +256,7 @@ jobs:
|
|||
id: download-test-run-artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.arch }}
|
||||
path: artifacts
|
||||
|
||||
- name: Show Test Run Artifacts
|
||||
|
@ -279,6 +279,6 @@ jobs:
|
|||
# always run even if the previous steps fails
|
||||
if: always() && github.event_name == 'push' && steps.download-test-run-artifacts.outcome == 'success'
|
||||
with:
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ inputs.nox-session }})
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ matrix.arch }})
|
||||
report_paths: 'artifacts/xml-unittests-output/*.xml'
|
||||
annotate_only: true
|
||||
|
|
|
@ -27,7 +27,7 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
description: The python version to run tests with
|
||||
default: "3.9"
|
||||
default: "3.10"
|
||||
package-name:
|
||||
required: false
|
||||
type: string
|
||||
|
@ -42,7 +42,7 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
description: The nox session to run
|
||||
default: test-download-pkgs
|
||||
default: test-pkgs-onedir
|
||||
|
||||
|
||||
env:
|
||||
|
@ -210,7 +210,7 @@ jobs:
|
|||
SKIP_INITIAL_GH_ACTIONS_FAILURES: "1"
|
||||
SKIP_CODE_COVERAGE: "${{ inputs.skip-code-coverage && '1' || '0' }}"
|
||||
run: |
|
||||
sudo -E nox -e ${{ inputs.nox-session }}
|
||||
sudo -E nox -e ${{ inputs.nox-session }} -- download-pkgs
|
||||
|
||||
- name: Run Package Download Tests
|
||||
env:
|
||||
|
@ -226,7 +226,7 @@ jobs:
|
|||
SALT_REPO_TYPE: ${{ inputs.environment }}
|
||||
SALT_REPO_DOMAIN: ${{ env.SALT_REPO_DOMAIN || 'staging.repo.saltproject.io' }}
|
||||
run: |
|
||||
sudo -E nox -e ${{ inputs.nox-session }}
|
||||
sudo -E nox -e ${{ inputs.nox-session }} -- download-pkgs
|
||||
|
||||
- name: Fix file ownership
|
||||
run: |
|
||||
|
@ -250,14 +250,14 @@ jobs:
|
|||
if: always() && job.status != 'cancelled'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.arch }}
|
||||
path: |
|
||||
artifacts
|
||||
!artifacts/salt/*
|
||||
!artifacts/salt-*.tar.*
|
||||
|
||||
report:
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ inputs.nox-session }})
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.arch }})
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped'
|
||||
needs:
|
||||
|
@ -276,7 +276,7 @@ jobs:
|
|||
id: download-test-run-artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.arch }}
|
||||
path: artifacts
|
||||
|
||||
- name: Show Test Run Artifacts
|
||||
|
@ -298,6 +298,6 @@ jobs:
|
|||
# always run even if the previous steps fails
|
||||
if: always() && github.event_name == 'push' && steps.download-test-run-artifacts.outcome == 'success'
|
||||
with:
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ inputs.nox-session }})
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ matrix.arch }})
|
||||
report_paths: 'artifacts/xml-unittests-output/*.xml'
|
||||
annotate_only: true
|
||||
|
|
|
@ -27,7 +27,7 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
description: The python version to run tests with
|
||||
default: "3.9"
|
||||
default: "3.10"
|
||||
package-name:
|
||||
required: false
|
||||
type: string
|
||||
|
@ -42,7 +42,7 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
description: The nox session to run
|
||||
default: test-download-pkgs
|
||||
default: test-pkgs-onedir
|
||||
|
||||
|
||||
env:
|
||||
|
@ -197,7 +197,7 @@ jobs:
|
|||
SKIP_INITIAL_GH_ACTIONS_FAILURES: "1"
|
||||
SKIP_CODE_COVERAGE: "${{ inputs.skip-code-coverage && '1' || '0' }}"
|
||||
run: |
|
||||
nox -e ${{ inputs.nox-session }}
|
||||
nox -e ${{ inputs.nox-session }} -- download-pkgs
|
||||
|
||||
- name: Run Package Download Tests
|
||||
env:
|
||||
|
@ -215,7 +215,7 @@ jobs:
|
|||
SALT_REPO_TYPE: ${{ inputs.environment }}
|
||||
SALT_REPO_DOMAIN: ${{ env.SALT_REPO_DOMAIN || 'staging.repo.saltproject.io' }}
|
||||
run: |
|
||||
nox -e ${{ inputs.nox-session }}
|
||||
nox -e ${{ inputs.nox-session }} -- download-pkgs
|
||||
|
||||
- name: Combine Coverage Reports
|
||||
if: always() && inputs.skip-code-coverage == false && job.status != 'cancelled'
|
||||
|
@ -236,14 +236,14 @@ jobs:
|
|||
if: always() && job.status != 'cancelled'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.arch }}
|
||||
path: |
|
||||
artifacts
|
||||
!artifacts/salt/*
|
||||
!artifacts/salt-*.tar.*
|
||||
|
||||
report:
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ inputs.nox-session }})
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.arch }})
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped'
|
||||
needs:
|
||||
|
@ -262,7 +262,7 @@ jobs:
|
|||
id: download-test-run-artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.arch }}
|
||||
path: artifacts
|
||||
|
||||
- name: Show Test Run Artifacts
|
||||
|
@ -284,6 +284,6 @@ jobs:
|
|||
# always run even if the previous steps fails
|
||||
if: always() && github.event_name == 'push' && steps.download-test-run-artifacts.outcome == 'success'
|
||||
with:
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ inputs.nox-session }})
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ matrix.arch }})
|
||||
report_paths: 'artifacts/xml-unittests-output/*.xml'
|
||||
annotate_only: true
|
||||
|
|
41
.github/workflows/test-packages-action-macos.yml
vendored
41
.github/workflows/test-packages-action-macos.yml
vendored
|
@ -31,12 +31,17 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
description: The python version to run tests with
|
||||
default: "3.9"
|
||||
default: "3.10"
|
||||
package-name:
|
||||
required: false
|
||||
type: string
|
||||
description: The onedir package name to use
|
||||
default: salt
|
||||
nox-session:
|
||||
required: false
|
||||
type: string
|
||||
description: The nox session to run
|
||||
default: test-pkgs-onedir
|
||||
skip-code-coverage:
|
||||
required: false
|
||||
type: boolean
|
||||
|
@ -74,9 +79,7 @@ jobs:
|
|||
- name: Generate Package Test Matrix
|
||||
id: generate-pkg-matrix
|
||||
run: |
|
||||
PKG_MATRIX=$(tools ci pkg-matrix ${{ inputs.distro-slug }} ${{ inputs.pkg-type }})
|
||||
echo "$PKG_MATRIX"
|
||||
echo "matrix=$PKG_MATRIX" >> "$GITHUB_OUTPUT"
|
||||
tools ci pkg-matrix ${{ inputs.distro-slug }} ${{ inputs.pkg-type }}
|
||||
|
||||
dependencies:
|
||||
name: Setup Test Dependencies
|
||||
|
@ -84,20 +87,16 @@ jobs:
|
|||
- generate-matrix
|
||||
runs-on: ${{ inputs.distro-slug }}
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache nox.${{ inputs.distro-slug }}.tar.* for session ${{ matrix.nox-session }}
|
||||
- name: Cache nox.${{ inputs.distro-slug }}.tar.* for session ${{ inputs.nox-session }}
|
||||
id: nox-dependencies-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nox.${{ inputs.distro-slug }}.tar.*
|
||||
key: ${{ inputs.cache-prefix }}|testrun-deps|${{ inputs.distro-slug }}|${{ matrix.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
key: ${{ inputs.cache-prefix }}|testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
|
||||
- name: Download Onedir Tarball as an Artifact
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
|
@ -140,7 +139,7 @@ jobs:
|
|||
export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
|
||||
export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
|
||||
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"
|
||||
nox --install-only -e ${{ matrix.nox-session }}
|
||||
nox --install-only -e ${{ inputs.nox-session }}
|
||||
|
||||
- name: Cleanup .nox Directory
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
|
@ -204,11 +203,11 @@ jobs:
|
|||
run: |
|
||||
python3 -m pip install 'nox==${{ env.NOX_VERSION }}'
|
||||
|
||||
- name: Download cached nox.${{ inputs.distro-slug }}.tar.* for session ${{ matrix.nox-session }}
|
||||
- name: Download cached nox.${{ inputs.distro-slug }}.tar.* for session ${{ inputs.nox-session }}
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nox.${{ inputs.distro-slug }}.tar.*
|
||||
key: ${{ inputs.cache-prefix }}|testrun-deps|${{ inputs.distro-slug }}|${{ matrix.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
key: ${{ inputs.cache-prefix }}|testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
|
||||
- name: Decompress .nox Directory
|
||||
run: |
|
||||
|
@ -223,7 +222,7 @@ jobs:
|
|||
GITHUB_ACTIONS_PIPELINE: "1"
|
||||
SKIP_INITIAL_GH_ACTIONS_FAILURES: "1"
|
||||
run: |
|
||||
sudo -E nox -e ${{ matrix.nox-session }}
|
||||
sudo -E nox -e ${{ inputs.nox-session }} -- ${{ matrix.test-chunk }}
|
||||
|
||||
- name: Run Package Tests
|
||||
env:
|
||||
|
@ -235,7 +234,7 @@ jobs:
|
|||
GITHUB_ACTIONS_PIPELINE: "1"
|
||||
SKIP_INITIAL_GH_ACTIONS_FAILURES: "1"
|
||||
run: |
|
||||
sudo -E nox -e ${{ matrix.nox-session }}
|
||||
sudo -E nox -e ${{ inputs.nox-session }} -- ${{ matrix.test-chunk }}
|
||||
|
||||
- name: Fix file ownership
|
||||
run: |
|
||||
|
@ -254,14 +253,14 @@ jobs:
|
|||
if: always() && job.status != 'cancelled'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.test-chunk }}
|
||||
path: |
|
||||
artifacts
|
||||
!artifacts/salt/*
|
||||
!artifacts/salt-*.tar.*
|
||||
|
||||
report:
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.nox-session }})
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.test-chunk }})
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && (inputs.skip-code-coverage == false || inputs.skip-junit-reports == false) && needs.test.result != 'cancelled' && needs.test.result != 'skipped'
|
||||
needs:
|
||||
|
@ -280,7 +279,7 @@ jobs:
|
|||
id: download-test-run-artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.test-chunk }}
|
||||
path: artifacts
|
||||
|
||||
- name: Show Test Run Artifacts
|
||||
|
@ -288,10 +287,10 @@ jobs:
|
|||
run: |
|
||||
tree -a artifacts
|
||||
|
||||
- name: Set up Python 3.9
|
||||
- name: Set up Python ${{ inputs.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "${{ inputs.python-version }}"
|
||||
|
||||
- name: Install Nox
|
||||
run: |
|
||||
|
@ -302,6 +301,6 @@ jobs:
|
|||
# always run even if the previous steps fails
|
||||
if: always() && inputs.skip-junit-reports == false && steps.download-test-run-artifacts.outcome == 'success'
|
||||
with:
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ matrix.nox-session }})
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ matrix.test-chunk }})
|
||||
report_paths: 'artifacts/xml-unittests-output/*.xml'
|
||||
annotate_only: true
|
||||
|
|
35
.github/workflows/test-packages-action.yml
vendored
35
.github/workflows/test-packages-action.yml
vendored
|
@ -32,6 +32,11 @@ on:
|
|||
type: string
|
||||
description: The onedir package name to use
|
||||
default: salt
|
||||
nox-session:
|
||||
required: false
|
||||
type: string
|
||||
description: The nox session to run
|
||||
default: test-pkgs-onedir
|
||||
skip-code-coverage:
|
||||
required: false
|
||||
type: boolean
|
||||
|
@ -72,9 +77,7 @@ jobs:
|
|||
- name: Generate Package Test Matrix
|
||||
id: generate-pkg-matrix
|
||||
run: |
|
||||
PKG_MATRIX=$(tools ci pkg-matrix ${{ inputs.distro-slug }} ${{ inputs.pkg-type }})
|
||||
echo "$PKG_MATRIX"
|
||||
echo "matrix=$PKG_MATRIX" >> "$GITHUB_OUTPUT"
|
||||
tools ci pkg-matrix ${{ inputs.distro-slug }} ${{ inputs.pkg-type }}
|
||||
|
||||
dependencies:
|
||||
name: Setup Test Dependencies
|
||||
|
@ -85,20 +88,16 @@ jobs:
|
|||
- linux
|
||||
- bastion
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.generate-matrix.outputs.pkg-matrix-include) }}
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache nox.${{ inputs.distro-slug }}.tar.* for session ${{ matrix.nox-session }}
|
||||
- name: Cache nox.${{ inputs.distro-slug }}.tar.* for session ${{ inputs.nox-session }}
|
||||
id: nox-dependencies-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nox.${{ inputs.distro-slug }}.tar.*
|
||||
key: ${{ inputs.cache-prefix }}|testrun-deps|${{ inputs.distro-slug }}|${{ matrix.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
key: ${{ inputs.cache-prefix }}|testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
|
||||
- name: Download Onedir Tarball as an Artifact
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
|
@ -145,7 +144,7 @@ jobs:
|
|||
- name: Install Dependencies
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
tools --timestamps vm install-dependencies --nox-session=${{ matrix.nox-session }} ${{ inputs.distro-slug }}
|
||||
tools --timestamps vm install-dependencies --nox-session=${{ inputs.nox-session }} ${{ inputs.distro-slug }}
|
||||
|
||||
- name: Cleanup .nox Directory
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
|
@ -209,11 +208,11 @@ jobs:
|
|||
run: |
|
||||
tree pkg/artifacts
|
||||
|
||||
- name: Download cached nox.${{ inputs.distro-slug }}.tar.* for session ${{ matrix.nox-session }}
|
||||
- name: Download cached nox.${{ inputs.distro-slug }}.tar.* for session ${{ inputs.nox-session }}
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nox.${{ inputs.distro-slug }}.tar.*
|
||||
key: ${{ inputs.cache-prefix }}|testrun-deps|${{ inputs.distro-slug }}|${{ matrix.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
key: ${{ inputs.cache-prefix }}|testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
|
||||
- name: Setup Python Tools Scripts
|
||||
uses: ./.github/actions/setup-python-tools-scripts
|
||||
|
@ -244,12 +243,12 @@ jobs:
|
|||
- name: Show System Info & Test Plan
|
||||
run: |
|
||||
tools --timestamps --timeout-secs=1800 vm testplan --skip-requirements-install \
|
||||
--nox-session=${{ matrix.nox-session }} ${{ inputs.distro-slug }}
|
||||
--nox-session=${{ inputs.nox-session }} ${{ inputs.distro-slug }} -- ${{ matrix.test-chunk }}
|
||||
|
||||
- name: Run Package Tests
|
||||
run: |
|
||||
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install\
|
||||
--nox-session=${{ matrix.nox-session }} --rerun-failures ${{ inputs.distro-slug }}
|
||||
--nox-session=${{ inputs.nox-session }} --rerun-failures ${{ inputs.distro-slug }} -- ${{ matrix.test-chunk }}
|
||||
|
||||
- name: Download Test Run Artifacts
|
||||
id: download-artifacts-from-vm
|
||||
|
@ -270,14 +269,14 @@ jobs:
|
|||
if: always() && steps.download-artifacts-from-vm.outcome == 'success'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.test-chunk }}
|
||||
path: |
|
||||
artifacts
|
||||
!artifacts/salt/*
|
||||
!artifacts/salt-*.tar.*
|
||||
|
||||
report:
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.nox-session }})
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.test-chunk }})
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- linux
|
||||
|
@ -299,7 +298,7 @@ jobs:
|
|||
id: download-test-run-artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.nox-session }}
|
||||
name: pkg-testrun-artifacts-${{ inputs.distro-slug }}-${{ matrix.test-chunk }}
|
||||
path: artifacts
|
||||
|
||||
- name: Show Test Run Artifacts
|
||||
|
@ -312,6 +311,6 @@ jobs:
|
|||
# always run even if the previous steps fails
|
||||
if: always() && inputs.skip-junit-reports == false && steps.download-test-run-artifacts.outcome == 'success'
|
||||
with:
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ matrix.nox-session }})
|
||||
check_name: Overall Test Results(${{ inputs.distro-slug }} ${{ matrix.test-chunk }})
|
||||
report_paths: 'artifacts/xml-unittests-output/*.xml'
|
||||
annotate_only: true
|
||||
|
|
148
noxfile.py
148
noxfile.py
|
@ -1692,41 +1692,6 @@ def build(session):
|
|||
session.run("python", "-m", "twine", "check", "dist/*")
|
||||
|
||||
|
||||
def _pkg_test(session, cmd_args, test_type, onedir=False):
|
||||
pydir = _get_pydir(session)
|
||||
junit_report_filename = f"test-results-{test_type}"
|
||||
runtests_log_filename = f"runtests-{test_type}"
|
||||
# Install requirements
|
||||
if onedir and IS_LINUX:
|
||||
session_run_always(session, "python3", "-m", "relenv", "toolchain", "fetch")
|
||||
if _upgrade_pip_setuptools_and_wheel(session, onedir=onedir):
|
||||
if IS_WINDOWS:
|
||||
file_name = "pkgtests-windows.txt"
|
||||
else:
|
||||
file_name = "pkgtests.txt"
|
||||
|
||||
requirements_file = os.path.join(
|
||||
"requirements", "static", "ci", pydir, file_name
|
||||
)
|
||||
|
||||
install_command = ["--progress-bar=off", "-r", requirements_file]
|
||||
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
||||
|
||||
env = {}
|
||||
if onedir:
|
||||
env["ONEDIR_TESTRUN"] = "1"
|
||||
|
||||
pytest_args = (
|
||||
cmd_args[:]
|
||||
+ [
|
||||
f"--junitxml=artifacts/xml-unittests-output/{junit_report_filename}.xml",
|
||||
f"--log-file=artifacts/logs/{runtests_log_filename}.log",
|
||||
]
|
||||
+ session.posargs
|
||||
)
|
||||
_pytest(session, coverage=False, cmd_args=pytest_args, env=env)
|
||||
|
||||
|
||||
@nox.session(
|
||||
python=str(ONEDIR_PYTHON_PATH),
|
||||
name="test-pkgs-onedir",
|
||||
|
@ -1739,48 +1704,83 @@ def test_pkgs_onedir(session):
|
|||
ONEDIR_ARTIFACT_PATH.relative_to(REPO_ROOT)
|
||||
)
|
||||
)
|
||||
_pkg_test(session, ["pkg/tests/"], "pkg", onedir=True)
|
||||
|
||||
chunks = {
|
||||
"install": ["pkg/tests/"],
|
||||
"upgrade": [
|
||||
"pkg/tests/upgrade/test_salt_upgrade.py::test_salt_upgrade",
|
||||
"--upgrade",
|
||||
"--no-uninstall",
|
||||
],
|
||||
"upgrade-classic": [
|
||||
"pkg/tests/upgrade/test_salt_upgrade.py::test_salt_upgrade",
|
||||
"--upgrade",
|
||||
"--no-uninstall",
|
||||
],
|
||||
"download-pkgs": [
|
||||
"pkg/tests/download/test_pkg_download.py",
|
||||
],
|
||||
}
|
||||
|
||||
@nox.session(
|
||||
python=str(ONEDIR_PYTHON_PATH),
|
||||
name="test-upgrade-pkgs-onedir",
|
||||
venv_params=["--system-site-packages"],
|
||||
)
|
||||
@nox.parametrize("classic", [False, True])
|
||||
def test_upgrade_pkgs_onedir(session, classic):
|
||||
"""
|
||||
pytest pkg upgrade tests session
|
||||
"""
|
||||
test_type = "pkg_upgrade"
|
||||
cmd_args = [
|
||||
"pkg/tests/upgrade/test_salt_upgrade.py::test_salt_upgrade",
|
||||
"--upgrade",
|
||||
"--no-uninstall",
|
||||
]
|
||||
if classic:
|
||||
cmd_args = cmd_args + ["--classic"]
|
||||
if not session.posargs or session.posargs[0] not in chunks:
|
||||
chunk = "install"
|
||||
session.log("Choosing default 'install' test type")
|
||||
else:
|
||||
chunk = session.posargs.pop(0)
|
||||
|
||||
cmd_args = chunks[chunk]
|
||||
junit_report_filename = f"test-results-{chunk}"
|
||||
runtests_log_filename = f"runtests-{chunk}"
|
||||
|
||||
pydir = _get_pydir(session)
|
||||
|
||||
if IS_LINUX:
|
||||
# Fetch the toolchain
|
||||
session_run_always(session, "python3", "-m", "relenv", "toolchain", "fetch")
|
||||
|
||||
# Install requirements
|
||||
if _upgrade_pip_setuptools_and_wheel(session, onedir=True):
|
||||
if IS_WINDOWS:
|
||||
file_name = "pkgtests-windows.txt"
|
||||
else:
|
||||
file_name = "pkgtests.txt"
|
||||
|
||||
requirements_file = os.path.join(
|
||||
"requirements", "static", "ci", pydir, file_name
|
||||
)
|
||||
|
||||
install_command = ["--progress-bar=off", "-r", requirements_file]
|
||||
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
||||
|
||||
env = {
|
||||
"ONEDIR_TESTRUN": "1",
|
||||
}
|
||||
|
||||
if chunk == "upgrade-classic":
|
||||
cmd_args.append("--classic")
|
||||
# Workaround for installing and running classic packages from 3005.1
|
||||
# They can only run with importlib-metadata<5.0.0.
|
||||
subprocess.run(["pip3", "install", "importlib-metadata==4.13.0"], check=False)
|
||||
try:
|
||||
_pkg_test(session, cmd_args, test_type, onedir=True)
|
||||
except nox.command.CommandFailed:
|
||||
sys.exit(1)
|
||||
|
||||
cmd_args = ["pkg/tests/", "--no-install"] + session.posargs
|
||||
_pkg_test(session, cmd_args, test_type, onedir=True)
|
||||
|
||||
|
||||
@nox.session(
|
||||
python=str(ONEDIR_PYTHON_PATH),
|
||||
name="test-download-pkgs",
|
||||
venv_params=["--system-site-packages"],
|
||||
)
|
||||
def test_download_pkgs_onedir(session):
|
||||
"""
|
||||
pytest pkg download tests session
|
||||
"""
|
||||
test_type = "pkg_download"
|
||||
cmd_args = ["pkg/tests/download/test_pkg_download.py"] + session.posargs
|
||||
_pkg_test(session, cmd_args, test_type, onedir=True)
|
||||
pytest_args = (
|
||||
cmd_args[:]
|
||||
+ [
|
||||
f"--junitxml=artifacts/xml-unittests-output/{junit_report_filename}.xml",
|
||||
f"--log-file=artifacts/logs/{runtests_log_filename}.log",
|
||||
]
|
||||
+ session.posargs
|
||||
)
|
||||
_pytest(session, coverage=False, cmd_args=pytest_args, env=env)
|
||||
if chunk not in ("install", "download-pkgs"):
|
||||
cmd_args = chunks["install"]
|
||||
pytest_args = (
|
||||
cmd_args[:]
|
||||
+ [
|
||||
"--no-install",
|
||||
f"--junitxml=artifacts/xml-unittests-output/{junit_report_filename}.xml",
|
||||
f"--log-file=artifacts/logs/{runtests_log_filename}.log",
|
||||
]
|
||||
+ session.posargs
|
||||
)
|
||||
_pytest(session, coverage=False, cmd_args=pytest_args, env=env)
|
||||
sys.exit(0)
|
||||
|
|
40
tools/ci.py
40
tools/ci.py
|
@ -671,9 +671,13 @@ def pkg_matrix(ctx: Context, distro_slug: str, pkg_type: str):
|
|||
"""
|
||||
Generate the test matrix.
|
||||
"""
|
||||
_matrix = []
|
||||
github_output = os.environ.get("GITHUB_OUTPUT")
|
||||
if github_output is None:
|
||||
ctx.warn("The 'GITHUB_OUTPUT' variable is not set.")
|
||||
|
||||
matrix = []
|
||||
sessions = [
|
||||
"test-pkgs-onedir",
|
||||
"install",
|
||||
]
|
||||
if (
|
||||
distro_slug
|
||||
|
@ -682,24 +686,33 @@ def pkg_matrix(ctx: Context, distro_slug: str, pkg_type: str):
|
|||
"ubuntu-20.04-arm64",
|
||||
"ubuntu-22.04-arm64",
|
||||
]
|
||||
and "MSI" != pkg_type
|
||||
and pkg_type != "MSI"
|
||||
):
|
||||
# These OS's never had arm64 packages built for them
|
||||
# with the tiamate onedir packages.
|
||||
# we will need to ensure when we release 3006.0
|
||||
# we allow for 3006.0 jobs to run, because then
|
||||
# we will have arm64 onedir packages to upgrade from
|
||||
sessions.append("'test-upgrade-pkgs-onedir(classic=False)'")
|
||||
sessions.append("upgrade")
|
||||
if (
|
||||
distro_slug not in ["centosstream-9", "ubuntu-22.04", "ubuntu-22.04-arm64"]
|
||||
and "MSI" != pkg_type
|
||||
and pkg_type != "MSI"
|
||||
):
|
||||
# Packages for these OSs where never built for classic previously
|
||||
sessions.append("'test-upgrade-pkgs-onedir(classic=True)'")
|
||||
sessions.append("upgrade-classic")
|
||||
|
||||
for sess in sessions:
|
||||
_matrix.append({"nox-session": sess})
|
||||
print(json.dumps(_matrix))
|
||||
for session in sessions:
|
||||
matrix.append(
|
||||
{
|
||||
"test-chunk": session,
|
||||
}
|
||||
)
|
||||
ctx.info("Generated matrix:")
|
||||
ctx.print(matrix, soft_wrap=True)
|
||||
|
||||
if github_output is not None:
|
||||
with open(github_output, "a", encoding="utf-8") as wfh:
|
||||
wfh.write(f"matrix={json.dumps(matrix)}\n")
|
||||
ctx.exit(0)
|
||||
|
||||
|
||||
|
@ -718,10 +731,6 @@ def pkg_download_matrix(ctx: Context, platform: str):
|
|||
github_output = os.environ.get("GITHUB_OUTPUT")
|
||||
if github_output is None:
|
||||
ctx.warn("The 'GITHUB_OUTPUT' variable is not set.")
|
||||
ctx.exit(1)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
assert github_output is not None
|
||||
|
||||
_matrix = []
|
||||
if platform == "windows":
|
||||
|
@ -744,6 +753,7 @@ def pkg_download_matrix(ctx: Context, platform: str):
|
|||
)
|
||||
ctx.info("Generated test matrix:")
|
||||
ctx.print(_matrix, soft_wrap=True)
|
||||
with open(github_output, "a", encoding="utf-8") as wfh:
|
||||
wfh.write(f"matrix={json.dumps(_matrix)}\n")
|
||||
if github_output is not None:
|
||||
with open(github_output, "a", encoding="utf-8") as wfh:
|
||||
wfh.write(f"matrix={json.dumps(_matrix)}\n")
|
||||
ctx.exit(0)
|
||||
|
|
Loading…
Add table
Reference in a new issue