mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Test both TCP and ZeroMQ transports
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
231dd8c8e7
commit
2d390ce1d3
5 changed files with 255 additions and 55 deletions
46
.github/workflows/ci.yml
vendored
46
.github/workflows/ci.yml
vendored
|
@ -86,7 +86,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: almalinux-8
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
almalinux-9:
|
||||
|
@ -96,7 +96,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: almalinux-9
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
amazonlinux-2:
|
||||
|
@ -106,7 +106,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: amazonlinux-2
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
archlinux-lts:
|
||||
|
@ -116,7 +116,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: archlinux-lts
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
centos-7:
|
||||
|
@ -126,7 +126,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: centos-7
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
centosstream-8:
|
||||
|
@ -136,7 +136,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: centosstream-8
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
centosstream-9:
|
||||
|
@ -146,7 +146,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: centosstream-9
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
debian-10:
|
||||
|
@ -156,7 +156,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: debian-10
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
debian-11:
|
||||
|
@ -166,7 +166,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: debian-11
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
debian-11-arm64:
|
||||
|
@ -176,7 +176,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: debian-11-arm64
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
fedora-36:
|
||||
|
@ -186,7 +186,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: fedora-36
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
opensuse-15:
|
||||
|
@ -196,7 +196,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: opensuse-15
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
photon-3:
|
||||
|
@ -206,7 +206,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: photonos-3
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
photon-4:
|
||||
|
@ -216,7 +216,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: photonos-4
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
ubuntu-1804:
|
||||
|
@ -226,7 +226,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: ubuntu-18.04
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
ubuntu-2004:
|
||||
|
@ -236,7 +236,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: ubuntu-20.04
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
ubuntu-2004-arm64:
|
||||
|
@ -246,7 +246,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: ubuntu-20.04-arm64
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
ubuntu-2204:
|
||||
|
@ -256,7 +256,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: ubuntu-22.04
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
ubuntu-2204-arm64:
|
||||
|
@ -266,7 +266,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: ubuntu-22.04-arm64
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
windows-2016:
|
||||
|
@ -276,7 +276,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: windows-2016
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
windows-2019:
|
||||
|
@ -286,7 +286,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: windows-2019
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
windows-2022:
|
||||
|
@ -296,7 +296,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action.yml
|
||||
with:
|
||||
distro-slug: windows-2022
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
macos-12:
|
||||
|
@ -306,7 +306,7 @@ jobs:
|
|||
uses: ./.github/workflows/test-action-macos.yml
|
||||
with:
|
||||
distro-slug: macos-12
|
||||
nox-session: ci-test-3
|
||||
nox-session: ci-test
|
||||
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
|
||||
|
||||
|
||||
|
|
100
.github/workflows/test-action-macos.yml
vendored
100
.github/workflows/test-action-macos.yml
vendored
|
@ -30,10 +30,47 @@ env:
|
|||
|
||||
jobs:
|
||||
|
||||
generate-matrix:
|
||||
name: Generate Test Matrix
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix-include: ${{ steps.generate-matrix.outputs.matrix }}
|
||||
transport-matrix-include: ${{ steps.generate-transport-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Python Tools Scripts
|
||||
env:
|
||||
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
|
||||
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
|
||||
run: |
|
||||
python3 -m pip install -r requirements/static/ci/py3.10/tools.txt
|
||||
|
||||
- name: Generate Test Matrix
|
||||
id: generate-matrix
|
||||
run: |
|
||||
TEST_MATRIX=$(tools ci matrix ${{ inputs.distro-slug }})
|
||||
echo "$TEST_MATRIX"
|
||||
echo "matrix=$TEST_MATRIX" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Generate Transport Matrix
|
||||
id: generate-transport-matrix
|
||||
run: |
|
||||
TRANSPORT_MATRIX=$(tools ci transport-matrix ${{ inputs.distro-slug }})
|
||||
echo "$TRANSPORT_MATRIX"
|
||||
echo "matrix=$TRANSPORT_MATRIX" >> "$GITHUB_OUTPUT"
|
||||
|
||||
dependencies:
|
||||
name: Setup Test Dependencies
|
||||
runs-on: ${{ inputs.distro-slug }}
|
||||
timeout-minutes: 90
|
||||
needs:
|
||||
- generate-matrix
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.generate-matrix.outputs.transport-matrix-include) }}
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
|
@ -43,7 +80,7 @@ jobs:
|
|||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nox.${{ inputs.distro-slug }}.tar.*
|
||||
key: testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ inputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
|
||||
key: testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ matrix.transport }}|${{ inputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
|
||||
|
||||
# Skip jobs if nox.*.tar.* is already cached
|
||||
- name: Set up Python ${{ inputs.python-version }}
|
||||
|
@ -59,20 +96,34 @@ jobs:
|
|||
|
||||
- name: Install Nox
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
env:
|
||||
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
|
||||
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
|
||||
run: |
|
||||
python3 -m pip install 'nox==${{ env.NOX_VERSION }}'
|
||||
|
||||
- name: Define Nox Session
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
if [ "${{ matrix.transport }}" != "tcp" ]; then
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-3 >> $GITHUB_ENV
|
||||
else
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-tcp-3 >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Install Dependencies
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
env:
|
||||
PRINT_TEST_SELECTION: "0"
|
||||
PRINT_SYSTEM_INFO: "0"
|
||||
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
|
||||
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
|
||||
run: |
|
||||
export PYCURL_SSL_LIBRARY=openssl
|
||||
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 ${{ inputs.nox-session }}
|
||||
nox --install-only -e ${{ env.NOX_SESSION }}
|
||||
|
||||
- name: Compress .nox Directory
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
|
@ -98,15 +149,12 @@ jobs:
|
|||
runs-on: ${{ inputs.distro-slug }}
|
||||
timeout-minutes: 600 # 10 Hours
|
||||
needs:
|
||||
- generate-matrix
|
||||
- dependencies
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
tests-chunk:
|
||||
- unit
|
||||
- functional
|
||||
- integration
|
||||
- scenarios
|
||||
include: ${{ fromJSON(needs.generate-matrix.outputs.matrix-include) }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
|
@ -121,7 +169,7 @@ jobs:
|
|||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nox.${{ inputs.distro-slug }}.tar.*
|
||||
key: testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ inputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
|
||||
key: testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ matrix.transport }}|${{ inputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
|
||||
|
||||
- name: Set up Python ${{ inputs.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
|
@ -136,6 +184,14 @@ jobs:
|
|||
run: |
|
||||
nox -e decompress-dependencies -- ${{ inputs.distro-slug }}
|
||||
|
||||
- name: Define Nox Session
|
||||
run: |
|
||||
if [ "${{ matrix.transport }}" != "tcp" ]; then
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-3 >> $GITHUB_ENV
|
||||
else
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-tcp-3 >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Run Tests
|
||||
id: run-tests
|
||||
env:
|
||||
|
@ -144,7 +200,7 @@ jobs:
|
|||
PRINT_SYSTEM_INFO: "0"
|
||||
RERUN_FAILURES: "1"
|
||||
run: |
|
||||
nox -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }}
|
||||
nox -e ${{ env.NOX_SESSION }} -- ${{ matrix.tests-chunk }}
|
||||
|
||||
- name: Combine Coverage Reports
|
||||
if: always() && contains(fromJSON('["canceled", "skipped"]'), steps.run-tests.outcome) == false
|
||||
|
@ -156,14 +212,14 @@ jobs:
|
|||
if: always() && contains(fromJSON('["canceled", "skipped"]'), steps.run-tests.outcome) == false
|
||||
run: |
|
||||
tree -a artifacts
|
||||
mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ inputs.nox-session }}.${{ matrix.tests-chunk }}
|
||||
echo "COVERAGE_FILE=artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ inputs.nox-session }}.${{ matrix.tests-chunk }}" >> GITHUB_ENV
|
||||
mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ env.NOX_SESSION }}.${{ matrix.tests-chunk }}
|
||||
echo "COVERAGE_FILE=artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ env.NOX_SESSION }}.${{ matrix.tests-chunk }}" >> GITHUB_ENV
|
||||
|
||||
- name: Upload Test Run Artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: testrun-artifacts-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}
|
||||
path: artifacts
|
||||
|
||||
# - name: Publish Test Report
|
||||
|
@ -195,7 +251,7 @@ jobs:
|
|||
if: always()
|
||||
run: |
|
||||
mkdir exitstatus
|
||||
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.tests-chunk }}-tests
|
||||
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}-${{ matrix.tests-chunk }}-tests
|
||||
|
||||
- name: Upload Exit Status
|
||||
if: always()
|
||||
|
@ -206,20 +262,32 @@ jobs:
|
|||
if-no-files-found: error
|
||||
|
||||
report:
|
||||
name: Reports for ${{ inputs.distro-slug }}
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.transport }})
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.generate-matrix.outputs.matrix-include) }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Define Nox Session
|
||||
run: |
|
||||
if [ "${{ matrix.transport }}" != "tcp" ]; then
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-3 >> $GITHUB_ENV
|
||||
else
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-tcp-3 >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Download Test Run Artifacts
|
||||
id: download-test-run-artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: testrun-artifacts-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}
|
||||
path: artifacts
|
||||
|
||||
- name: Show Test Run Artifacts
|
||||
|
@ -270,7 +338,7 @@ jobs:
|
|||
if: always()
|
||||
run: |
|
||||
mkdir exitstatus
|
||||
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-report
|
||||
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}-report
|
||||
|
||||
- name: Upload Exit Status
|
||||
if: always()
|
||||
|
|
94
.github/workflows/test-action.yml
vendored
94
.github/workflows/test-action.yml
vendored
|
@ -25,13 +25,50 @@ env:
|
|||
|
||||
jobs:
|
||||
|
||||
generate-matrix:
|
||||
name: Generate Test Matrix
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix-include: ${{ steps.generate-matrix.outputs.matrix }}
|
||||
transport-matrix-include: ${{ steps.generate-transport-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Python Tools Scripts
|
||||
env:
|
||||
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
|
||||
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
|
||||
run: |
|
||||
python3 -m pip install -r requirements/static/ci/py3.10/tools.txt
|
||||
|
||||
- name: Generate Test Matrix
|
||||
id: generate-matrix
|
||||
run: |
|
||||
TEST_MATRIX=$(tools ci matrix ${{ inputs.distro-slug }})
|
||||
echo "$TEST_MATRIX"
|
||||
echo "matrix=$TEST_MATRIX" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Generate Transport Matrix
|
||||
id: generate-transport-matrix
|
||||
run: |
|
||||
TRANSPORT_MATRIX=$(tools ci transport-matrix ${{ inputs.distro-slug }})
|
||||
echo "$TRANSPORT_MATRIX"
|
||||
echo "matrix=$TRANSPORT_MATRIX" >> "$GITHUB_OUTPUT"
|
||||
|
||||
dependencies:
|
||||
name: Setup Test Dependencies
|
||||
needs:
|
||||
- generate-matrix
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- linux
|
||||
- bastion
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.generate-matrix.outputs.transport-matrix-include) }}
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
|
@ -41,7 +78,7 @@ jobs:
|
|||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nox.${{ inputs.distro-slug }}.tar.*
|
||||
key: testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
key: testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ matrix.transport }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
|
||||
# Skip jobs if nox.*.tar.* is already cached
|
||||
- name: PyPi Proxy
|
||||
|
@ -54,6 +91,14 @@ jobs:
|
|||
run: |
|
||||
python3 -m pip install -r requirements/static/ci/py3.10/tools.txt
|
||||
|
||||
- name: Define Nox Session
|
||||
run: |
|
||||
if [ "${{ matrix.transport }}" != "tcp" ]; then
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-3 >> $GITHUB_ENV
|
||||
else
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-tcp-3 >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Start VM
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
id: spin-up-vm
|
||||
|
@ -72,7 +117,7 @@ jobs:
|
|||
- name: Install Dependencies
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
tools --timestamps vm install-dependencies --nox-session=${{ inputs.nox-session }} ${{ inputs.distro-slug }}
|
||||
tools --timestamps vm install-dependencies --nox-session=${{ env.NOX_SESSION }} ${{ inputs.distro-slug }}
|
||||
|
||||
- name: Compress .nox Directory
|
||||
if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
|
@ -112,14 +157,11 @@ jobs:
|
|||
timeout-minutes: 240 # 4 Hours - More than this and something is wrong
|
||||
needs:
|
||||
- dependencies
|
||||
- generate-matrix
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
tests-chunk:
|
||||
- unit
|
||||
- functional
|
||||
- integration
|
||||
- scenarios
|
||||
include: ${{ fromJSON(needs.generate-matrix.outputs.matrix-include) }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
|
@ -129,7 +171,7 @@ jobs:
|
|||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nox.${{ inputs.distro-slug }}.tar.*
|
||||
key: testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
key: testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ matrix.transport }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
|
||||
|
||||
- name: PyPi Proxy
|
||||
run: |
|
||||
|
@ -140,6 +182,14 @@ jobs:
|
|||
python3 -m pip install -r requirements/static/ci/py3.10/tools.txt
|
||||
python3 -m pip install 'nox==${{ env.NOX_VERSION }}'
|
||||
|
||||
- name: Define Nox Session
|
||||
run: |
|
||||
if [ "${{ matrix.transport }}" != "tcp" ]; then
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-3 >> $GITHUB_ENV
|
||||
else
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-tcp-3 >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Start VM
|
||||
id: spin-up-vm
|
||||
env:
|
||||
|
@ -163,7 +213,7 @@ jobs:
|
|||
id: run-tests
|
||||
run: |
|
||||
tools --timestamps --no-output-timeout-secs=18000 vm test --print-tests-selection --skip-requirements-install \
|
||||
--nox-session=${{ inputs.nox-session }} --rerun-failures ${{ inputs.distro-slug }} ${{ matrix.tests-chunk }}
|
||||
--nox-session=${{ env.NOX_SESSION }} --rerun-failures ${{ inputs.distro-slug }} ${{ matrix.tests-chunk }}
|
||||
|
||||
- name: Combine Coverage Reports
|
||||
if: always() && steps.spin-up-vm.outcome == 'success' && contains(fromJSON('["canceled", "skipped"]'), steps.run-tests.outcome) == false
|
||||
|
@ -176,8 +226,8 @@ jobs:
|
|||
run: |
|
||||
tools --timestamps vm download-artifacts ${{ inputs.distro-slug }}
|
||||
tree -a artifacts
|
||||
mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ inputs.nox-session }}.${{ matrix.tests-chunk }}
|
||||
echo "COVERAGE_FILE=artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ inputs.nox-session }}.${{ matrix.tests-chunk }}" >> GITHUB_ENV
|
||||
mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ env.NOX_SESSION }}.${{ matrix.tests-chunk }}
|
||||
echo "COVERAGE_FILE=artifacts/coverage/.coverage.${{ inputs.distro-slug }}.${{ env.NOX_SESSION }}.${{ matrix.tests-chunk }}" >> GITHUB_ENV
|
||||
|
||||
- name: Destroy VM
|
||||
if: always()
|
||||
|
@ -188,7 +238,7 @@ jobs:
|
|||
if: always() && steps.download-artifacts-from-vm.outcome == 'success'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: testrun-artifacts-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}
|
||||
path: artifacts
|
||||
|
||||
# - name: Publish Test Report
|
||||
|
@ -220,7 +270,7 @@ jobs:
|
|||
if: always()
|
||||
run: |
|
||||
mkdir exitstatus
|
||||
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-${{ matrix.tests-chunk }}-tests
|
||||
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}-${{ matrix.tests-chunk }}-tests
|
||||
|
||||
- name: Upload Exit Status
|
||||
if: always()
|
||||
|
@ -231,20 +281,32 @@ jobs:
|
|||
if-no-files-found: error
|
||||
|
||||
report:
|
||||
name: Reports for ${{ inputs.distro-slug }}
|
||||
name: Reports for ${{ inputs.distro-slug }}(${{ matrix.transport }})
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.generate-matrix.outputs.matrix-include) }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Define Nox Session
|
||||
run: |
|
||||
if [ "${{ matrix.transport }}" != "tcp" ]; then
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-3 >> $GITHUB_ENV
|
||||
else
|
||||
echo NOX_SESSION=${{ inputs.nox-session}}-tcp-3 >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Download Test Run Artifacts
|
||||
id: download-test-run-artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: testrun-artifacts-${{ inputs.distro-slug }}-${{ inputs.nox-session }}
|
||||
name: testrun-artifacts-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}
|
||||
path: artifacts
|
||||
|
||||
- name: Show Test Run Artifacts
|
||||
|
@ -295,7 +357,7 @@ jobs:
|
|||
if: always()
|
||||
run: |
|
||||
mkdir exitstatus
|
||||
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ inputs.nox-session }}-report
|
||||
echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}-report
|
||||
|
||||
- name: Upload Exit Status
|
||||
if: always()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
|
||||
import tools.ci
|
||||
import tools.vm
|
||||
|
||||
for name in ("boto3", "botocore", "urllib3"):
|
||||
|
|
69
tools/ci.py
Normal file
69
tools/ci.py
Normal file
|
@ -0,0 +1,69 @@
|
|||
"""
|
||||
These commands are used in the CI pipeline.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import pathlib
|
||||
|
||||
from ptscripts import Context, command_group
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
REPO_ROOT = pathlib.Path(__file__).parent.parent
|
||||
|
||||
# Define the command group
|
||||
ci = command_group(name="ci", help="CI Related Commands", description=__doc__)
|
||||
|
||||
|
||||
@ci.command(
|
||||
arguments={
|
||||
"distro_slug": {
|
||||
"help": "The distribution slug to generate the matrix for",
|
||||
},
|
||||
},
|
||||
)
|
||||
def matrix(ctx: Context, distro_slug: str):
|
||||
"""
|
||||
Generate the test matrix.
|
||||
"""
|
||||
_matrix = []
|
||||
for transport in ("zeromq", "tcp"):
|
||||
if transport == "tcp":
|
||||
if distro_slug not in ("centosstream-9", "ubuntu-22.04-arm64"):
|
||||
# Only run TCP transport tests on these distributions
|
||||
continue
|
||||
for chunk in ("unit", "functional", "integration", "scenarios"):
|
||||
if transport == "tcp" and chunk in ("unit", "functional"):
|
||||
# Only integration and scenarios shall be tested under TCP,
|
||||
# the rest would be repeating tests
|
||||
continue
|
||||
if "macos" in distro_slug and chunk == "scenarios":
|
||||
continue
|
||||
_matrix.append({"transport": transport, "tests-chunk": chunk})
|
||||
print(json.dumps(_matrix))
|
||||
ctx.exit(0)
|
||||
|
||||
|
||||
@ci.command(
|
||||
name="transport-matrix",
|
||||
arguments={
|
||||
"distro_slug": {
|
||||
"help": "The distribution slug to generate the matrix for",
|
||||
},
|
||||
},
|
||||
)
|
||||
def transport_matrix(ctx: Context, distro_slug: str):
|
||||
"""
|
||||
Generate the test matrix.
|
||||
"""
|
||||
_matrix = []
|
||||
for transport in ("zeromq", "tcp"):
|
||||
if transport == "tcp":
|
||||
if distro_slug not in ("centosstream-9", "ubuntu-22.04-arm64"):
|
||||
# Only run TCP transport tests on these distributions
|
||||
continue
|
||||
_matrix.append({"transport": transport})
|
||||
print(json.dumps(_matrix))
|
||||
ctx.exit(0)
|
Loading…
Add table
Reference in a new issue