name: Test Supported Distributions on: pull_request: types: [opened, synchronize, reopened, ready_for_review] permissions: contents: read jobs: # JOB to run change detection changes: runs-on: ubuntu-latest # Set job outputs to values from filter step outputs: requires-distro-test: ${{ steps.filter.outputs.requires-distro-test }} steps: - name: Checkout Repo uses: actions/checkout@v3.0.2 - name: Check which files have been touched uses: dorny/paths-filter@v2.10.2 id: filter with: filters: | requires-distro-test: - 'advanced/**' - 'automated install/**' - 'manpages/**' - 'test/**' - 'gravity.sh' - 'pihole' - '.github/workflows/test.yml' smoke-tests: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3.0.2 - name: Check scripts in repository are executable if: ${{ needs.changes.outputs.requires-distro-test == 'true' }} run: | IFS=$'\n'; for f in $(find . -name '*.sh'); do if [[ ! -x $f ]]; then echo "$f is not executable" && FAIL=1; fi ;done unset IFS; # If FAIL is 1 then we fail. [[ $FAIL == 1 ]] && exit 1 || echo "Scripts are executable!" - name: Spell-Checking uses: codespell-project/actions-codespell@master with: ignore_words_file: .codespellignore - name: Get editorconfig-checker uses: editorconfig-checker/action-editorconfig-checker@main # tag v1.0.0 is really out of date - name: Run editorconfig-checker run: editorconfig-checker distro-test: needs: [ smoke-tests, changes ] if: ${{ github.event.pull_request.draft == false }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: distro: [debian_10, debian_11, ubuntu_18, ubuntu_20, ubuntu_22, centos_8, fedora_34] env: DISTRO: ${{matrix.distro}} steps: - name: Checkout repository if: ${{ needs.changes.outputs.requires-distro-test == 'true' }} uses: actions/checkout@v3.0.2 - name: Set up Python 3.8 if: ${{ needs.changes.outputs.requires-distro-test == 'true' }} uses: actions/setup-python@v4.1.0 with: python-version: 3.8 - name: Install dependencies if: ${{ needs.changes.outputs.requires-distro-test == 'true' }} run: pip install -r test/requirements.txt - name: Test with tox if: ${{ needs.changes.outputs.requires-distro-test == 'true' }} run: tox -c test/tox.${DISTRO}.ini - name: Passed with nothing to do if: ${{ needs.changes.outputs.requires-distro-test == 'false' }} run: echo "Nothing to test!"