Skip to content

Commit

Permalink
workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zephyrchien committed Dec 10, 2023
1 parent 4fd5016 commit 7d234b9
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 148 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
113 changes: 46 additions & 67 deletions .github/workflows/cross_compile.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: build
on:
push:
paths-ignore: ["**.md"]
branches: [ master ]
pull_request:
paths-ignore: ["**.md"]
branches: [ master ]

env:
Expand All @@ -13,80 +15,62 @@ 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:
matrix:
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
Expand All @@ -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
110 changes: 45 additions & 65 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand Down

0 comments on commit 7d234b9

Please sign in to comment.