Enable pytype for python 3.12. #3308
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: Integration tests | |
on: [push, pull_request] | |
env: | |
FILES_CHANGED: "all" | |
MATRIX_SHARDS: 10 | |
jobs: | |
sanity-tests: | |
name: Sanity tests | |
runs-on: ubuntu-22.04 | |
container: | |
image: faucet/test-base:latest | |
options: --privileged --cap-add=ALL -v /lib/modules:/lib/modules -v /var/local/lib/docker:/var/lib/docker --sysctl net.ipv6.conf.all.disable_ipv6=0 --ulimit core=-1 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- if: ${{ github.event_name == 'pull_request' }} | |
name: Setup dependencies for changed files action | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y jq | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- if: ${{ github.event_name == 'pull_request' }} | |
name: Get file changes | |
id: file_changes | |
uses: tj-actions/changed-files@v44 | |
with: | |
json: true | |
escape_json: false | |
- if: ${{ steps.file_changes.outputs.all_changed_files }} | |
name: Compare file changes | |
run: | | |
FILES_ALL="$(echo '${{ steps.file_changes.outputs.all_changed_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_ADDED="$(echo '${{ steps.file_changes.outputs.added_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_DELETED="$(echo '${{ steps.file_changes.outputs.deleted_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_RENAMED="$(echo '${{ steps.file_changes.outputs.renamed_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_MODIFIED="$(echo '${{ steps.file_changes.outputs.modified_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_ADDED_MODIFIED="${FILES_ADDED} ${FILES_MODIFIED}" | |
PY_FILES_CHANGED="$(echo ${FILES_ADDED_MODIFIED} | tr ' ' '\n' | grep -E '\.py$' | tr '\n' ' ')" | |
CI_TEST_FILES_CHANGED="$(echo ${FILES_ADDED_MODIFIED} | tr ' ' '\n' | grep -E '(workflows\/tests-.+\.yml$|Dockerfile\.tests$|^docker\/.+$|tests\/.+\.sh$)' | tr '\n' ' ')" | |
RQ_FILES_CHANGED="$(echo ${FILES_ADDED_MODIFIED} | tr ' ' '\n' | grep -E 'requirements(.*)txt$' | tr '\n' ' ')" | |
DOC_FILES_CHANGED="$(echo ${FILES_ADDED_MODIFIED} | tr ' ' '\n' | grep -E '^docs/.+$' | tr '\n' ' ')" | |
if [ ! -z "${CI_TEST_FILES_CHANGED}" ]; then FILES_CHANGED="all"; else FILES_CHANGED="${FILES_ADDED_MODIFIED}"; fi | |
echo "Git added/modified: ${FILES_ADDED_MODIFIED}" | |
echo "CI test files changed: ${CI_TEST_FILES_CHANGED}" | |
echo "Python code changed: ${PY_FILES_CHANGED}" | |
echo "Requirement changes: ${RQ_FILES_CHANGED}" | |
echo "Documentation changes: ${DOC_FILES_CHANGED}" | |
echo "Files changed: ${FILES_CHANGED}" | |
echo "FILES_CHANGED=${FILES_CHANGED}" >> ${GITHUB_ENV} | |
echo "PY_FILES_CHANGED=${PY_FILES_CHANGED}" >> ${GITHUB_ENV} | |
echo "RQ_FILES_CHANGED=${RQ_FILES_CHANGED}" >> ${GITHUB_ENV} | |
echo "DOC_FILES_CHANGED=${DOC_FILES_CHANGED}" >> ${GITHUB_ENV} | |
- if: ${{ env.FILES_CHANGED == 'all' || env.PY_FILES_CHANGED || env.RQ_FILES_CHANGED }} | |
name: Initialise environment | |
run: | | |
sysctl --quiet -w kernel.core_pattern="/var/tmp/core.%h.%e.%t" | |
modprobe openvswitch | |
modprobe ebtables | |
ln -s "$(pwd)" /faucet-src | |
- if: ${{ env.FILES_CHANGED == 'all' || env.PY_FILES_CHANGED || env.RQ_FILES_CHANGED }} | |
name: Run sanity tests | |
run: | | |
./docker/runtests.sh | |
env: | |
FAUCET_TESTS: "-ni FaucetSanityTest FaucetStackStringOfDPUntaggedTest" | |
HWTESTS: 1 | |
- name: Detect core dumps | |
run: | | |
if [ ls -1 /var/tmp/core* > /dev/null 2>&1 ]; then | |
exit 1 | |
fi | |
integration-tests: | |
name: Integration tests | |
runs-on: ubuntu-22.04 | |
needs: sanity-tests | |
container: | |
image: faucet/test-base:latest | |
options: --privileged --cap-add=ALL -v /lib/modules:/lib/modules -v /var/local/lib/docker:/var/lib/docker --sysctl net.ipv6.conf.all.disable_ipv6=0 --ulimit core=-1 | |
strategy: | |
matrix: | |
MATRIX_SHARD: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- if: ${{ github.event_name == 'pull_request' && github.event.before != '0000000000000000000000000000000000000000' }} | |
name: Setup dependencies for changed files action | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y jq | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- if: ${{ github.event_name == 'pull_request' && github.event.before != '0000000000000000000000000000000000000000' }} | |
name: Get file changes | |
id: file_changes | |
uses: tj-actions/changed-files@v44 | |
with: | |
json: true | |
escape_json: false | |
- if: ${{ steps.file_changes.outputs.all_changed_files }} | |
name: Compare file changes | |
run: | | |
FILES_ALL="$(echo '${{ steps.file_changes.outputs.all_changed_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_ADDED="$(echo '${{ steps.file_changes.outputs.added_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_DELETED="$(echo '${{ steps.file_changes.outputs.deleted_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_RENAMED="$(echo '${{ steps.file_changes.outputs.renamed_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_MODIFIED="$(echo '${{ steps.file_changes.outputs.modified_files }}' | jq -r '.[]' | tr '\n' ' ')" | |
FILES_ADDED_MODIFIED="${FILES_ADDED} ${FILES_MODIFIED}" | |
PY_FILES_CHANGED="$(echo ${FILES_ADDED_MODIFIED} | tr ' ' '\n' | grep -E '\.py$' | tr '\n' ' ')" | |
CI_TEST_FILES_CHANGED="$(echo ${FILES_ADDED_MODIFIED} | tr ' ' '\n' | grep -E '(workflows\/tests-.+\.yml$|Dockerfile\.tests$|^docker\/.+$|tests\/.+\.sh$)' | tr '\n' ' ')" | |
RQ_FILES_CHANGED="$(echo ${FILES_ADDED_MODIFIED} | tr ' ' '\n' | grep -E 'requirements(.*)txt$' | tr '\n' ' ')" | |
DOC_FILES_CHANGED="$(echo ${FILES_ADDED_MODIFIED} | tr ' ' '\n' | grep -E '^docs/.+$' | tr '\n' ' ')" | |
if [ ! -z "${CI_TEST_FILES_CHANGED}" ]; then FILES_CHANGED="all"; else FILES_CHANGED="${FILES_ADDED_MODIFIED}"; fi | |
echo "Git added/modified: ${FILES_ADDED_MODIFIED}" | |
echo "CI test files changed: ${CI_TEST_FILES_CHANGED}" | |
echo "Python code changed: ${PY_FILES_CHANGED}" | |
echo "Requirement changes: ${RQ_FILES_CHANGED}" | |
echo "Documentation changes: ${DOC_FILES_CHANGED}" | |
echo "Files changed: ${FILES_CHANGED}" | |
echo "FILES_CHANGED=${FILES_CHANGED}" >> ${GITHUB_ENV} | |
echo "PY_FILES_CHANGED=${PY_FILES_CHANGED}" >> ${GITHUB_ENV} | |
echo "RQ_FILES_CHANGED=${RQ_FILES_CHANGED}" >> ${GITHUB_ENV} | |
echo "DOC_FILES_CHANGED=${DOC_FILES_CHANGED}" >> ${GITHUB_ENV} | |
- if: ${{ env.FILES_CHANGED == 'all' || env.PY_FILES_CHANGED || env.RQ_FILES_CHANGED }} | |
name: Initialise environment | |
run: | | |
sysctl --quiet -w kernel.core_pattern="/var/tmp/core.%h.%e.%t" | |
modprobe openvswitch | |
modprobe ebtables | |
ln -s "$(pwd)" /faucet-src | |
- if: ${{ env.FILES_CHANGED == 'all' || env.PY_FILES_CHANGED || env.RQ_FILES_CHANGED }} | |
name: Shard tests | |
run: | | |
shard_tests=$(./docker/shard_tests.sh "${{ env.MATRIX_SHARDS }}" "${{ matrix.MATRIX_SHARD }}") | |
faucet_tests="-din ${shard_tests}" | |
echo "Running the following faucet tests on this shard: ${shard_tests}" | |
echo "FAUCET_TESTS=${faucet_tests}" >> ${GITHUB_ENV} | |
- if: ${{ env.FILES_CHANGED == 'all' || env.PY_FILES_CHANGED || env.RQ_FILES_CHANGED }} | |
name: Run integration tests | |
run: | | |
./docker/runtests.sh | |
- name: Detect core dumps | |
run: | | |
if [ ls -1 /var/tmp/core* > /dev/null 2>&1 ]; then | |
exit 1 | |
fi |