-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (160 loc) · 6.36 KB
/
continuous_testing.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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test
on: [push, workflow_dispatch]
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
jobs:
lint:
name: lint and format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
rustflags: ""
override: true
- name: Lint and format
uses: ./.github/actions/lint_format
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
rust_test:
name: cargo test
strategy:
matrix:
channel: [ stable, "1.64" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-${{ matrix.channel }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install required libs (Ubuntu)
run: sudo apt-get install libxkbcommon-dev
- name: Install cargo
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.channel }}
rustflags: ""
override: true
- name: Run rust test
run: cargo test --features capi
library_test:
name: library test
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: check version
id: versions
run: |
echo version=`bin/version.sh` >> ${GITHUB_OUTPUT}
echo major-version=`bin/major_version.sh` >> ${GITHUB_OUTPUT}
- name: output version
run: |
echo Version: ${{ steps.versions.outputs.version }}
echo MajorVersion: ${{ steps.versions.outputs.major-version }}
- name: Install cargo
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
rustflags: ""
override: true
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-libtest-v6-${{ hashFiles('**/Cargo.lock') }}-cargo-c-v0.9.6
- name: Install required rust tools
uses: ./.github/actions/install_required_cargo_bins
- name: Install required libs (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libxkbcommon-dev
- name: Install required libs (MacOS M1 and intel)
if: matrix.os == 'macos-latest' || matrix.os == 'macos-12'
run: |
brew install --cask xquartz
brew install libxkbcommon
echo `brew --prefix`
- name: Build library
run: cargo +stable cbuild
- name: copy shared data
run: mkdir -p ~/.local/share/libcskk && cp -r ./assets/* ~/.local/share/libcskk
# TODO: Use variable in github actions? Only target directory is different here.
- name: copy header file (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: cp ./target/x86_64-unknown-linux-gnu/debug/libcskk.h ./tests/
- name: link lib versioning (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ln -fs libcskk.so ./target/x86_64-unknown-linux-gnu/debug/libcskk.so.${{ steps.versions.outputs.major-version }}
- name: Show built file
if: matrix.os == 'ubuntu-latest'
run: ls -l ./target/*
- name: Show built file under debug
if: matrix.os == 'ubuntu-latest'
run: ls -l ./target/x86_64-unknown-linux-gnu/debug/
- name: Build lib test (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: gcc ./tests/c_shared_lib_test.c -L ./target/x86_64-unknown-linux-gnu/debug/ -lcskk -o ./tests/lib_test
- name: Run lib test (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: LD_LIBRARY_PATH=./target/x86_64-unknown-linux-gnu/debug ./tests/lib_test
# - name: copy header file (MacOS intel)
# if: matrix.os == 'macos-12'
# run: cp ./target/x86_64-apple-darwin/debug/libcskk.h ./tests/
# - name: link lib versioning (MacOS intel)
# if: matrix.os == 'macos-12'
# run: ln -fs libcskk.${{ steps.versions.outputs.version }}.dylib ./target/x86_64-apple-darwin/debug/libcskk.dylib
# - name: Show built file (MacOS intel)
# if: matrix.os == 'macos-12'
# run: ls -l ./target/*
# - name: Show built file under debug (MacOS intel)
# if: matrix.os == 'macos-12'
# run: ls -l ./target/x86_64-apple-darwin/debug/
# - name: Build lib test (MacOS intel)
# if: matrix.os == 'macos-12'
# run: gcc ./tests/c_shared_lib_test.c -L./target/x86_64-apple-darwin/debug/ -lcskk -lxkbcommon -o ./tests/lib_test
# - name: Run lib test (MacOS intel)
# if: matrix.os == 'macos-12'
# run: DYLD_LIBRARY_PATH=./target/x86_64-apple-darwin/debug/ ./tests/lib_test
- name: copy header file (MacOS M1)
if: matrix.os == 'macos-latest'
run: cp ./target/aarch64-apple-darwin/debug/libcskk.h ./tests/
- name: link lib versioning (MacOS M1)
if: matrix.os == 'macos-latest'
run: ln -fs libcskk.${{ steps.versions.outputs.version }}.dylib ./target/aarch64-apple-darwin/debug/libcskk.dylib
- name: Show built file (MacOS M1)
if: matrix.os == 'macos-latest'
run: ls -l ./target/*
- name: Show built file under debug (MacOS M1)
if: matrix.os == 'macos-latest'
run: ls -l ./target/aarch64-apple-darwin/debug/
- name: Build lib test (MacOS M1)
if: matrix.os == 'macos-latest'
run: gcc ./tests/c_shared_lib_test.c -L./target/aarch64-apple-darwin/debug/ "-L$(brew --prefix)/lib/" -lcskk -lxkbcommon -o ./tests/lib_test
- name: Run lib test (MacOS M1)
if: matrix.os == 'macos-latest'
run: DYLD_LIBRARY_PATH=./target/aarch64-apple-darwin/debug/:$(brew --prefix)/lib/ ./tests/lib_test