+84 -7 +/-6 browse
1 | diff --git a/.github/workflows/builds.yaml b/.github/workflows/builds.yaml |
2 | index 6fac6f4..a36643c 100644 |
3 | --- a/.github/workflows/builds.yaml |
4 | +++ b/.github/workflows/builds.yaml |
5 | @@ -3,6 +3,7 @@ name: Build release binary |
6 | env: |
7 | RUST_BACKTRACE: 1 |
8 | CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse |
9 | + SQLITE_BIN: ~/.sqlite3/sqlite3 |
10 | |
11 | on: |
12 | workflow_dispatch: |
13 | @@ -26,6 +27,24 @@ jobs: |
14 | target: x86_64-unknown-linux-gnu |
15 | steps: |
16 | - uses: actions/checkout@v2 |
17 | + - id: cache-sqlite3-bin |
18 | + name: Cache sqlite3 binary |
19 | + uses: actions/cache@v3 |
20 | + with: |
21 | + path: ~/.sqlite3 |
22 | + key: toolchain-sqlite3 |
23 | + - if: ${{ steps.cache-sqlite3-bin.outputs.cache-hit != 'true' }} |
24 | + name: Download sqlite3 binary |
25 | + run: | |
26 | + set -ex |
27 | + sudo apt-get install -y --quiet wget unzip |
28 | + mkdir -p ~/.sqlite3 |
29 | + cd ~/.sqlite3 |
30 | + wget "https://sqlite.org/2023/sqlite-tools-linux-x86-3420000.zip" |
31 | + unzip sqlite-tools-linux-x86-3420000.zip |
32 | + mv sqlite-tools-linux-x86-3420000/* . |
33 | + rm -rf sqlite-tools-linux-x86-3420000* |
34 | + echo "SQLITE_BIN=$(pwd)/sqlite3" >> $GITHUB_ENV |
35 | - id: cache-rustup |
36 | name: Cache Rust toolchain |
37 | uses: actions/cache@v3 |
38 | diff --git a/.github/workflows/grcov.yaml b/.github/workflows/grcov.yaml |
39 | index ffa1c09..6fd30aa 100644 |
40 | --- a/.github/workflows/grcov.yaml |
41 | +++ b/.github/workflows/grcov.yaml |
42 | @@ -3,6 +3,7 @@ name: Code coverage |
43 | env: |
44 | RUST_BACKTRACE: 1 |
45 | CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse |
46 | + SQLITE_BIN: ~/.sqlite3/sqlite3 |
47 | |
48 | on: |
49 | workflow_dispatch: |
50 | @@ -16,6 +17,24 @@ jobs: |
51 | runs-on: ubuntu-latest #if: ${{ github.event.workflow_run.conclusion == 'success' }} |
52 | steps: |
53 | - uses: actions/checkout@v1 |
54 | + - id: cache-sqlite3-bin |
55 | + name: Cache sqlite3 binary |
56 | + uses: actions/cache@v3 |
57 | + with: |
58 | + path: ~/.sqlite3 |
59 | + key: toolchain-sqlite3 |
60 | + - if: ${{ steps.cache-sqlite3-bin.outputs.cache-hit != 'true' }} |
61 | + name: Download sqlite3 binary |
62 | + run: | |
63 | + set -ex |
64 | + sudo apt-get install -y --quiet wget unzip |
65 | + mkdir -p ~/.sqlite3 |
66 | + cd ~/.sqlite3 |
67 | + wget "https://sqlite.org/2023/sqlite-tools-linux-x86-3420000.zip" |
68 | + unzip sqlite-tools-linux-x86-3420000.zip |
69 | + mv sqlite-tools-linux-x86-3420000/* . |
70 | + rm -rf sqlite-tools-linux-x86-3420000* |
71 | + echo "SQLITE_BIN=$(pwd)/sqlite3" >> $GITHUB_ENV |
72 | - id: cache-rustup |
73 | name: Cache Rust toolchain |
74 | uses: actions/cache@v3 |
75 | diff --git a/.github/workflows/rustdoc.yml b/.github/workflows/rustdoc.yml |
76 | index 8ea5781..d0eafd4 100644 |
77 | --- a/.github/workflows/rustdoc.yml |
78 | +++ b/.github/workflows/rustdoc.yml |
79 | @@ -3,6 +3,7 @@ name: Build rustdoc for Github Pages |
80 | env: |
81 | RUST_BACKTRACE: 1 |
82 | CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse |
83 | + SQLITE_BIN: ~/.sqlite3/sqlite3 |
84 | |
85 | on: |
86 | workflow_dispatch: |
87 | @@ -12,6 +13,24 @@ jobs: |
88 | runs-on: ubuntu-latest |
89 | steps: |
90 | - uses: actions/checkout@v1 |
91 | + - id: cache-sqlite3-bin |
92 | + name: Cache sqlite3 binary |
93 | + uses: actions/cache@v3 |
94 | + with: |
95 | + path: ~/.sqlite3 |
96 | + key: toolchain-sqlite3 |
97 | + - if: ${{ steps.cache-sqlite3-bin.outputs.cache-hit != 'true' }} |
98 | + name: Download sqlite3 binary |
99 | + run: | |
100 | + set -ex |
101 | + sudo apt-get install -y --quiet wget unzip |
102 | + mkdir -p ~/.sqlite3 |
103 | + cd ~/.sqlite3 |
104 | + wget "https://sqlite.org/2023/sqlite-tools-linux-x86-3420000.zip" |
105 | + unzip sqlite-tools-linux-x86-3420000.zip |
106 | + mv sqlite-tools-linux-x86-3420000/* . |
107 | + rm -rf sqlite-tools-linux-x86-3420000* |
108 | + echo "SQLITE_BIN=$(pwd)/sqlite3" >> $GITHUB_ENV |
109 | - id: cache-rustup |
110 | name: Cache Rust toolchain |
111 | uses: actions/cache@v3 |
112 | diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml |
113 | index 4958e63..fa910c1 100644 |
114 | --- a/.github/workflows/test.yaml |
115 | +++ b/.github/workflows/test.yaml |
116 | @@ -3,6 +3,7 @@ name: Tests |
117 | env: |
118 | RUST_BACKTRACE: 1 |
119 | CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse |
120 | + SQLITE_BIN: ~/.sqlite3/sqlite3 |
121 | |
122 | on: |
123 | workflow_dispatch: |
124 | @@ -30,6 +31,24 @@ jobs: |
125 | target: x86_64-unknown-linux-gnu |
126 | steps: |
127 | - uses: actions/checkout@v2 |
128 | + - id: cache-sqlite3-bin |
129 | + name: Cache sqlite3 binary |
130 | + uses: actions/cache@v3 |
131 | + with: |
132 | + path: ~/.sqlite3 |
133 | + key: toolchain-sqlite3 |
134 | + - if: ${{ steps.cache-sqlite3-bin.outputs.cache-hit != 'true' }} |
135 | + name: Download sqlite3 binary |
136 | + run: | |
137 | + set -ex |
138 | + sudo apt-get install -y --quiet wget unzip |
139 | + mkdir -p ~/.sqlite3 |
140 | + cd ~/.sqlite3 |
141 | + wget "https://sqlite.org/2023/sqlite-tools-linux-x86-3420000.zip" |
142 | + unzip sqlite-tools-linux-x86-3420000.zip |
143 | + mv sqlite-tools-linux-x86-3420000/* . |
144 | + rm -rf sqlite-tools-linux-x86-3420000* |
145 | + echo "SQLITE_BIN=$(pwd)/sqlite3" >> $GITHUB_ENV |
146 | - id: cache-rustup |
147 | name: Cache Rust toolchain |
148 | uses: actions/cache@v3 |
149 | diff --git a/core/build.rs b/core/build.rs |
150 | index f48cd5b..99aff85 100644 |
151 | --- a/core/build.rs |
152 | +++ b/core/build.rs |
153 | @@ -63,7 +63,7 @@ fn main() { |
154 | ); |
155 | } |
156 | make_migrations("migrations", MIGRATION_RS, &mut output.stdout); |
157 | - let mut verify = Command::new("sqlite3") |
158 | + let mut verify = Command::new(std::env::var("SQLITE_BIN").unwrap_or("sqlite3".into())) |
159 | .stdin(Stdio::piped()) |
160 | .stdout(Stdio::piped()) |
161 | .stderr(Stdio::piped()) |
162 | diff --git a/core/src/connection.rs b/core/src/connection.rs |
163 | index f875fb0..551b49a 100644 |
164 | --- a/core/src/connection.rs |
165 | +++ b/core/src/connection.rs |
166 | @@ -340,12 +340,13 @@ impl Connection { |
167 | info!("Creating database in {}", db_path.display()); |
168 | std::fs::File::create(db_path).context("Could not create db path")?; |
169 | |
170 | - let mut child = Command::new("sqlite3") |
171 | - .arg(db_path) |
172 | - .stdin(Stdio::piped()) |
173 | - .stdout(Stdio::piped()) |
174 | - .stderr(Stdio::piped()) |
175 | - .spawn()?; |
176 | + let mut child = |
177 | + Command::new(std::env::var("SQLITE_BIN").unwrap_or_else(|_| "sqlite3".into())) |
178 | + .arg(db_path) |
179 | + .stdin(Stdio::piped()) |
180 | + .stdout(Stdio::piped()) |
181 | + .stderr(Stdio::piped()) |
182 | + .spawn()?; |
183 | let mut stdin = child.stdin.take().unwrap(); |
184 | std::thread::spawn(move || { |
185 | stdin |