From 36417fc49defabc17a3ac8c3c39f71dcb239455b Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Mon, 6 May 2024 17:23:58 +0800 Subject: [PATCH 1/7] build: add pr status check-point --- .github/workflows/merge-queue.yml | 5 +++++ .github/workflows/pull-request.yml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml index 56c617e..b279c11 100644 --- a/.github/workflows/merge-queue.yml +++ b/.github/workflows/merge-queue.yml @@ -1,4 +1,5 @@ name: Merge Queue CI + on: merge_group: # schedule: @@ -153,6 +154,10 @@ jobs: name: verso-${{ matrix.platform.target }} path: verso-${{ matrix.platform.target }}.tar.gz + pr-check: + needs: ['build-macos', 'build-windows', 'build-linux'] + runs-on: ubuntu-latest + release-nightly: if: ${{ github.event_name == 'schedule' }} runs-on: ubuntu-latest diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index ca22d10..3b66dd9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -6,7 +6,7 @@ on: - mq-test jobs: - check-linux: + pr-check: name: Check [Linux] runs-on: ubuntu-latest steps: From 0edd220a4afbccb0f1fa6a0b57cb7b487b555d1c Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Mon, 6 May 2024 17:33:01 +0800 Subject: [PATCH 2/7] fix workfile --- .github/workflows/merge-queue.yml | 2 ++ .github/workflows/pull-request.yml | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml index b279c11..4a57658 100644 --- a/.github/workflows/merge-queue.yml +++ b/.github/workflows/merge-queue.yml @@ -157,6 +157,8 @@ jobs: pr-check: needs: ['build-macos', 'build-windows', 'build-linux'] runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 release-nightly: if: ${{ github.event_name == 'schedule' }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3b66dd9..e9568ea 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,7 +7,6 @@ on: jobs: pr-check: - name: Check [Linux] runs-on: ubuntu-latest steps: - name: Checkout the repository From 366206b836213c68573ec5b2a42c634493ba553a Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Mon, 6 May 2024 17:51:18 +0800 Subject: [PATCH 3/7] build: merge workflow to one file --- .github/workflows/build.yml | 44 +++++- .github/workflows/merge-queue.yml | 210 ----------------------------- .github/workflows/pull-request.yml | 37 ----- 3 files changed, 40 insertions(+), 251 deletions(-) delete mode 100644 .github/workflows/merge-queue.yml delete mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9d6a7c..9db7b69 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,12 @@ -name: Continuous Integration +name: Merge Queue CI on: + merge_group: pull_request: branches: - - main - schedule: - - cron: '0 0 * * *' + - mq-test + # schedule: + # - cron: '0 0 * * *' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -16,6 +17,7 @@ env: jobs: build-linux: + if: ${{ github.event_name != 'pull_request' }} name: Build [Linux] runs-on: ubuntu-latest env: @@ -77,6 +79,7 @@ jobs: path: verso-x86_64-unknown-linux-gnu.tar.gz build-windows: + if: ${{ github.event_name != 'pull_request' }} name: Build [Windows] runs-on: windows-latest env: @@ -115,6 +118,7 @@ jobs: path: verso-x86_64-pc-windows-msvc.tar.gz build-macos: + if: ${{ github.event_name != 'pull_request' }} name: Build [macOS] strategy: fail-fast: false @@ -156,6 +160,38 @@ jobs: name: verso-${{ matrix.platform.target }} path: verso-${{ matrix.platform.target }}.tar.gz + pr-fast-check: + if: ${{ github.event_name != 'merge_group' }} + name: Pull Request Fast Check + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Install Rust + uses: dsherret/rust-toolchain-file@v1 + + - name: Set env + run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt install build-essential python3-pip ccache clang cmake curl \ + g++ git gperf libdbus-1-dev libfreetype6-dev libgl1-mesa-dri \ + libgles2-mesa-dev libglib2.0-dev libgstreamer-plugins-base1.0-dev \ + gstreamer1.0-plugins-good libgstreamer-plugins-good1.0-dev \ + gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev \ + gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base \ + libgstreamer-plugins-base1.0-dev gstreamer1.0-libav \ + libgstrtspserver-1.0-dev gstreamer1.0-tools libges-1.0-dev \ + libharfbuzz-dev liblzma-dev libunwind-dev libunwind-dev libvulkan1 \ + libx11-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \ + libxmu-dev libxmu6 libegl1-mesa-dev llvm-dev m4 xorg-dev sway + + - name: Check + run: cargo check + release-nightly: if: ${{ github.event_name == 'schedule' }} runs-on: ubuntu-latest diff --git a/.github/workflows/merge-queue.yml b/.github/workflows/merge-queue.yml deleted file mode 100644 index 4a57658..0000000 --- a/.github/workflows/merge-queue.yml +++ /dev/null @@ -1,210 +0,0 @@ -name: Merge Queue CI - -on: - merge_group: - # schedule: - # - cron: '0 0 * * *' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - CN_APP_SLUG: verso-nightly - -jobs: - build-linux: - name: Build [Linux] - runs-on: ubuntu-latest - env: - RUSTC_WRAPPER: sccache - CCACHE: sccache - SCCACHE_GHA_ENABLED: 'true' - WAYLAND_DISPLAY: wayland-1 - WLR_BACKENDS: headless - WLR_LIBINPUT_NO_DEVICES: 1 - XDG_RUNTIME_DIR: /tmp - XDG_SESSION_TYPE: wayland - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - - - name: Install Rust - uses: dsherret/rust-toolchain-file@v1 - - - name: Set env - run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt install build-essential python3-pip ccache clang cmake curl \ - g++ git gperf libdbus-1-dev libfreetype6-dev libgl1-mesa-dri \ - libgles2-mesa-dev libglib2.0-dev libgstreamer-plugins-base1.0-dev \ - gstreamer1.0-plugins-good libgstreamer-plugins-good1.0-dev \ - gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev \ - gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base \ - libgstreamer-plugins-base1.0-dev gstreamer1.0-libav \ - libgstrtspserver-1.0-dev gstreamer1.0-tools libges-1.0-dev \ - libharfbuzz-dev liblzma-dev libunwind-dev libunwind-dev libvulkan1 \ - libx11-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \ - libxmu-dev libxmu6 libegl1-mesa-dev llvm-dev m4 xorg-dev sway - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - - name: Build - run: | - cargo build --release - - - name: Test - # Run sway(wayland compositor) in the background, winit will use it - run: | - sway > /dev/null 2>&1 & - cargo test --release - - - name: Tar Binary - if: ${{ github.event_name == 'schedule' }} - run: tar -czvf verso-x86_64-unknown-linux-gnu.tar.gz -C ./target/release/ verso - - - name: Upload artifact - if: ${{ github.event_name == 'schedule' }} - uses: actions/upload-artifact@v4 - with: - name: verso-x86_64-unknown-linux-gnu - path: verso-x86_64-unknown-linux-gnu.tar.gz - - build-windows: - name: Build [Windows] - runs-on: windows-latest - env: - CCACHE: sccache - SCCACHE_GHA_ENABLED: 'true' - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - - - name: Install Rust - uses: dsherret/rust-toolchain-file@v1 - - - name: Install scroop - uses: MinoruSekine/setup-scoop@v3 - - - name: Install dependencies - run: scoop install git python llvm cmake curl - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - - name: Build - run: | - cargo build --release - cargo test --release - - - name: Tar Binary - if: ${{ github.event_name == 'schedule' }} - run: tar -czvf verso-x86_64-pc-windows-msvc.tar.gz -C ./target/release/ verso.exe - - - name: Upload artifact - if: ${{ github.event_name == 'schedule' }} - uses: actions/upload-artifact@v4 - with: - name: verso-x86_64-pc-windows-msvc - path: verso-x86_64-pc-windows-msvc.tar.gz - - build-macos: - name: Build [macOS] - strategy: - fail-fast: false - matrix: - platform: - - { target: aarch64-apple-darwin, os: macos-14 } - - { target: x86_64-apple-darwin, os: macos-13 } - runs-on: ${{ matrix.platform.os }} - env: - RUSTC_WRAPPER: sccache - CCACHE: sccache - SCCACHE_GHA_ENABLED: 'true' - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - - - name: Install Rust - uses: dsherret/rust-toolchain-file@v1 - - - name: Install dependencies - run: brew install cmake pkg-config - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - - name: Build - run: | - cargo build --release - cargo test --release - - - name: Tar Binary - if: ${{ github.event_name == 'schedule' }} - run: tar -czvf verso-${{ matrix.platform.target }}.tar.gz -C ./target/release/ verso - - - name: Upload artifact - if: ${{ github.event_name == 'schedule' }} - uses: actions/upload-artifact@v4 - with: - name: verso-${{ matrix.platform.target }} - path: verso-${{ matrix.platform.target }}.tar.gz - - pr-check: - needs: ['build-macos', 'build-windows', 'build-linux'] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - release-nightly: - if: ${{ github.event_name == 'schedule' }} - runs-on: ubuntu-latest - needs: ['build-macos', 'build-windows', 'build-linux'] - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - - - name: Fetch Verso version - run: | - echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')-$(date '+%Y%m%d')-nightly" >> $GITHUB_ENV - - - name: Draft release - uses: crabnebula-dev/cloud-release@v0.1.0 - id: draft - with: - command: release draft ${{ env.CN_APP_SLUG }} $VERSO_VERSION - api-key: ${{ secrets.CN_API_KEY }} - - - name: Upload macOS binary (ARM) - uses: crabnebula-dev/cloud-release@v0.1.0 - with: - command: release upload --file "verso-aarch64-apple-darwin/verso-aarch64-apple-darwin.tar.gz" ${{ env.CN_APP_SLUG }} $VERSO_VERSION - api-key: ${{ secrets.CN_API_KEY }} - - - name: Upload macOS binary (Intel) - uses: crabnebula-dev/cloud-release@v0.1.0 - with: - command: release upload --file "verso-x86_64-apple-darwin/verso-x86_64-apple-darwin.tar.gz" ${{ env.CN_APP_SLUG }} $VERSO_VERSION - api-key: ${{ secrets.CN_API_KEY }} - - - name: Upload Windows binary - uses: crabnebula-dev/cloud-release@v0.1.0 - with: - command: release upload --file "verso-x86_64-pc-windows-msvc/verso-x86_64-pc-windows-msvc.tar.gz" ${{ env.CN_APP_SLUG }} $VERSO_VERSION - api-key: ${{ secrets.CN_API_KEY }} - - - name: Upload Linux binary - uses: crabnebula-dev/cloud-release@v0.1.0 - with: - command: release upload --file "verso-x86_64-unknown-linux-gnu/verso-x86_64-unknown-linux-gnu.tar.gz" ${{ env.CN_APP_SLUG }} $VERSO_VERSION - api-key: ${{ secrets.CN_API_KEY }} - - - name: Publish release - uses: crabnebula-dev/cloud-release@v0.1.0 - with: - command: release publish ${{ env.CN_APP_SLUG }} $VERSO_VERSION - api-key: ${{ secrets.CN_API_KEY }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index e9568ea..0000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Pull Request CI - -on: - pull_request: - branches: - - mq-test - -jobs: - pr-check: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - - - name: Install Rust - uses: dsherret/rust-toolchain-file@v1 - - - name: Set env - run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt install build-essential python3-pip ccache clang cmake curl \ - g++ git gperf libdbus-1-dev libfreetype6-dev libgl1-mesa-dri \ - libgles2-mesa-dev libglib2.0-dev libgstreamer-plugins-base1.0-dev \ - gstreamer1.0-plugins-good libgstreamer-plugins-good1.0-dev \ - gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev \ - gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base \ - libgstreamer-plugins-base1.0-dev gstreamer1.0-libav \ - libgstrtspserver-1.0-dev gstreamer1.0-tools libges-1.0-dev \ - libharfbuzz-dev liblzma-dev libunwind-dev libunwind-dev libvulkan1 \ - libx11-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \ - libxmu-dev libxmu6 libegl1-mesa-dev llvm-dev m4 xorg-dev sway - - - name: Check - run: cargo check From 48d354c2bf20934e99526a86f19877bae4a1fe46 Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Mon, 6 May 2024 17:52:29 +0800 Subject: [PATCH 4/7] change trigger --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9db7b69..c329c63 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -161,7 +161,7 @@ jobs: path: verso-${{ matrix.platform.target }}.tar.gz pr-fast-check: - if: ${{ github.event_name != 'merge_group' }} + if: ${{ github.event_name == 'pull_request' }} name: Pull Request Fast Check runs-on: ubuntu-latest steps: From 3064a3d096baa1daf0245257a90d2012d59daed9 Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Mon, 6 May 2024 18:44:07 +0800 Subject: [PATCH 5/7] rename --- .github/workflows/build.yml | 66 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c329c63..3f2edc1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Merge Queue CI +name: Continuous Integration on: merge_group: @@ -16,6 +16,38 @@ env: CN_APP_SLUG: verso-nightly jobs: + pr-fast-check: + if: ${{ github.event_name == 'pull_request' }} + name: Pull Request Fast Check + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Install Rust + uses: dsherret/rust-toolchain-file@v1 + + - name: Set env + run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt install build-essential python3-pip ccache clang cmake curl \ + g++ git gperf libdbus-1-dev libfreetype6-dev libgl1-mesa-dri \ + libgles2-mesa-dev libglib2.0-dev libgstreamer-plugins-base1.0-dev \ + gstreamer1.0-plugins-good libgstreamer-plugins-good1.0-dev \ + gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev \ + gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base \ + libgstreamer-plugins-base1.0-dev gstreamer1.0-libav \ + libgstrtspserver-1.0-dev gstreamer1.0-tools libges-1.0-dev \ + libharfbuzz-dev liblzma-dev libunwind-dev libunwind-dev libvulkan1 \ + libx11-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \ + libxmu-dev libxmu6 libegl1-mesa-dev llvm-dev m4 xorg-dev sway + + - name: Check + run: cargo check + build-linux: if: ${{ github.event_name != 'pull_request' }} name: Build [Linux] @@ -160,38 +192,6 @@ jobs: name: verso-${{ matrix.platform.target }} path: verso-${{ matrix.platform.target }}.tar.gz - pr-fast-check: - if: ${{ github.event_name == 'pull_request' }} - name: Pull Request Fast Check - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - - - name: Install Rust - uses: dsherret/rust-toolchain-file@v1 - - - name: Set env - run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt install build-essential python3-pip ccache clang cmake curl \ - g++ git gperf libdbus-1-dev libfreetype6-dev libgl1-mesa-dri \ - libgles2-mesa-dev libglib2.0-dev libgstreamer-plugins-base1.0-dev \ - gstreamer1.0-plugins-good libgstreamer-plugins-good1.0-dev \ - gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev \ - gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base \ - libgstreamer-plugins-base1.0-dev gstreamer1.0-libav \ - libgstrtspserver-1.0-dev gstreamer1.0-tools libges-1.0-dev \ - libharfbuzz-dev liblzma-dev libunwind-dev libunwind-dev libvulkan1 \ - libx11-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \ - libxmu-dev libxmu6 libegl1-mesa-dev llvm-dev m4 xorg-dev sway - - - name: Check - run: cargo check - release-nightly: if: ${{ github.event_name == 'schedule' }} runs-on: ubuntu-latest From 7dd3895dc5377fca6e5ce1c02bb2017dd36d6bc5 Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Mon, 6 May 2024 18:49:53 +0800 Subject: [PATCH 6/7] build: add build-result --- .github/workflows/build.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f2edc1..cea7dfd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -192,6 +192,26 @@ jobs: name: verso-${{ matrix.platform.target }} path: verso-${{ matrix.platform.target }}.tar.gz + build-result: + name: Build Result + runs-on: ubuntu-latest + if: always() + # needs all build to detect cancellation + needs: ['build-macos', 'build-windows', 'build-linux'] + steps: + - name: Merge build timings + uses: actions/upload-artifact/merge@v4 + with: + name: cargo-timings + pattern: cargo-timings-* + delete-merged: true + - name: Success + if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} + run: exit 0 + - name: Failure + if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 + release-nightly: if: ${{ github.event_name == 'schedule' }} runs-on: ubuntu-latest From 0c43b23fd45f1371e800e400a7f1ec640b6a46f5 Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Mon, 6 May 2024 18:51:14 +0800 Subject: [PATCH 7/7] build: update build result --- .github/workflows/build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cea7dfd..abc8ea3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -196,15 +196,8 @@ jobs: name: Build Result runs-on: ubuntu-latest if: always() - # needs all build to detect cancellation needs: ['build-macos', 'build-windows', 'build-linux'] steps: - - name: Merge build timings - uses: actions/upload-artifact/merge@v4 - with: - name: cargo-timings - pattern: cargo-timings-* - delete-merged: true - name: Success if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} run: exit 0