-
-
Notifications
You must be signed in to change notification settings - Fork 63
110 lines (106 loc) · 3.46 KB
/
main.yaml
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
on:
- push
- pull_request
name: Main
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
artifact-name: win64
artifact-file: ludusavi.exe
tar: false
- os: windows-latest
rust-target: i686-pc-windows-msvc
artifact-name: win32
artifact-file: ludusavi.exe
tar: false
- os: ubuntu-20.04
rust-target: x86_64-unknown-linux-gnu
artifact-name: linux
artifact-file: ludusavi
tar: true
- os: macos-12
rust-target: x86_64-apple-darwin
artifact-name: mac
artifact-file: ludusavi
tar: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.7'
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mtkennerly/dunamai-action@v1
with:
env-var: LUDUSAVI_VERSION
args: --style semver
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable-${{ matrix.rust-target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.rust-target }}
- if: ${{ matrix.os == 'ubuntu-20.04' }}
run: sudo apt-get update && sudo apt-get install -y gcc libxcb-composite0-dev libgtk-3-dev librust-atk-dev
- run: cargo build --release
- if: ${{ matrix.tar }}
run: |
cd target/release
tar --create --gzip --file=ludusavi-v${{ env.LUDUSAVI_VERSION }}-${{ matrix.artifact-name }}.tar.gz ${{ matrix.artifact-file }}
- if: ${{ matrix.tar }}
uses: actions/upload-artifact@v4
with:
name: ludusavi-v${{ env.LUDUSAVI_VERSION }}-${{ matrix.artifact-name }}
path: target/release/ludusavi-v${{ env.LUDUSAVI_VERSION }}-${{ matrix.artifact-name }}.tar.gz
- if: ${{ !matrix.tar }}
uses: actions/upload-artifact@v4
with:
name: ludusavi-v${{ env.LUDUSAVI_VERSION }}-${{ matrix.artifact-name }}
path: target/release/${{ matrix.artifact-file }}
test:
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install -y gcc libxcb-composite0-dev libgtk-3-dev librust-atk-dev
- if: ${{ matrix.os == 'windows-latest' }}
run: reg import tests/ludusavi.reg
- if: ${{ matrix.os == 'windows-latest' }}
run: |
cd tests/root3/game5 && cmd /c "mklink /J data-symlink data"
- if: ${{ matrix.os != 'windows-latest' }}
run: |
cd tests/root3/game5 && ln -s data data-symlink
- run: cargo test
lint:
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace -- --deny warnings