-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (98 loc) · 3.32 KB
/
ci.yaml
File metadata and controls
121 lines (98 loc) · 3.32 KB
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
name: CI
on: [push, pull_request, workflow_dispatch]
env:
CARGO_TERM_COLOR: always
MACOSX_DEPLOYMENT_TARGET: 10.11
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
id: install_rust
uses: actions-rs/toolchain@v1
with:
components: rustfmt, clippy
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install Linux-specific packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install clang-format
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: |
v2-${{ github.workflow }}-${{ runner.os }}-rust-${{ steps.install_rust.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
v2-${{ github.workflow }}-${{ runner.os }}-rust-${{ steps.install_rust.outputs.rustc_hash }}-
v2-${{ github.workflow }}-${{ runner.os }}-rust-
- name: cargo check
run: cargo check --verbose --workspace --all-targets
- name: cargo build
run: cargo build --verbose
- name: cargo test
run: cargo test --verbose --workspace
- name: cargo fmt
if: runner.os == 'Linux'
run: cargo fmt --verbose --all -- --check
- name: cargo clippy
if: runner.os == 'Linux'
run: cargo clippy --verbose --workspace
- name: Generate FFI headers
run: scripts/generate-ffi-headers.sh
- name: Check FFI headers
if: runner.os == 'Linux'
run: git diff --color=always --exit-code ffi/crosslocale.h
- name: Build Node.js bindings
working-directory: node-bindings
run: |
npm install --ignore-scripts
npm run node-gyp rebuild -- --debug -- -D rust_build_profile=debug
- name: Test Node.js bindings
run: |
set -x
crosslocale="$PWD/target/debug/crosslocale"
test_js="$PWD/node-bindings/test.js"
cd "${RUNNER_TEMP}"
mkdir ./test
cd ./test
curl -fSLO https://github.com/dmitmel/crosscode-localization-data/archive/refs/heads/master.tar.gz
tar -xzvf ./master.tar.gz --strip-components=1
"$crosslocale" create-project ./tmp --translation-locale=es_ES ./scan.json
"$crosslocale" import ./tmp --format=po ./po/es_ES/components
"$crosslocale" status ./tmp
node "$test_js"
- name: clang-format
if: runner.os == 'Linux'
run: clang-format --verbose --dry-run ffi/crosslocale.h node-bindings/addon.cc
build-mod-tools:
name: Build mod tools
runs-on: ubuntu-latest
defaults:
run:
working-directory: mod-tools/
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '>=3.7'
- run: ./setup.py develop
- run: pip install pyright yapf isort toml
- run: pyright .
- run: yapf --diff --recursive .
- run: isort --check --diff .