-
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (41 loc) · 1.28 KB
/
tests.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
name: Tests
on: push
jobs:
run-tests:
runs-on: "ubuntu-20.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
run: rustup update
- name: Run tests
run: cargo test
release-if-needed:
runs-on: "ubuntu-20.04"
needs: run-tests
# Only run if tests passed and the branch is main.
if: ${{ github.ref == 'refs/heads/main' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Check if version in Cargo.toml has changed
id: project
run: |
git diff-tree -r -G'^version ?= ?"*"' --exit-code HEAD Cargo.toml && VERSION_CHANGED=0 || VERSION_CHANGED=1
echo "VERSION_CHANGED=${VERSION_CHANGED}"
echo "VERSION_CHANGED=${VERSION_CHANGED}" >> "$GITHUB_ENV"
- name: Install Rust
if: steps.project.VERSION_CHANGED == '1'
run: rustup update
- name: Install cargo-release
if: steps.project.VERSION_CHANGED == '1'
run: cargo install cargo-release
- name: Run cargo-release
if: steps.project.VERSION_CHANGED == '1'
run: cargo release --execute