Skip to content

ci: fix autofix bot not adding comments (#3685) #1

ci: fix autofix bot not adding comments (#3685)

ci: fix autofix bot not adding comments (#3685) #1

Workflow file for this run

name: General build matrix
on:
push:
branches:
- upload
paths-ignore:
- doc/**
- 'scripts/**'
merge_group:
pull_request:
branches:
- upload
paths-ignore:
- doc/**
- 'scripts/**'
# Cancel all previous instances in favor of latest revision of a PR.
# Allow running upload builds to complete to help with ccache refreshes.
concurrency:
group: general-build-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
skip-duplicates-code:
continue-on-error: true
runs-on: ubuntu-22.04
# Map a step output to a job output
outputs:
should_skip_code: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
paths_ignore: '["android/**", "build-data/osx/**", "doc/**", "doxygen_doc/**", "msvc-**", "tools/**", "utilities/**", "scripts/**", "data/**", "lang/**"]'
skip-duplicates-data:
continue-on-error: true
runs-on: ubuntu-22.04
# Map a step output to a job output
outputs:
should_skip_data: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
paths_ignore: '["android/**", "build-data/osx/**", "doc/**", "doxygen_doc/**", "msvc-**", "tools/**", "utilities/**", "scripts/**"]'
matrix-variables:
permissions:
contents: none
continue-on-error: true
runs-on: ubuntu-latest
outputs:
fail_fast: ${{ steps.matrix_vars.outputs.fail_fast }}
skip_tests: ${{ steps.matrix_vars.outputs.skip_tests }}
max_parallel: ${{ steps.matrix_vars.outputs.max_parallel }}
steps:
- id: matrix_vars
run: |
echo "fail_fast=$([ "$GITHUB_REF_NAME" = "upload" ] && echo false || echo true)" >> $GITHUB_OUTPUT
echo "skip_tests=$([ "$GITHUB_REF_NAME" = "upload" ] && echo true || echo false)" >> $GITHUB_OUTPUT
echo "max_parallel=$([ "$GITHUB_REF_NAME" = "upload" ] && echo 20 || echo 1)" >> $GITHUB_OUTPUT
varied_builds:
needs: [ skip-duplicates-code, skip-duplicates-data, matrix-variables ]
strategy:
fail-fast: ${{ fromJSON(needs.matrix-variables.outputs.fail_fast) }}
max-parallel: ${{ fromJSON(needs.matrix-variables.outputs.max_parallel) }}
matrix:
include:
- title: GCC 12, Ubuntu, Curses
compiler: g++-12
os: ubuntu-22.04
cmake: 0
tiles: 0
sound: 0
lua: 0
test-stage: 1
libbacktrace: 1
native: linux64
ccache_limit: 2G
ccache_key: linux-gcc-12
run-on-draft: true
- title: GCC 12, Ubuntu, Tiles, Sound, Lua, CMake, Languages
compiler: g++-12
os: ubuntu-22.04
cmake: 1
tiles: 1
sound: 1
lua: 1
languages: all
native: linux64
ccache_limit: 2G
ccache_key: linux-gcc-12-cmake-tiles
upload-artifact: true
- title: GCC 12, Ubuntu, Tiles, Sound, Lua
compiler: g++-12
os: ubuntu-22.04
cmake: 0
tiles: 1
sound: 1
lua: 1
test-stage: 1
libbacktrace: 1
native: linux64
ccache_limit: 1G
ccache_key: linux-gcc-12-tiles
# === Temporarily disabled because of #3664 ===
# - title: GCC 12, Ubuntu, Tiles, NoSound, ASan
# compiler: g++-12
# os: ubuntu-22.04
# cmake: 0
# tiles: 1
# sound: 0
# lua: 0
# sanitize: address
# native: linux64
# ccache_limit: 2G
# ccache_key: linux-gcc-12-asan
# === Temporarily disabled because of #3664 ===
# - title: Clang 14, Ubuntu, Tiles, NoSound, ASan, UBSan
# compiler: clang++-14
# os: ubuntu-22.04
# cmake: 0
# tiles: 1
# sound: 0
# lua: 0
# sanitize: address,undefined
# cxxflags: --gcc-toolchain=/opt/mock-gcc-11
# native: linux64
# ccache_limit: 2G
# ccache_key: linux-llvm-14-asan
- title: Clang 14, macOS 12, Tiles, Sound, Localize, Lua
compiler: clang++
os: macos-12
cmake: 0
tiles: 1
sound: 1
lua: 1
test-stage: 1
native: osx
grep_clang_version_rxp: "14\\.[0-9]+\\.[0-9]+"
ccache_limit: 1G # avg. 980MB~1100MB
ccache_key: macos-llvm-14
name: ${{ matrix.title }}
runs-on: ${{ matrix.os }}
env:
ZSTD_CLEVEL: 17
CMAKE: ${{ matrix.cmake }}
COMPILER: ${{ matrix.compiler }}
CXXFLAGS: ${{ matrix.cxxflags }}
OS: ${{ matrix.os }}
TILES: ${{ matrix.tiles }}
SOUND: ${{ matrix.sound }}
LUA: ${{ matrix.lua }}
SANITIZE: ${{ matrix.sanitize }}
TEST_STAGE: ${{ matrix.test-stage }}
LANGUAGES: ${{ matrix.languages }}
LIBBACKTRACE: ${{ matrix.libbacktrace }}
NATIVE: ${{ matrix.native }}
RELEASE: 1
CCACHE_LIMIT: ${{ matrix.ccache_limit }}
CCACHE_FILECLONE: true
CCACHE_HARDLINK: true
CCACHE_NOCOMPRESS: true
SKIP: ${{ ( github.event.pull_request.draft == true && matrix.run-on-draft == 'true' ) || ( needs.skip-duplicates-code.outputs.should_skip_code == 'true' ) || ( needs.skip-duplicates-data.outputs.should_skip_data == 'true' ) }}
SKIP_TESTS: ${{ needs.matrix-variables.outputs.skip_tests }}
steps:
- name: checkout repository
if: ${{ env.SKIP == 'false' }}
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: install dependencies (ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install libncursesw5-dev ccache gettext parallel
sudo locale-gen en_US.UTF-8 fr_FR.UTF-8 ru_RU.UTF-8
- name: install SDL2 dependencies (ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && matrix.tiles == 1 }}
run: |
sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev libflac-dev
- name: check compiler (mac)
if: ${{ env.SKIP == 'false' && runner.os == 'macOS' }}
run: |
${{ matrix.compiler }} --version
# Ensure that it is actually needed version
${{ matrix.compiler }} --version | grep -q -E "${{ matrix.grep_clang_version_rxp }}"
- name: set up a mock GCC toolchain root for Clang (Ubuntu)
if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && (matrix.compiler == 'clang++-14') }}
run: |
sudo mkdir /opt/mock-gcc-11
sudo ln -s /usr/include /opt/mock-gcc-11/include
sudo ln -s /usr/bin /opt/mock-gcc-11/bin
sudo mkdir -p /opt/mock-gcc-11/lib/gcc/x86_64-linux-gnu
sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/11 /opt/mock-gcc-11/lib/gcc/x86_64-linux-gnu/11
- name: install dependencies (mac)
if: ${{ env.SKIP == 'false' && runner.os == 'macOS' }}
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext ccache parallel
- name: prepare
if: ${{ env.SKIP == 'false' }}
run: bash ./build-scripts/requirements.sh
- name: Get ccache vars
id: get-ccache-vars
if: ${{ env.SKIP == 'false' }}
shell: bash
run: |
echo "datetime=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT
echo "ccache-path=$([ "$RUNNER_OS" = "macOS" ] && echo '/Users/runner/Library/Caches/ccache' || echo '~/.cache/ccache')" >> $GITHUB_OUTPUT
- name: ccache cache files
if: ${{ env.SKIP == 'false' && ( runner.os == 'Linux' || runner.os == 'macOS' ) }}
uses: actions/cache@v3
id: cache
with:
path: ${{ steps.get-ccache-vars.outputs.ccache-path }}
# double-dash after compiler is not a typo, it is to disambiguate between g++-<date> and g++-11-<date> for restore key prefix matching
key: ccache-${{ github.ref_name }}-${{ matrix.ccache_key }}--${{ steps.get-ccache-vars.outputs.datetime }}
restore-keys: ccache-upload-${{ matrix.ccache_key }}--
- name: ccache info
if: ${{ env.SKIP == 'false' && steps.cache.outputs.cache-hit != 'true' }}
run: |
echo CCache failed to restore from cache, emmiting stats
ccache --show-stats --verbose
- uses: ammaraskar/gcc-problem-matcher@master
- name: build
if: ${{ env.SKIP == 'false' }}
run: bash ./build-scripts/gha_compile_only.sh
- name: post-build ccache stats and cleanup
if: ${{ env.SKIP == 'false' && !failure() && (runner.os == 'Linux' || runner.os == 'macOS') }}
run: |
ccache --show-stats --verbose
ccache --max-size ${{ env.CCACHE_LIMIT }}
ccache --cleanup
ccache --show-stats --verbose
- name: clear ccache on PRs
if: ${{ github.ref_name != 'upload' && env.SKIP == 'false' && !failure() && (runner.os == 'Linux' || runner.os == 'macOS') }}
run: ccache --clear
- name: run tests
if: ${{ env.SKIP == 'false' && env.SKIP_TESTS == 'false' }}
run: bash ./build-scripts/gha_test_only.sh
- name: emit success artifact
if: ${{ success() && matrix.upload-artifact == 'true' }}
uses: actions/[email protected]
with:
name: ${{ github.event.number }}
path: ${{ github.event.number }}
- name: upload artifacts if failed
uses: actions/[email protected]
if: failure()
with:
name: cata_test
path: tests/cata_test
if-no-files-found: ignore