|
| 1 | +# Reference Video: https://www.bilibili.com/video/BV1K9WNe1E4k |
| 2 | +name: build |
| 3 | +on: [push, pull_request] |
| 4 | +jobs: |
| 5 | + build: |
| 6 | + runs-on: ${{ matrix.os }} |
| 7 | + strategy: |
| 8 | + fail-fast: false |
| 9 | + matrix: |
| 10 | +# os: [windows-latest, macos-latest, ubuntu-latest] |
| 11 | + os: [windows-latest] |
| 12 | +# build_type: [RelWithDebInfo, Debug] |
| 13 | + build_type: [RelWithDebInfo] |
| 14 | +# ui: [gui, cli] |
| 15 | + ui: [gui] |
| 16 | +# scripting: [lua, noscripts] |
| 17 | + scripting: [lua] |
| 18 | + exclude: |
| 19 | + - build_type: Debug |
| 20 | + ui: gui |
| 21 | + - build_type: RelWithDebInfo |
| 22 | + ui: cli |
| 23 | + - build_type: RelWithDebInfo |
| 24 | + scripting: noscripts |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + submodules: 'recursive' |
| 29 | + - name: Install Dependencies |
| 30 | + if: runner.os == 'Linux' |
| 31 | + shell: bash |
| 32 | + run: | |
| 33 | + sudo apt-get update -qq |
| 34 | + sudo apt-get install -y \ |
| 35 | + libpixman-1-dev libfreetype6-dev libharfbuzz-dev zlib1g-dev \ |
| 36 | + libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev |
| 37 | + - name: Install Skia |
| 38 | + if: ${{ matrix.ui == 'gui' }} |
| 39 | + shell: bash |
| 40 | + run: | |
| 41 | + if [[ "${{ runner.os }}" == "Windows" ]] ; then |
| 42 | + this_dir=$(cygpath "${{ github.workspace }}") |
| 43 | + else |
| 44 | + this_dir="${{ github.workspace }}" |
| 45 | + fi |
| 46 | + skia_url=$(source $this_dir/laf/misc/skia-url.sh | xargs) |
| 47 | + skia_file=$(basename $skia_url) |
| 48 | + curl --ssl-revoke-best-effort -L -o "$skia_file" "$skia_url" |
| 49 | + unzip "$skia_file" -d skia |
| 50 | + - name: ccache |
| 51 | + uses: hendrikmuhs/ccache-action@v1.2.17 |
| 52 | + if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} |
| 53 | + with: |
| 54 | + key: ${{ matrix.os }}-${{ matrix.ui }}-${{ matrix.scripting }}-${{ matrix.build_type }} |
| 55 | + - uses: aseprite/get-ninja@main |
| 56 | + - uses: ilammy/msvc-dev-cmd@v1 |
| 57 | + if: runner.os == 'Windows' |
| 58 | + - name: Generating Makefiles |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + if [[ "${{ runner.os }}" == "Windows" ]] ; then |
| 62 | + export enable_ccache=off |
| 63 | + else |
| 64 | + export enable_ccache=on |
| 65 | + fi |
| 66 | + |
| 67 | + if [[ "${{ matrix.ui }}" == "gui" ]] ; then |
| 68 | + export laf_backend=skia |
| 69 | + else |
| 70 | + export laf_backend=none |
| 71 | + fi |
| 72 | + |
| 73 | + if [[ "${{ matrix.scripting }}" == "lua" ]] ; then |
| 74 | + export enable_scripting=on |
| 75 | + else |
| 76 | + export enable_scripting=off |
| 77 | + fi |
| 78 | + |
| 79 | + if [[ "${{ runner.os }}" == "macOS" ]] ; then |
| 80 | + export skia_arch=arm64 |
| 81 | + else |
| 82 | + export skia_arch=x64 |
| 83 | + fi |
| 84 | + |
| 85 | + cmake -S . -B build -G Ninja \ |
| 86 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
| 87 | + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \ |
| 88 | + -DENABLE_TESTS=ON \ |
| 89 | + -DENABLE_SCRIPTING=$enable_scripting \ |
| 90 | + -DENABLE_CCACHE=$enable_ccache \ |
| 91 | + -DLAF_BACKEND=$laf_backend \ |
| 92 | + -DSKIA_DIR=$(realpath skia) \ |
| 93 | + -DSKIA_LIBRARY_DIR=$(realpath skia/out/Release-$skia_arch) |
| 94 | + - name: Compiling |
| 95 | + shell: bash |
| 96 | + run: | |
| 97 | + cd build && ninja |
| 98 | +# - name: Running C++ Tests |
| 99 | +# shell: bash |
| 100 | +# run: | |
| 101 | +# if [[ "${{ runner.os }}" == "Linux" ]] ; then |
| 102 | +# export XVFB=xvfb-run |
| 103 | +# fi |
| 104 | +# cd build && $XVFB ctest --output-on-failure |
| 105 | +# - name: Running CLI Tests |
| 106 | +# if: ${{ matrix.scripting == 'lua' }} |
| 107 | +# shell: bash |
| 108 | +# run: | |
| 109 | +# if [[ "${{ runner.os }}" == "Linux" ]] ; then |
| 110 | +# export XVFB=xvfb-run |
| 111 | +# fi |
| 112 | +# export ASEPRITE=$PWD/build/bin/aseprite |
| 113 | +# cd tests |
| 114 | +# $XVFB bash run-tests.sh |
| 115 | + - uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: aseprite |
| 118 | + path: | |
| 119 | + D:/a/aseprite/aseprite/build/bin/data |
| 120 | + D:/a/aseprite/aseprite/build/bin/aseprite.exe |
0 commit comments