Skip to content

Commit aefae95

Browse files
Merge pull request #216 from SierraSoftworks/ci/glibc-bug
ci: Switch to using the same image for builds and Docker
2 parents b4b0b6a + 7778b23 commit aefae95

13 files changed

Lines changed: 86 additions & 89 deletions

File tree

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484

8585
# Linux builds
8686
- arch: amd64
87-
run_on: ubuntu-latest
87+
run_on: ubuntu-24.04
8888
os: linux
8989
target: x86_64-unknown-linux-gnu
9090
test: true

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# It will then package that binary into the image, and use that as the entrypoint.
33
# This means that running `docker build` is not a repeatable way to build the same
44
# image, but the benefit is much faster cross-platform builds; a net win.
5-
FROM debian:bookworm-slim
5+
FROM ubuntu:24.04
66

77
LABEL org.opencontainers.image.source=https://github.com/SierraSoftworks/github-backup
88
LABEL org.opencontainers.image.description="Backup your GitHub repositories and releases automatically"

src/engines/git.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ mod tests {
350350
#[cfg_attr(feature = "pure_tests", ignore)]
351351
#[rstest]
352352
#[case("SierraSoftworks/grey", "https://github.com/sierrasoftworks/grey.git")]
353-
#[case("neovim/neovim", "https://github.com/neovim/neovim.git")]
354353
#[tokio::test]
355354
async fn test_backup(#[case] name: &str, #[case] url: &str) {
356355
let temp_dir = tempfile::tempdir().expect("a temporary directory");

src/engines/http_file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl BackupEngine<HttpFile> for HttpFileEngine {
157157
tokio::fs::remove_file(&temp_path)
158158
.await
159159
.unwrap_or_else(|e| {
160-
tracing::error!(
160+
error!(
161161
"Failed to remove temporary backup file '{}': {}",
162162
temp_path.display(),
163163
e
@@ -175,7 +175,7 @@ impl BackupEngine<HttpFile> for HttpFileEngine {
175175
tokio::fs::remove_file(&temp_path)
176176
.await
177177
.unwrap_or_else(|e| {
178-
tracing::error!(
178+
error!(
179179
"Failed to remove temporary backup file '{}': {}",
180180
temp_path.display(),
181181
e

src/errors.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
human_errors::error_shim!(Error);
22

3-
use std::convert;
4-
53
use reqwest::StatusCode;
64

7-
impl convert::From<reqwest::Error> for Error {
5+
impl From<reqwest::Error> for Error {
86
fn from(err: reqwest::Error) -> Self {
97
if err.is_connect() {
108
user_with_internal(
@@ -35,7 +33,7 @@ impl convert::From<reqwest::Error> for Error {
3533
}
3634
}
3735

38-
impl convert::From<reqwest::Response> for Error {
36+
impl From<reqwest::Response> for Error {
3937
fn from(resp: reqwest::Response) -> Self {
4038
match resp.status() {
4139
StatusCode::NOT_FOUND => user(
@@ -55,7 +53,7 @@ impl convert::From<reqwest::Response> for Error {
5553
}
5654
}
5755

58-
impl convert::From<reqwest::header::InvalidHeaderValue> for Error {
56+
impl From<reqwest::header::InvalidHeaderValue> for Error {
5957
fn from(err: reqwest::header::InvalidHeaderValue) -> Self {
6058
system_with_internal(
6159
"Could not parse header value due to an internal error.",

src/filter/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Debug for Expr<'_> {
4949
}
5050

5151
struct ExprPrinter<'a, 'b>(&'a mut std::fmt::Formatter<'b>);
52-
impl<'a, 'b> ExprVisitor<std::fmt::Result> for ExprPrinter<'a, 'b> {
52+
impl ExprVisitor<std::fmt::Result> for ExprPrinter<'_, '_> {
5353
fn visit_literal(&mut self, value: &FilterValue) -> std::fmt::Result {
5454
write!(self.0, "{}", value)
5555
}

src/filter/interpreter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl<'a, T: Filterable> FilterContext<'a, T> {
1414
}
1515
}
1616

17-
impl<'a, T: Filterable> ExprVisitor<FilterValue> for FilterContext<'a, T> {
17+
impl<T: Filterable> ExprVisitor<FilterValue> for FilterContext<'_, T> {
1818
fn visit_literal(&mut self, value: &FilterValue) -> FilterValue {
1919
value.clone()
2020
}

src/filter/lexer.rs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -159,81 +159,81 @@ impl<'a> Iterator for Scanner<'a> {
159159
))));
160160
}
161161
'&' => {
162-
if self.match_char('&') {
163-
return Some(Ok(Token::And(Loc::new(
162+
return if self.match_char('&') {
163+
Some(Ok(Token::And(Loc::new(
164164
self.line,
165165
1 + idx - self.line_start,
166-
))));
166+
))))
167167
} else {
168-
return Some(Err(errors::user(
169-
&format!("Filter included an orphaned '&' at {} which is not a valid operator.", Loc::new(self.line, 1 + idx - self.line_start)),
170-
"Ensure that you are using the '&&' operator to implement a logical AND within your filter."
171-
)));
168+
Some(Err(errors::user(
169+
&format!("Filter included an orphaned '&' at {} which is not a valid operator.", Loc::new(self.line, 1 + idx - self.line_start)),
170+
"Ensure that you are using the '&&' operator to implement a logical AND within your filter."
171+
)))
172172
}
173173
}
174174
'|' => {
175-
if self.match_char('|') {
176-
return Some(Ok(Token::Or(Loc::new(
175+
return if self.match_char('|') {
176+
Some(Ok(Token::Or(Loc::new(
177177
self.line,
178178
1 + idx - self.line_start,
179-
))));
179+
))))
180180
} else {
181-
return Some(Err(errors::user(
182-
&format!("Filter included an orphaned '|' at {} which is not a valid operator.", Loc::new(self.line, 1 + idx - self.line_start)),
183-
"Ensure that you are using the '||' operator to implement a logical OR within your filter."
184-
)));
181+
Some(Err(errors::user(
182+
&format!("Filter included an orphaned '|' at {} which is not a valid operator.", Loc::new(self.line, 1 + idx - self.line_start)),
183+
"Ensure that you are using the '||' operator to implement a logical OR within your filter."
184+
)))
185185
}
186186
}
187187
'=' => {
188-
if self.match_char('=') {
189-
return Some(Ok(Token::Equals(Loc::new(
188+
return if self.match_char('=') {
189+
Some(Ok(Token::Equals(Loc::new(
190190
self.line,
191191
1 + idx - self.line_start,
192-
))));
192+
))))
193193
} else {
194-
return Some(Err(errors::user(
195-
&format!("Filter included an orphaned '=' at {} which is not a valid operator.", Loc::new(self.line, 1 + idx - self.line_start)),
196-
"Ensure that you are using the '==' operator to implement a logical equality within your filter."
197-
)));
194+
Some(Err(errors::user(
195+
&format!("Filter included an orphaned '=' at {} which is not a valid operator.", Loc::new(self.line, 1 + idx - self.line_start)),
196+
"Ensure that you are using the '==' operator to implement a logical equality within your filter."
197+
)))
198198
}
199199
}
200200
'!' => {
201-
if self.match_char('=') {
202-
return Some(Ok(Token::NotEquals(Loc::new(
201+
return if self.match_char('=') {
202+
Some(Ok(Token::NotEquals(Loc::new(
203203
self.line,
204204
1 + idx - self.line_start,
205-
))));
205+
))))
206206
} else {
207-
return Some(Ok(Token::Not(Loc::new(
207+
Some(Ok(Token::Not(Loc::new(
208208
self.line,
209209
1 + idx - self.line_start,
210-
))));
210+
))))
211211
}
212212
}
213213
'>' => {
214-
if self.match_char('=') {
215-
return Some(Ok(Token::GreaterEqual(Loc::new(
214+
return if self.match_char('=') {
215+
Some(Ok(Token::GreaterEqual(Loc::new(
216216
self.line,
217217
1 + idx - self.line_start,
218-
))));
218+
))))
219219
} else {
220-
return Some(Ok(Token::GreaterThan(Loc::new(
220+
Some(Ok(Token::GreaterThan(Loc::new(
221221
self.line,
222222
idx - self.line_start,
223-
))));
223+
))))
224224
}
225225
}
226226
'<' => {
227-
if self.match_char('=') {
228-
return Some(Ok(Token::SmallerEqual(Loc::new(
227+
return if self.match_char('=') {
228+
Some(Ok(Token::SmallerEqual(Loc::new(
229229
self.line,
230230
1 + idx - self.line_start,
231-
))));
231+
))))
232232
} else {
233-
return Some(Ok(Token::SmallerThan(Loc::new(
233+
Some(Ok(Token::SmallerThan(Loc::new(
234234
self.line,
235235
idx - self.line_start,
236-
))));
236+
))))
237237
}
238238
}
239239
'"' => {

src/filter/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ impl Filter {
2424
let filter_ptr = NonNull::from(&filter);
2525
let pinned = Box::into_pin(filter);
2626

27-
let tokens = crate::filter::lexer::Scanner::new(unsafe { filter_ptr.as_ref() });
28-
let ast = crate::filter::parser::Parser::parse(tokens.into_iter())?;
27+
let tokens = lexer::Scanner::new(unsafe { filter_ptr.as_ref() });
28+
let ast = parser::Parser::parse(tokens.into_iter())?;
2929
Ok(Self {
3030
filter: pinned,
3131
ast,
@@ -71,6 +71,13 @@ impl<'de> serde::Deserialize<'de> for Filter {
7171
formatter.write_str("a valid filter expression")
7272
}
7373

74+
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
75+
where
76+
E: serde::de::Error,
77+
{
78+
Filter::new(v).map_err(serde::de::Error::custom)
79+
}
80+
7481
fn visit_none<E>(self) -> Result<Self::Value, E>
7582
where
7683
E: serde::de::Error,
@@ -84,13 +91,6 @@ impl<'de> serde::Deserialize<'de> for Filter {
8491
{
8592
deserializer.deserialize_str(self)
8693
}
87-
88-
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
89-
where
90-
E: serde::de::Error,
91-
{
92-
Filter::new(v).map_err(serde::de::Error::custom)
93-
}
9494
}
9595

9696
deserializer.deserialize_option(FilterVisitor)

src/filter/parser.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'a, I: Iterator<Item = Result<Token<'a>, Error>>> Parser<'a, I> {
6767
self.tokens.peek(),
6868
Some(Ok(Token::Equals(..)) | Ok(Token::NotEquals(..)))
6969
) {
70-
let token = self.tokens.next().unwrap().unwrap();
70+
let token = self.tokens.next().unwrap()?;
7171
let right = self.comparison()?;
7272
expr = Expr::Binary(Box::new(expr), token, Box::new(right));
7373
}
@@ -89,7 +89,7 @@ impl<'a, I: Iterator<Item = Result<Token<'a>, Error>>> Parser<'a, I> {
8989
| Some(Ok(Token::SmallerThan(..)))
9090
| Some(Ok(Token::SmallerEqual(..)))
9191
) {
92-
let token = self.tokens.next().unwrap().unwrap();
92+
let token = self.tokens.next().unwrap()?;
9393
let right = self.unary()?;
9494
expr = Expr::Binary(Box::new(expr), token, Box::new(right));
9595
}
@@ -99,7 +99,7 @@ impl<'a, I: Iterator<Item = Result<Token<'a>, Error>>> Parser<'a, I> {
9999

100100
fn unary(&mut self) -> Result<Expr<'a>, Error> {
101101
if matches!(self.tokens.peek(), Some(Ok(Token::Not(..)))) {
102-
let token = self.tokens.next().unwrap().unwrap();
102+
let token = self.tokens.next().unwrap()?;
103103
let right = self.unary()?;
104104
Ok(Expr::Unary(token, Box::new(right)))
105105
} else {
@@ -110,7 +110,7 @@ impl<'a, I: Iterator<Item = Result<Token<'a>, Error>>> Parser<'a, I> {
110110
fn primary(&mut self) -> Result<Expr<'a>, Error> {
111111
match self.tokens.peek() {
112112
Some(Ok(Token::LeftParen(..))) => {
113-
let start = self.tokens.next().unwrap().unwrap();
113+
let start = self.tokens.next().unwrap()?;
114114
let expr = self.or()?;
115115
if let Some(Ok(Token::RightParen(..))) = self.tokens.next() {
116116
Ok(expr)
@@ -122,7 +122,7 @@ impl<'a, I: Iterator<Item = Result<Token<'a>, Error>>> Parser<'a, I> {
122122
}
123123
}
124124
Some(Ok(Token::LeftBracket(..))) => {
125-
let start = self.tokens.next().unwrap().unwrap();
125+
let start = self.tokens.next().unwrap()?;
126126
let mut items = Vec::new();
127127
while !matches!(self.tokens.peek(), Some(Ok(Token::RightBracket(..)))) {
128128
items.push(self.literal()?);
@@ -162,13 +162,13 @@ impl<'a, I: Iterator<Item = Result<Token<'a>, Error>>> Parser<'a, I> {
162162
match self.tokens.next() {
163163
Some(Ok(Token::True(..))) => Ok(true.into()),
164164
Some(Ok(Token::False(..))) => Ok(false.into()),
165-
Some(Ok(Token::Number(loc, n))) => Ok(super::FilterValue::Number(n.parse().map_err(|e| errors::user_with_internal(
165+
Some(Ok(Token::Number(loc, n))) => Ok(FilterValue::Number(n.parse().map_err(|e| errors::user_with_internal(
166166
&format!("Failed to parse the number '{n}' which you provided at {}.", loc),
167167
"Please make sure that the number is well formatted. It should be in the form 123, or 123.45.",
168168
e,
169169
))?)),
170170
Some(Ok(Token::String(.., s))) => Ok(s.replace("\\\"", "\"").replace("\\\\", "\\").into()),
171-
Some(Ok(Token::Null(..))) => Ok(super::FilterValue::Null),
171+
Some(Ok(Token::Null(..))) => Ok(FilterValue::Null),
172172
Some(Ok(token)) => Err(errors::user(
173173
&format!("While parsing your filter, we found an unexpected '{}' at {}.", token, token.location()),
174174
"Make sure that you have written a valid filter query.",

0 commit comments

Comments
 (0)