-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (98 loc) · 3.63 KB
/
ci.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
name: CI
on:
push:
pull_request:
workflow_dispatch:
env:
JMDICT_PATH: crates/yomikiri-dictionary-generator/jmdict/jmdict_english.xml
JMNEDICT_PATH: crates/yomikiri-dictionary-generator/jmdict/jmnedict.xml
DICTIONARY_PATH: crates/yomikiri-dictionary-generator/files/english.yomikiridict
UNIDIC_OUTPUT_PATH: crates/unidic/output
jobs:
test:
runs-on: macos-latest
timeout-minutes: 45
name: "Lint, Test, Build web extension"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 50
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: "next-9"
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install cargo
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-ios
- name: Install pnpm deps
run: pnpm install
- name: Get version
id: version
run: echo "VERSION=$(pnpm run --silent print-version)" >> "$GITHUB_OUTPUT"
- name: Hash root Cargo.toml and Cargo.lock
id: cargo-hash
run: echo "HASH=${{hashFiles('./Cargo.lock', './Cargo.toml')}}" >> "$GITHUB_OUTPUT"
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84
- name: Formatting
run: pnpm run check-format
- name: Install wasm-pack
run: pnpm add -g wasm-pack
- name: Cache unidic
uses: actions/cache@v4
with:
path: crates/unidic/original
key: unidic-2.1.2
- name: Cache jmdict
uses: actions/cache@v4
with:
path: ${{env.JMDICT_PATH}}
key: jmdict-english-xml-${{steps.version.outputs.VERSION}}
- name: Cache jmnedict
uses: actions/cache@v4
with:
path: ${{env.JMNEDICT_PATH}}
key: jmnedict-xml-${{steps.version.outputs.VERSION}}
- name: Build yomikiri-dictionary-generator crate
run: cargo build
working-directory: ./crates/yomikiri-dictionary-generator
- name: Cache yomikiri dictionary
uses: actions/cache@v4
id: cache-yomikiri-dictionary
with:
path: ${{env.DICTIONARY_PATH}}
key: yomikiridict-${{ steps.cargo-hash.outputs.HASH }}-${{ hashFiles('./target/debug/yomikiri-dictionary-generator', './crates/dictionary-generator/Cargo.toml', env.JMDICT_PATH, env.JMNEDICT_PATH) }}
- name: Generate yomikiri dictionary
if: steps.cache-yomikiri-dictionary.outputs.cache-hit != 'true'
run: pnpm run generate:dictionary
- name: Build yomikiri-unidic crate
run: cargo build
working-directory: ./crates/unidic
- name: Cache unidic output
uses: actions/cache@v4
id: cache-unidic
with:
path: ${{env.UNIDIC_OUTPUT_PATH}}
key: unidic-${{ steps.cargo-hash.outputs.HASH }}-${{ hashFiles('./target/debug/yomikiri-unidic', './crates/unidic/Cargo.toml', env.DICTIONARY_PATH, './crates/unidic/original/**') }}
- name: Generate unidic files
if: steps.cache-unidic.outputs.cache-hit != 'true'
run: pnpm run generate:unidic
- name: Generate backend wasm
run: pnpm run generate:backend-wasm
- name: Generate backend ios
run: pnpm run generate:backend-ios
- name: Generate licenses
run: pnpm run generate:licenses
- name: Lint
run: pnpm run lint
- name: Test
run: pnpm run test
- name: Build web
run: pnpm run build:chrome && pnpm run build:firefox && pnpm run build:ios