diff --git .github/workflows/run-tests.yml .github/workflows/run-tests.yml new file mode 100644 index 000000000..97321590e --- /dev/null +++ .github/workflows/run-tests.yml @@ -0,0 +1,56 @@ +name: Run Tests + +on: [push] + +jobs: + run-tests-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get -y update + sudo apt-get -ym install libbz2-dev zlib1g-dev libpng-dev autoconf clang-10 ccache moreutils + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ccache:${{ github.job }}:${{ github.ref }}:${{ github.sha }} + restore-keys: | + ccache:${{ github.job }}:${{ github.ref }} + ccache:${{ github.job }} + - name: Configure Simutrans Build + run: | + autoconf + CC="ccache clang-10" CXX="ccache clang++-10" ./configure + echo "FLAGS += -fsanitize=address,undefined -fno-sanitize-recover=all -fno-sanitize=shift,function" >> config.default + echo "LDFLAGS += -fsanitize=address,undefined" >> config.default + - name: Build Simutrans + run: | + CC="ccache clang-10" CXX="ccache clang++-10" make -j$(nproc) + - name: Install pak64 + run: | + pushd simutrans + printf '1\ni\ny\n' | ../get_pak.sh + popd + - name: Create simuconf + run: | + mkdir ~/simutrans/ + echo "frames_per_second = 100" >> ~/simutrans/simuconf.tab + echo "fast_forward_frames_per_second = 100" >> ~/simutrans/simuconf.tab + - name: Checkout tests + uses: actions/checkout@v2 + with: + repository: 'ceeac/simutrans-tests' + path: 'tests' + ref: master + - name: Link tests as scenario + run: | + mkdir -p ./simutrans/pak/scenario + ln -sT $GITHUB_WORKSPACE/tests/src ./simutrans/pak/scenario/automated-tests + - name: Run tests + run: | + export ASAN_OPTIONS="print_stacktrace=1 abort_on_error=1 detect_leaks=0" + export UBSAN_OPTIONS="print_stacktrace=1 abort_on_error=1" + tests/scripts/run-automated-tests.sh