From 414e866702e0431eb8bfe1d9945eb09d36b1df21 Mon Sep 17 00:00:00 2001 From: RSUU Date: Thu, 18 Apr 2024 19:28:45 +0800 Subject: [PATCH] fix(ci) --- .github/workflows/github-pages.yml | 14 +++---- .github/workflows/release.yml | 60 ++++++++++-------------------- .github/workflows/test.yml | 30 +++++++-------- .github/workflows/wasm.yml | 19 +++++----- build_web.zsh | 16 ++++---- examples/gcd.rs | 7 ---- 6 files changed, 60 insertions(+), 86 deletions(-) delete mode 100644 examples/gcd.rs diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index 09dbcf0..f225bca 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -1,12 +1,12 @@ name: Deploy static content to Pages -# on: -# # Runs on pushes targeting the default branch -# push: -# branches: ["main"] -# -# # Allows you to run this workflow manually from the Actions tab -# workflow_dispatch: +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d306fe..16f1e96 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,43 +9,26 @@ jobs: create-release: name: release runs-on: ubuntu-latest - outputs: - upload_url: ${{ steps.release.outputs.upload_url }} - bin_version: ${{ env.BIN_VERSION }} steps: - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.os }}-release - - name: Get the release version from the tag - shell: bash - if: env.BIN_VERSION == '' - run: | - echo "BIN_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - echo "version is: ${{ env.BIN_VERSION }}" - - name: Create GitHub release - id: release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.BIN_VERSION }} - release_name: ${{ env.BIN_VERSION }} build-release: name: build-release needs: ["create-release"] strategy: matrix: - build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc] + build: [linux, linux-arm, macos, win-msvc] include: - - build: linux-x86_64 + - build: linux os: ubuntu-latest rust: nightly target: x86_64-unknown-linux-gnu - - build: linux-aarch64 + - build: linux-arm os: ubuntu-latest rust: nightly - target: aarch64-unknown-linux-gnu + target: arm-unknown-linux-gnueabihf - build: macos os: macos-latest rust: nightly @@ -54,36 +37,37 @@ jobs: os: windows-latest rust: nightly target: x86_64-pc-windows-msvc - - build: win-gnu - os: windows-latest - rust: nightly-x86_64-gnu - target: x86_64-pc-windows-gnu runs-on: ${{ matrix.os }} outputs: upload_url: ${{ steps.release.outputs.upload_url }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} - - name: Add mingw64 to path for x86_64 - run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH if: matrix.rust == 'nightly' shell: bash - + run: | + echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH + - name: Install dependencies + shell: bash + run: | + if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then + sudo apt update -y + sudo apt install -y curl gcc clang libudev-dev libgbm-dev libxkbcommon-dev libegl1-mesa-dev libwayland-dev libinput-dev libdbus-1-dev libsystemd-dev libseat-dev libpipewire-0.3-dev libpango1.0-dev libwayland-egl1-mesa libwayland-client++0 libwayland-client-extra++0 + fi - name: Build shell: bash run: | export RUSTFLAGS="-Awarnings" cargo build --release - - name: Build archive shell: bash run: | - staging="rmg_${{ matrix.build }}_${{ needs.create-release.outputs.bin_version }}" + staging="rmg_${{ matrix.build }}_${{ github.ref_name }}" mkdir -p "$staging" cp {README.md,LICENSE-MIT,LICENSE-APACHE} "$staging/" @@ -97,17 +81,11 @@ jobs: tar czf "$staging.tar.gz" "$staging" echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV fi - - - name: Upload Release Asset - if: startsWith(github.ref, 'refs/tags/') - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: ${{ env.ASSET }} + file: ${{ env.ASSET }} asset_name: ${{ env.ASSET }} - asset_content_type: application/octet-stream - + overwrite: true # REFS: https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e1a5997..27b1fe5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,18 +7,18 @@ on: pull_request: jobs: - build-build: + build: name: test strategy: matrix: - build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc] + build: [linux, linux-arm, macos, win-msvc] include: - build: linux - os: ubuntu-22.04 + os: ubuntu-latest rust: nightly target: x86_64-unknown-linux-gnu - build: linux-arm - os: ubuntu-22.04 + os: ubuntu-latest rust: nightly target: arm-unknown-linux-gnueabihf - build: macos @@ -26,20 +26,12 @@ jobs: rust: nightly target: x86_64-apple-darwin - build: win-msvc - os: windows-2022 + os: windows-latest rust: nightly target: x86_64-pc-windows-msvc - - build: win-gnu - os: windows-2022 - rust: nightly-x86_64-gnu - target: x86_64-pc-windows-gnu - - build: win32-msvc - os: windows-2022 - rust: nightly - target: i686-pc-windows-msvc runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.os }}-test @@ -49,9 +41,17 @@ jobs: toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} - name: Add mingw64 to path for x86_64-gnu - run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH if: matrix.rust == 'nightly' shell: bash + run: | + echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH + - name: Install dependencies + shell: bash + run: | + if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then + sudo apt update -y + sudo apt install -y curl gcc clang libudev-dev libgbm-dev libxkbcommon-dev libegl1-mesa-dev libwayland-dev libinput-dev libdbus-1-dev libsystemd-dev libseat-dev libpipewire-0.3-dev libpango1.0-dev libwayland-egl1-mesa libwayland-client++0 libwayland-client-extra++0 + fi - name: Build and Test shell: bash run: | diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index d1a19f3..b907e92 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -1,25 +1,25 @@ name: wasm -# on: -# push: -# branches: -# - main -# pull_request: +on: + push: + branches: + - main + pull_request: jobs: - build-build: + build: name: wasm strategy: matrix: build: [linux] include: - build: linux - os: ubuntu-22.04 + os: ubuntu-lastest rust: nightly target: x86_64-unknown-linux-gnu runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.os }}-test @@ -34,8 +34,9 @@ jobs: export RUSTFLAGS="-Awarnings" curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh rustup target add wasm32-unknown-unknown - #cargo install wasm-pack export PATH="$PATH:/home/runner/.cargo/bin/" + cargo install wasm-pack + bash build_web.zsh - name: Deploy uses: peaceiris/actions-gh-pages@v3 diff --git a/build_web.zsh b/build_web.zsh index 43df7f3..15b333a 100644 --- a/build_web.zsh +++ b/build_web.zsh @@ -6,11 +6,13 @@ build() { --out-name web.wasm } -server(){ - dufs --render-index \ - --allow-search \ - ./www - #--enable-cors \ -} +# server(){ +# dufs --render-index \ +# --allow-search \ +# ./www +# #--enable-cors \ +# } +# +#build && server -build && server +build diff --git a/examples/gcd.rs b/examples/gcd.rs deleted file mode 100644 index 74a4020..0000000 --- a/examples/gcd.rs +++ /dev/null @@ -1,7 +0,0 @@ -use gcd; - -fn main() { - let (w, h) = (1920, 1080); - - dbg!(gcd::gcd_binary(w, h)); -}