From 7d234b9ec943081290d30a50bd2ed7667ffd0f5d Mon Sep 17 00:00:00 2001 From: zephyr Date: Sun, 10 Dec 2023 21:00:09 +0900 Subject: [PATCH] workflow --- .github/workflows/ci.yml | 30 ++++---- .github/workflows/cross_compile.yml | 113 +++++++++++----------------- .github/workflows/release.yml | 110 +++++++++++---------------- 3 files changed, 105 insertions(+), 148 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6081594e..eac94587 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,31 +1,29 @@ name: ci on: push: + paths-ignore: ["**.md"] branches: [ master ] pull_request: + paths-ignore: ["**.md"] branches: [ master ] jobs: - clippy_check: + clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master with: toolchain: nightly components: clippy - default: true - override: true - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features -- -A 'clippy::uninlined_format_args' - run_test: + - run: cargo clippy + test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly - default: true - override: true - - run: cargo test -v --all --no-fail-fast + toolchain: nightly + - name: test core + run: cargo test -p realm_core -v --no-fail-fast --features proxy + - name: test binary + run: cargo test -v --no-fail-fast diff --git a/.github/workflows/cross_compile.yml b/.github/workflows/cross_compile.yml index bc8a838a..258cea7c 100644 --- a/.github/workflows/cross_compile.yml +++ b/.github/workflows/cross_compile.yml @@ -1,8 +1,10 @@ name: build on: push: + paths-ignore: ["**.md"] branches: [ master ] pull_request: + paths-ignore: ["**.md"] branches: [ master ] env: @@ -13,58 +15,45 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - include: - - target: x86_64-unknown-linux-gnu - output: realm - - target: x86_64-unknown-linux-musl - output: realm - - target: x86_64-linux-android - output: realm - - target: x86_64-pc-windows-gnu - output: realm.exe - - target: aarch64-unknown-linux-gnu - output: realm - - target: aarch64-unknown-linux-musl - output: realm - - target: aarch64-linux-android - output: realm - - target: arm-unknown-linux-gnueabi - output: realm - - target: arm-unknown-linux-gnueabihf - output: realm - - target: arm-unknown-linux-musleabi - output: realm - - target: arm-unknown-linux-musleabihf - output: realm - - target: armv7-unknown-linux-gnueabi - output: realm - - target: armv7-unknown-linux-gnueabihf - output: realm - - target: armv7-unknown-linux-musleabi - output: realm - - target: armv7-unknown-linux-musleabihf - output: realm + target: + - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - x86_64-pc-windows-gnu + - x86_64-linux-android + - aarch64-unknown-linux-gnu + - aarch64-unknown-linux-musl + - aarch64-linux-android + - arm-unknown-linux-gnueabi + - arm-unknown-linux-gnueabihf + - arm-unknown-linux-musleabi + - arm-unknown-linux-musleabihf + - armv7-unknown-linux-gnueabi + - armv7-unknown-linux-gnueabihf + - armv7-unknown-linux-musleabi + - armv7-unknown-linux-musleabihf steps: - - uses: actions/checkout@v3 - - run: echo '[build]' > Cross.toml && echo 'build-std = true' >> Cross.toml - if: contains(matrix.target, 'android') + - uses: actions/checkout@v4 - name: install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - toolchain: nightly - target: ${{ matrix.target }} - override: true + toolchain: nightly + targets: ${{ matrix.target }} + - name: install cross + run: cargo install cross --git https://github.com/cross-rs/cross - name: compile - uses: actions-rs/cargo@v1 + run: cross build --release --target=${{ matrix.target }} + - name: upload unix binary + if: "!contains(matrix.target, 'windows')" + uses: actions/upload-artifact@v3 with: - use-cross: true - command: build - args: --release --target=${{ matrix.target }} - - name: upload - uses: actions/upload-artifact@v2 + name: realm-${{ matrix.target }} + path: target/${{ matrix.target }}/release/realm + - name: upload windows binary + if: "contains(matrix.target, 'windows')" + uses: actions/upload-artifact@v3 with: name: realm-${{ matrix.target }} - path: target/${{ matrix.target }}/release/${{ matrix.output }} + path: target/${{ matrix.target }}/release/realm.exe build-windows: runs-on: windows-latest strategy: @@ -72,21 +61,16 @@ jobs: target: - x86_64-pc-windows-msvc steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - toolchain: nightly - target: ${{ matrix.target }} - override: true + toolchain: nightly + targets: ${{ matrix.target }} - name: compile - uses: actions-rs/cargo@v1 - with: - use-cross: false - command: build - args: --release --target=${{ matrix.target }} + run: cargo build --release --target=${{ matrix.target }} - name: upload - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: realm-${{ matrix.target }} path: target/${{ matrix.target }}/release/realm.exe @@ -99,21 +83,16 @@ jobs: - aarch64-apple-darwin - aarch64-apple-ios steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - toolchain: nightly - target: ${{ matrix.target }} - override: true + toolchain: nightly + targets: ${{ matrix.target }} - name: compile - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --release --target=${{ matrix.target }} + run: cargo build --release --target=${{ matrix.target }} - name: upload - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: realm-${{ matrix.target }} path: target/${{ matrix.target }}/release/realm diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1ca6bd9..260f3a3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,58 +9,48 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - include: - - target: x86_64-unknown-linux-gnu - output: realm - - target: x86_64-unknown-linux-musl - output: realm - - target: x86_64-linux-android - output: realm - - target: x86_64-pc-windows-gnu - output: realm.exe - - target: aarch64-unknown-linux-gnu - output: realm - - target: aarch64-unknown-linux-musl - output: realm - - target: aarch64-linux-android - output: realm - - target: arm-unknown-linux-gnueabi - output: realm - - target: arm-unknown-linux-gnueabihf - output: realm - - target: arm-unknown-linux-musleabi - output: realm - - target: arm-unknown-linux-musleabihf - output: realm - - target: armv7-unknown-linux-gnueabi - output: realm - - target: armv7-unknown-linux-gnueabihf - output: realm - - target: armv7-unknown-linux-musleabi - output: realm - - target: armv7-unknown-linux-musleabihf - output: realm + target: + - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - x86_64-pc-windows-gnu + - x86_64-linux-android + - aarch64-unknown-linux-gnu + - aarch64-unknown-linux-musl + - aarch64-linux-android + - arm-unknown-linux-gnueabi + - arm-unknown-linux-gnueabihf + - arm-unknown-linux-musleabi + - arm-unknown-linux-musleabihf + - armv7-unknown-linux-gnueabi + - armv7-unknown-linux-gnueabihf + - armv7-unknown-linux-musleabi + - armv7-unknown-linux-musleabihf steps: - - uses: actions/checkout@v3 - - run: echo '[build]' > Cross.toml && echo 'build-std = true' >> Cross.toml - if: contains(matrix.target, 'android') + - uses: actions/checkout@v4 - name: install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - toolchain: nightly - target: ${{ matrix.target }} - override: true + toolchain: nightly + targets: ${{ matrix.target }} + - name: install cross + run: cargo install cross --git https://github.com/cross-rs/cross - name: compile - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --release --target=${{ matrix.target }} - - name: pack + run: cross build --release --target=${{ matrix.target }} + - name: pack unix binary + if: "!contains(matrix.target, 'windows')" + run: | + mkdir -p release-${{ matrix.target }} + cd release-${{ matrix.target }} + tar -C ../target/${{ matrix.target }}/release -zcf realm-${{ matrix.target }}.tar.gz realm + - name: pack windows binary + if: "contains(matrix.target, 'windows')" run: | mkdir -p release-${{ matrix.target }} cd release-${{ matrix.target }} - tar -C ../target/${{ matrix.target }}/release -zcf realm-${{ matrix.target }}.tar.gz ${{ matrix.output }} + tar -C ../target/${{ matrix.target }}/release -zcf realm-${{ matrix.target }}.tar.gz realm.exe + - name: add signature + run: | + cd release-${{ matrix.target }} sha256sum realm-${{ matrix.target }}.tar.gz > realm-${{ matrix.target }}.sha256 - name: release uses: softprops/action-gh-release@v1 @@ -75,19 +65,14 @@ jobs: target: - x86_64-pc-windows-msvc steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - toolchain: nightly - target: ${{ matrix.target }} - override: true + toolchain: nightly + targets: ${{ matrix.target }} - name: compile - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --release --target=${{ matrix.target }} + run: cargo build --release --target=${{ matrix.target }} - name: pack run: | mkdir -p release-${{ matrix.target }} @@ -109,19 +94,14 @@ jobs: - aarch64-apple-darwin - aarch64-apple-ios steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - toolchain: nightly - target: ${{ matrix.target }} - override: true + toolchain: nightly + targets: ${{ matrix.target }} - name: compile - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --release --target=${{ matrix.target }} + run: cargo build --release --target=${{ matrix.target }} - name: pack run: | mkdir -p release-${{ matrix.target }}