Standardize package bucket naming and implement v1 of the macos package tests

This commit is contained in:
MKLeb 2023-01-26 17:09:59 -05:00 committed by Pedro Algarvio
parent 23629ecc52
commit 6d3d56eeaf
7 changed files with 392 additions and 16 deletions

View file

@ -78,7 +78,7 @@ jobs:
- name: Upload DEBs
uses: actions/upload-artifact@v3
with:
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-deb-pkgs
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-deb
path: ${{ github.workspace }}/pkgs/*
retention-days: 7
if-no-files-found: error

View file

@ -58,7 +58,7 @@ jobs:
- name: Upload ${{ matrix.arch }} Package
uses: actions/upload-artifact@v3
with:
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-macos-pkgs
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-macos
path: pkg/macos/*unsigned.pkg
retention-days: 7
if-no-files-found: error

View file

@ -71,7 +71,7 @@ jobs:
- name: Upload RPMs
uses: actions/upload-artifact@v3
with:
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-rpm-pkgs
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-rpm
path: ~/rpmbuild/RPMS/${{ matrix.arch }}/*.rpm
retention-days: 7
if-no-files-found: error

View file

@ -55,9 +55,15 @@ jobs:
- name: Upload ${{ matrix.arch }} Packages
uses: actions/upload-artifact@v3
with:
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-windows-pkgs
path: |
pkg/windows/build/Salt-*.exe
pkg/windows/build/Salt-*.msi
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-NSIS
path: pkg/windows/build/Salt-*.exe
retention-days: 7
if-no-files-found: error
- name: Upload ${{ matrix.arch }} MSI Package
uses: actions/upload-artifact@v3
with:
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-MSI
path: pkg/windows/build/Salt-*.msi
retention-days: 7
if-no-files-found: error

View file

@ -592,6 +592,20 @@ jobs:
salt-version: "${{ needs.prepare-ci.outputs.salt-version }}"
pkg-type: deb
macos-12:
name: macOS 12 Package Tests
if: ${{ fromJSON(needs.prepare-ci.outputs.jobs)['github-hosted-runners'] }}
needs:
- prepare-ci
- build-pkgs
uses: ./.github/workflows/test-packages-action-macos.yml
with:
distro-slug: macos-12
platform: darwin
arch: x86_64
salt-version: "${{ needs.prepare-ci.outputs.salt-version }}"
pkg-type: macos
# <-------------------------------- PACKAGE TESTS -------------------------------->
windows-2016:

View file

@ -170,7 +170,7 @@ jobs:
- name: Download Packages
uses: actions/download-artifact@v3
with:
name: salt-${{ inputs.salt-version }}-${{ inputs.arch }}-${{ inputs.pkg-type }}-packages
name: salt-${{ inputs.salt-version }}-${{ inputs.arch }}-${{ inputs.pkg-type }}
path: pkg/artifacts/
- name: List Packages
@ -225,14 +225,6 @@ jobs:
run: |
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test \
--nox-session=${{ matrix.nox-session }} --rerun-failures ${{ inputs.distro-slug }}
# tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install \
# --nox-session=${{ env.NOX_SESSION }} --rerun-failures ${{ inputs.distro-slug }} \
# ${{ matrix.tests-chunk }} -- --run-slow
# - name: Combine Coverage Reports
# if: always() && steps.spin-up-vm.outcome == 'success'
# run: |
# tools --timestamps vm combine-coverage ${{ inputs.distro-slug }}
# - name: Download Test Run Artifacts
# id: download-artifacts-from-vm

View file

@ -0,0 +1,364 @@
name: Test Artifact
on:
workflow_call:
inputs:
distro-slug:
required: true
type: string
description: The OS slug to run tests against
platform:
required: true
type: string
description: The platform being tested
arch:
required: true
type: string
description: The platform arch being tested
pkg-type:
required: true
type: string
description: The platform arch being tested
salt-version:
type: string
required: true
description: The Salt version of the packages to install and test
python-version:
required: false
type: string
description: The python version to run tests with
default: "3.9"
env:
NOX_VERSION: "2022.8.7"
COLUMNS: 160
AWS_MAX_ATTEMPTS: "10"
AWS_RETRY_MODE: "adaptive"
jobs:
# 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
# - 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-seed }}|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: Download Onedir Tarball as an Artifact
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# uses: actions/download-artifact@v3
# with:
# name: ${{ inputs.package-name }}-${{ inputs.salt-version }}-onedir-${{ inputs.platform }}-${{ inputs.arch }}.tar.xz
# path: artifacts/
# - name: Decompress Onedir Tarball
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# shell: bash
# run: |
# python3 -c "import os; os.makedirs('artifacts', exist_ok=True)"
# cd artifacts
# tar xvf ${{ inputs.package-name }}-${{ inputs.salt-version }}-onedir-${{ inputs.platform }}-${{ inputs.arch }}.tar.xz
# - name: PyPi Proxy
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# run: |
# sed -i '7s;^;--index-url=https://pypi-proxy.saltstack.net/root/local/+simple/ --extra-index-url=https://pypi.org/simple\n;' requirements/static/ci/*/*.txt
# - name: Setup Python Tools Scripts
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# uses: ./.github/actions/setup-python-tools-scripts
# - 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 }} >> "$GITHUB_ENV"
# else
# echo NOX_SESSION=${{ inputs.nox-session }}-tcp >> "$GITHUB_ENV"
# fi
# - name: Start VM
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# id: spin-up-vm
# run: |
# tools --timestamps vm create --retries=2 ${{ inputs.distro-slug }}
# - name: List Free Space
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# run: |
# tools --timestamps vm ssh ${{ inputs.distro-slug }} -- df -h || true
# - name: Upload Checkout To VM
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# run: |
# tools --timestamps vm rsync ${{ inputs.distro-slug }}
# - name: Install Dependencies
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# run: |
# tools --timestamps vm install-dependencies --nox-session=${{ env.NOX_SESSION }} ${{ inputs.distro-slug }}
# - name: Cleanup .nox Directory
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# run: |
# tools --timestamps vm pre-archive-cleanup ${{ inputs.distro-slug }}
# - name: Compress .nox Directory
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# run: |
# tools --timestamps vm compress-dependencies ${{ inputs.distro-slug }}
# - name: Download Compressed .nox Directory
# if: steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# run: |
# tools --timestamps vm download-dependencies ${{ inputs.distro-slug }}
# - name: Destroy VM
# if: always() && steps.nox-dependencies-cache.outputs.cache-hit != 'true'
# run: |
# tools --timestamps vm destroy ${{ inputs.distro-slug }}
# - name: Set Exit Status
# if: always()
# run: |
# python3 -c "import os; os.makedirs('exitstatus', exist_ok=True)"
# echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-deps
# - name: Upload Exit Status
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: exitstatus
# path: exitstatus
# if-no-files-found: error
test:
name: Test
runs-on: ${{ inputs.distro-slug }}
timeout-minutes: 120 # 2 Hours - More than this and something is wrong
# needs:
# - dependencies
# - generate-matrix
strategy:
fail-fast: false
matrix:
nox-session:
- test-pkgs-3
- test-upgrade-pkgs-3
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
- name: Download Packages
uses: actions/download-artifact@v3
with:
name: salt-${{ inputs.salt-version }}-${{ inputs.arch }}-${{ inputs.pkg-type }}
path: pkg/artifacts/
- name: Install System Dependencies
run: |
brew install tree
- name: List Packages
run: |
tree pkg/artifacts
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: "${{ inputs.python-version }}"
- name: Install Nox
run: |
python3 -m pip install 'nox==${{ env.NOX_VERSION }}'
# - 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-seed }}|testrun-deps|${{ inputs.distro-slug }}|${{ inputs.nox-session }}|${{ matrix.transport }}|${{ hashFiles('requirements/**/*.txt', 'cicd/golden-images.json') }}
- name: PyPi Proxy
run: |
sed -i '7s;^;--index-url=https://pypi-proxy.saltstack.net/root/local/+simple/ --extra-index-url=https://pypi.org/simple\n;' requirements/static/ci/*/*.txt
# - name: Download testrun-changed-files.txt
# if: ${{ fromJSON(inputs.testrun)['type'] != 'full' }}
# uses: actions/download-artifact@v3
# with:
# name: testrun-changed-files.txt
# - name: Decompress .nox Directory
# run: |
# tools --timestamps vm decompress-dependencies ${{ inputs.distro-slug }}
# - name: Show System Info & Test Plan
# run: |
# tools --timestamps --timeout-secs=1800 vm testplan --skip-requirements-install \
# --nox-session=${{ env.NOX_SESSION }} ${{ inputs.distro-slug }} \
# ${{ matrix.tests-chunk }}
- name: Run Package Tests
env:
SKIP_REQUIREMENTS_INSTALL: "1"
PRINT_TEST_SELECTION: "0"
PRINT_TEST_PLAN_ONLY: "0"
PRINT_SYSTEM_INFO: "0"
RERUN_FAILURES: "1"
GITHUB_ACTIONS_PIPELINE: "1"
SKIP_INITIAL_GH_ACTIONS_FAILURES: "1"
run: |
sudo -E nox -e ${{ matrix.nox-session }}
- name: Fix file ownership
run: |
sudo chown -R "$(id -un)" .
# - name: Download Test Run Artifacts
# id: download-artifacts-from-vm
# if: always() && steps.spin-up-vm.outcome == 'success'
# run: |
# tools --timestamps vm download-artifacts ${{ inputs.distro-slug }}
# # Delete the salt onedir, we won't need it anymore and it will prevent
# # from it showing in the tree command below
# rm -rf artifacts/salt*
# tree -a artifacts
# 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() && steps.download-artifacts-from-vm.outcome == 'success'
# uses: actions/upload-artifact@v3
# with:
# name: testrun-artifacts-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}
# path: |
# artifacts
# !artifacts/salt/*
# !artifacts/salt-*.tar.*
# - name: Set Exit Status
# if: always()
# run: |
# python3 -c "import os; os.makedirs('exitstatus', exist_ok=True)"
# echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}-${{ matrix.tests-chunk }}-tests
# - name: Upload Exit Status
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: exitstatus
# path: exitstatus
# if-no-files-found: error
# report:
# name: Reports for ${{ inputs.distro-slug }}(${{ matrix.transport }})
# runs-on:
# - self-hosted
# - linux
# - x86_64
# if: always() && needs.test.result != 'cancelled' && needs.test.result != 'skipped'
# needs:
# - test
# - generate-matrix
# 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 }} >> "$GITHUB_ENV"
# else
# echo NOX_SESSION=${{ inputs.nox-session }}-tcp >> "$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 }}-${{ env.NOX_SESSION }}
# path: artifacts
# - name: Show Test Run Artifacts
# if: always() && steps.download-test-run-artifacts.outcome == 'success'
# run: |
# tree -a artifacts
# - name: Upload Code Coverage DB
# if: always() && steps.download-test-run-artifacts.outcome == 'success'
# uses: actions/upload-artifact@v3
# with:
# name: code-coverage
# path: artifacts/coverage
# - name: Set up Python 3.9
# uses: actions/setup-python@v4
# with:
# python-version: "3.9"
# - name: Install Nox
# run: |
# python3 -m pip install 'nox==${{ env.NOX_VERSION }}'
# - name: Report Salt Code Coverage
# continue-on-error: true
# run: |
# nox --force-color -e report-coverage -- salt
# - name: Report Tests Code Coverage
# continue-on-error: true
# run: |
# nox --force-color -e report-coverage -- tests
# - name: Report Combined Code Coverage
# continue-on-error: true
# run: |
# nox --force-color -e report-coverage
# - name: Publish Test Report
# uses: mikepenz/action-junit-report@v3
# # 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 }})
# report_paths: 'artifacts/xml-unittests-output/*.xml'
# annotate_only: true
# - name: Set Exit Status
# if: always()
# run: |
# python3 -c "import os; os.makedirs('exitstatus', exist_ok=True)"
# echo "${{ job.status }}" > exitstatus/${{ github.job }}-${{ inputs.distro-slug }}-${{ env.NOX_SESSION }}-report
# - name: Upload Exit Status
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: exitstatus
# path: exitstatus
# if-no-files-found: error