-
Notifications
You must be signed in to change notification settings - Fork 27
137 lines (132 loc) · 4.07 KB
/
build_and_test_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Linux/Windows/macOS/Android/iOS (Build/Test/Release)
on:
push:
branches: [ main, next ]
pull_request:
branches: [ main, next ]
jobs:
build_test_common_os:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
toolchain: [stable]
feature: [ no_feature , "async_tokio" ]
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: Setup Feature Args
shell: bash
run: |
if [[ "${{ matrix.feature }}" == "no_feature" ]]; then
echo "FEATURE_ARGS=" >> $GITHUB_ENV
else
echo "FEATURE_ARGS=-F ${{ matrix.feature }}" >> $GITHUB_ENV
fi
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: ${{ env.FEATURE_ARGS }}
- name: Run tests
if: matrix.feature != 'async_tokio'
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ env.FEATURE_ARGS }}
- name: Run tests
if: matrix.feature == 'async_tokio'
uses: actions-rs/cargo@v1
with:
command: test
# Ignore rust doc tests for async_tokio
args: ${{ env.FEATURE_ARGS }} --test '*'
build_test_android:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target: [i686-linux-android, aarch64-linux-android, armv7-linux-androideabi, thumbv7neon-linux-androideabi, x86_64-linux-android]
toolchain: [stable]
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
- name: Run tests
uses: actions-rs/cargo@v1
with:
use-cross: true
command: test
args: --release --target ${{ matrix.target }}
build_test_ios:
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
toolchain: [stable]
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: Add target
run: rustup target add x86_64-apple-ios
- name: Cache cargo install
uses: actions/cache@v3
with:
path: ~/.cargo/bin/
key: ${{ runner.os }}-${{ matrix.toolchain }}-${{ github.ref }}-cargo-install-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-dinghy
run: |
if ! command -v cargo-dinghy &> /dev/null
then
cargo install cargo-dinghy
fi
- name: Start iPhone simulator
run: xcrun simctl boot "iPhone 14"
- name: List simulators
run: xcrun simctl list
- name: Build and run tests
run: cargo dinghy -d iphone test
release:
name: Release
runs-on: ubuntu-latest
needs: [build_test_common_os, build_test_android, build_test_ios]
if: github.ref == 'refs/heads/main'
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
ref: main
- name: install npm
uses: actions/setup-node@v3
with:
node-version: '16'
- name: install @semantic-release/exec
run: npm install @semantic-release/exec
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
with:
branch: main
env:
GITHUB_TOKEN: ${{ secrets.PAT_GLOBAL }}
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}