Skip to content

Commit

Permalink
Merge pull request #1 from yuhao-su/add-ci
Browse files Browse the repository at this point in the history
add ci
  • Loading branch information
yuhao-su authored May 8, 2024
2 parents 3ba61ec + c6e7a68 commit 02ed0e1
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

name: CI

on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: Check code format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Build
uses: actions-rs/cargo@v1
with:
command: build

test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
toolchain: [stable, nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --release --no-fail-fast

doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ macro_rules! ENDPOINT_URL_TEMPLATE {
};
}
/// Indicates whether credentials should be debugged
#[cfg(debug_assertions)]
const AWS_DEBUG_CREDS: bool = false;
/// Libray package version
const VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -232,7 +233,7 @@ fn base64_encode(signed_url: Url) -> String {

// Add user agent to the signed url
fn add_user_agent(signed_url: &mut Url) {
let user_agent = format!("{LIB_NAME}/{VERSION}");
let user_agent = format!("{LIB_NAME}-rs/{VERSION}");
signed_url
.query_pairs_mut()
.append_pair(USER_AGENT_KEY, &user_agent);
Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn verify_auth_token(token: String, expiry_ms: i64, cred: &Credentials) {
let decoded_signed_url = String::from_utf8(decoded_signed_url_bytes).unwrap();

let parsed_url = Url::parse(&decoded_signed_url).unwrap();
dbg!(&parsed_url);

assert_eq!(parsed_url.scheme(), "https");
assert_eq!(parsed_url.host_str(), Some(TEST_ENDPOINT));

Expand Down

0 comments on commit 02ed0e1

Please sign in to comment.