Network interface configuration #1883
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: installer-script-test | |
# Only run tests for main branch or if the PR has relevant changes | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- '.github/workflows/installer-script-test.yml' | |
- 'internal/buildscripts/packaging/installer/install.sh' | |
- 'internal/buildscripts/packaging/tests/helpers/**' | |
- 'internal/buildscripts/packaging/tests/images/**' | |
- 'internal/buildscripts/packaging/tests/installer_test.py' | |
- 'internal/buildscripts/packaging/tests/requirements.txt' | |
concurrency: | |
group: installer-script-test-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
installer-test-matrix: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Get distros | |
id: get-matrix | |
run: | | |
# create test matrix for distro images and archs | |
dockerfiles=$(ls internal/buildscripts/packaging/tests/images/deb/Dockerfile.* internal/buildscripts/packaging/tests/images/rpm/Dockerfile.* | cut -d '.' -f2- | sort -u) | |
if [ -z "$dockerfiles" ]; then | |
echo "Failed to get dockerfiles from internal/buildscripts/packaging/tests/images!" >&2 | |
exit 1 | |
fi | |
distro=$(for d in $dockerfiles; do echo -n "\"$d\","; done) | |
arch='"amd64","arm64"' | |
exclude='{"DISTRO": "opensuse-12", "ARCH": "arm64"}' # opensuse-12 (leap 42) does not support arm64 | |
matrix="{\"DISTRO\": [${distro%,}], \"ARCH\": [${arch}], \"exclude\": [${exclude}]}" | |
echo "$matrix" | jq | |
echo "matrix=${matrix}" >> $GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.get-matrix.outputs.matrix }} | |
linux-installer-script-test: | |
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved | |
runs-on: ${{ fromJSON('["ubuntu-20.04", "ubuntu-22.04"]')[matrix.DISTRO == 'amazonlinux-2023'] }} | |
needs: installer-test-matrix | |
strategy: | |
matrix: ${{ fromJSON(needs.installer-test-matrix.outputs.matrix) }} | |
fail-fast: false | |
env: | |
PYTHON_VERSION: '3.10' | |
PIP_VERSION: '22.0.4' | |
REQUIREMENTS_PATH: "internal/buildscripts/packaging/tests/requirements.txt" | |
RESULT_PATH: "~/testresults" | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
if: ${{ matrix.ARCH != 'amd64' }} | |
with: | |
platforms: ${{ matrix.ARCH }} | |
image: tonistiigi/binfmt:qemu-v7.0.0 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
cache-dependency-path: ${{ env.REQUIREMENTS_PATH }} | |
- name: Install pytest | |
run: | | |
if which pip; then | |
pip install --upgrade 'pip==${{ env.PIP_VERSION }}' | |
else | |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
python get-pip.py 'pip==${{ env.PIP_VERSION }}' | |
fi | |
pip install -r "${{ env.REQUIREMENTS_PATH }}" | |
- name: Test installer script | |
timeout-minutes: 60 | |
run: | | |
mkdir -p ${{ env.RESULT_PATH }} | |
distro="${{ matrix.DISTRO }}" | |
if [[ "$distro" = "amazonlinux-2" ]]; then | |
# workaround for pytest substring matching | |
distro="amazonlinux-2 and not amazonlinux-2023" | |
fi | |
pytest -n auto --verbose -k "$distro and ${{ matrix.ARCH }}" \ | |
--junitxml=${{ env.RESULT_PATH }}/results.xml \ | |
--html=${{ env.RESULT_PATH }}/results.html \ | |
--self-contained-html \ | |
internal/buildscripts/packaging/tests/installer_test.py | |
- name: Uploading artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-installer-script-test-${{ matrix.DISTRO }}-${{ matrix.ARCH }}-result | |
path: ${{ env.RESULT_PATH }} |