From cb4479d8ce9b3ac10d85930487d8ec697311116b Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 25 Jun 2025 16:23:09 +0800 Subject: [PATCH] (CI) factor out shared setup into standalone action --- .github/actions/setup-build-env/action.yml | 29 +++++++++++ .github/workflows/dart.yml | 58 +++++++++++----------- 2 files changed, 59 insertions(+), 28 deletions(-) create mode 100644 .github/actions/setup-build-env/action.yml diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml new file mode 100644 index 00000000..2cf857a1 --- /dev/null +++ b/.github/actions/setup-build-env/action.yml @@ -0,0 +1,29 @@ +name: 'Setup Build Environment' +description: 'Set up LLVM, MESA, and Flutter for builds' +runs: + using: 'composite' + steps: + - uses: actions/checkout@v4 + - name: Setup LLVM + uses: KyleMayes/install-llvm-action@v1 + with: + version: "16" + - name: Add LLVM to PATH + shell: bash + run: | + echo "${{ github.workspace }}/llvm/bin" >> $GITHUB_PATH + echo "LD_LIBRARY_PATH=${{ github.workspace }}/llvm/lib/x86_64-unknown-linux-gnu/" >> $GITHUB_ENV + - name: Verify installation + shell: bash + run: clang --version + - name: Install MESA + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y xvfb + sudo apt-get install -y libosmesa6-dev + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: master + architecture: X64 diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 3f9a370a..24658806 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -10,40 +10,42 @@ jobs: update-goldens: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - name: Setup LLVM - uses: KyleMayes/install-llvm-action@v1 - with: - version: "16" - - name: Add LLVM to PATH - run: | - echo "${{ github.workspace }}/llvm/bin" >> $GITHUB_PATH - echo "LD_LIBRARY_PATH=${{ github.workspace }}/llvm/lib/x86_64-unknown-linux-gnu/" >> $GITHUB_ENV - - name: Verify installation - run: clang --version - - name: Install MESA - run: | - sudo apt-get update - sudo apt-get install -y xvfb - sudo apt-get install -y libosmesa6-dev - #sudo apt-get -y build-dep mesa - #git clone https://gitlab.freedesktop.org/mesa/mesa.git - #cd mesa - #git checkout mesa-23.2.1 - #mkdir -p out - #meson setup builddir/ -Dprefix="$(pwd)/out" -Dosmesa=true -Dglx=xlib -Dgallium-drivers=swrast -Dvulkan-drivers=swrast - #meson install -C builddir/ + - uses: actions/checkout@v4 # This must come first! + - uses: ./.github/actions/setup-build-env + #- uses: actions/checkout@v4 + #- name: Setup LLVM + # uses: KyleMayes/install-llvm-action@v1 + # with: + # version: "16" + #- name: Add LLVM to PATH + # run: | + # echo "${{ github.workspace }}/llvm/bin" >> $GITHUB_PATH + # echo "LD_LIBRARY_PATH=${{ github.workspace }}/llvm/lib/x86_64-unknown-linux-gnu/" >> $GITHUB_ENV + #- name: Verify installation + # run: clang --version + #- name: Install MESA + # run: | + # sudo apt-get update + # sudo apt-get install -y xvfb + # sudo apt-get install -y libosmesa6-dev + # #sudo apt-get -y build-dep mesa + # #git clone https://gitlab.freedesktop.org/mesa/mesa.git + # #cd mesa + # #git checkout mesa-23.2.1 + # #mkdir -p out + # #meson setup builddir/ -Dprefix="$(pwd)/out" -Dosmesa=true -Dglx=xlib -Dgallium-drivers=swrast -Dvulkan-drivers=swrast + # #meson install -C builddir/ #- name: Install Vulkan SDK and dependencies # run: | # wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - # sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list # sudo apt-get update # sudo apt-get install -y vulkan-sdk - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: master - architecture: X64 + #- name: Set up Flutter + # uses: subosito/flutter-action@v2 + # with: + # channel: master + # architecture: X64 - run: cd thermion_dart && dart pub get && xvfb-run dart --enable-experiment=native-assets test test/asset_tests.dart - name: Zip goldens run: zip -r goldens.zip ./thermion_dart/test/output