Skip to content

Commit f4f7811

Browse files
authored
Update deps (#10)
* Update deps Fix lints * Add aarch64 support * Fix deny
1 parent 9402ab0 commit f4f7811

16 files changed

+637
-588
lines changed

.cargo/config.toml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# add the below section to `.cargo/config.toml`
2+
3+
[target.'cfg(all())']
4+
rustflags = [
5+
# BEGIN - Embark standard lints v6 for Rust 1.55+
6+
# do not change or add/remove here, but one can add exceptions after this section
7+
# for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
8+
"-Dunsafe_code",
9+
"-Wclippy::all",
10+
"-Wclippy::await_holding_lock",
11+
"-Wclippy::char_lit_as_u8",
12+
"-Wclippy::checked_conversions",
13+
"-Wclippy::dbg_macro",
14+
"-Wclippy::debug_assert_with_mut_call",
15+
"-Wclippy::doc_markdown",
16+
"-Wclippy::empty_enum",
17+
"-Wclippy::enum_glob_use",
18+
"-Wclippy::exit",
19+
"-Wclippy::expl_impl_clone_on_copy",
20+
"-Wclippy::explicit_deref_methods",
21+
"-Wclippy::explicit_into_iter_loop",
22+
"-Wclippy::fallible_impl_from",
23+
"-Wclippy::filter_map_next",
24+
"-Wclippy::flat_map_option",
25+
"-Wclippy::float_cmp_const",
26+
"-Wclippy::fn_params_excessive_bools",
27+
"-Wclippy::from_iter_instead_of_collect",
28+
"-Wclippy::if_let_mutex",
29+
"-Wclippy::implicit_clone",
30+
"-Wclippy::imprecise_flops",
31+
"-Wclippy::inefficient_to_string",
32+
"-Wclippy::invalid_upcast_comparisons",
33+
"-Wclippy::large_digit_groups",
34+
"-Wclippy::large_stack_arrays",
35+
"-Wclippy::large_types_passed_by_value",
36+
"-Wclippy::let_unit_value",
37+
"-Wclippy::linkedlist",
38+
"-Wclippy::lossy_float_literal",
39+
"-Wclippy::macro_use_imports",
40+
"-Wclippy::manual_ok_or",
41+
"-Wclippy::map_err_ignore",
42+
"-Wclippy::map_flatten",
43+
"-Wclippy::map_unwrap_or",
44+
"-Wclippy::match_on_vec_items",
45+
"-Wclippy::match_same_arms",
46+
"-Wclippy::match_wild_err_arm",
47+
"-Wclippy::match_wildcard_for_single_variants",
48+
"-Wclippy::mem_forget",
49+
"-Wclippy::mismatched_target_os",
50+
"-Wclippy::missing_enforced_import_renames",
51+
"-Wclippy::mut_mut",
52+
"-Wclippy::mutex_integer",
53+
"-Wclippy::needless_borrow",
54+
"-Wclippy::needless_continue",
55+
"-Wclippy::needless_for_each",
56+
"-Wclippy::option_option",
57+
"-Wclippy::path_buf_push_overwrite",
58+
"-Wclippy::ptr_as_ptr",
59+
"-Wclippy::rc_mutex",
60+
"-Wclippy::ref_option_ref",
61+
"-Wclippy::rest_pat_in_fully_bound_structs",
62+
"-Wclippy::same_functions_in_if_condition",
63+
"-Wclippy::semicolon_if_nothing_returned",
64+
"-Wclippy::single_match_else",
65+
"-Wclippy::string_add_assign",
66+
"-Wclippy::string_add",
67+
"-Wclippy::string_lit_as_bytes",
68+
"-Wclippy::string_to_string",
69+
"-Wclippy::todo",
70+
"-Wclippy::trait_duplication_in_bounds",
71+
"-Wclippy::unimplemented",
72+
"-Wclippy::unnested_or_patterns",
73+
"-Wclippy::unused_self",
74+
"-Wclippy::useless_transmute",
75+
"-Wclippy::verbose_file_reads",
76+
"-Wclippy::zero_sized_map_values",
77+
"-Wfuture_incompatible",
78+
"-Wnonstandard_style",
79+
"-Wrust_2018_idioms",
80+
# END - Embark standard lints v6 for Rust 1.55+
81+
]

.github/scripts/package.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
# When run in a container, the ownership will be messed up, so mark the
5+
# checkout dir as safe regardless of our env
6+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
7+
8+
# Normally we'll only do this on tags, but add --always to fallback to the revision
9+
# if we're iterating or the like
10+
tag=$(git describe --tags --abbrev=0 --always)
11+
release_name="$NAME-$tag-$TARGET"
12+
release_tar="${release_name}.tar.gz"
13+
mkdir "$release_name"
14+
15+
if [ "$TARGET" =~ windows ]; then
16+
bin="$NAME.exe"
17+
else
18+
bin="$NAME"
19+
fi
20+
21+
cp "target/$TARGET/release/$bin" "$release_name/"
22+
cp README.md LICENSE-APACHE LICENSE-MIT "$release_name/"
23+
tar czf "$release_tar" "$release_name"
24+
25+
rm -r "$release_name"
26+
27+
# Windows environments in github actions don't have the gnu coreutils installed,
28+
# which includes the shasum exe, so we just use powershell instead
29+
if [ "$TARGET" =~ windows ]; then
30+
echo "(Get-FileHash \"${release_tar}\" -Algorithm SHA256).Hash | Out-File -Encoding ASCII -NoNewline \"${release_tar}.sha256\"" | pwsh -c -
31+
else
32+
echo -n "$(shasum -ba 256 "${release_tar}" | cut -d " " -f 1)" > "${release_tar}.sha256"
33+
fi

.github/workflows/rust-ci.yml

+47-68
Original file line numberDiff line numberDiff line change
@@ -14,124 +14,103 @@ name: CI
1414
jobs:
1515
lint:
1616
name: Lint
17-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-22.04
1818
steps:
19-
- uses: actions/checkout@v2
20-
- uses: actions-rs/toolchain@v1
19+
- uses: actions/checkout@v3
20+
- uses: dtolnay/rust-toolchain@stable
2121
with:
22-
toolchain: stable
23-
override: true
24-
25-
- name: add rustup components
26-
run: rustup component add rustfmt clippy
22+
components: "clippy, rustfmt"
23+
- uses: Swatinem/rust-cache@v2
2724

2825
# make sure all code has been formatted with rustfmt
2926
- name: check rustfmt
3027
run: cargo fmt -- --check --color always
3128

3229
# run clippy to verify we have no warnings
30+
- run: cargo fetch
3331
- name: cargo clippy
3432
run: cargo clippy --all-targets --all-features -- -D warnings
3533

3634
test:
3735
name: Test
3836
strategy:
3937
matrix:
40-
os: [ubuntu-20.04, windows-latest, macOS-latest]
38+
os: [ubuntu-22.04, windows-2022, macOS-12]
4139
runs-on: ${{ matrix.os }}
4240
steps:
43-
- uses: actions/checkout@v2
44-
- uses: actions-rs/toolchain@v1
45-
with:
46-
toolchain: stable
47-
override: true
41+
- uses: actions/checkout@v3
42+
- uses: dtolnay/rust-toolchain@stable
43+
- uses: Swatinem/rust-cache@v2
4844
- run: cargo fetch
4945
- name: cargo test build
50-
run: cargo build --tests --release
46+
run: cargo build --tests
5147
- name: cargo test
52-
run: cargo test --release
48+
run: cargo test
5349

5450
deny-check:
5551
name: cargo-deny
56-
runs-on: ubuntu-20.04
52+
runs-on: ubuntu-22.04
5753
steps:
58-
- uses: actions/checkout@v2
54+
- uses: actions/checkout@v3
5955
- uses: EmbarkStudios/cargo-deny-action@v1
6056

6157
publish-check:
6258
name: Publish Check
63-
runs-on: ubuntu-20.04
59+
runs-on: ubuntu-22.04
60+
container: ghcr.io/cross-rs/aarch64-unknown-linux-musl:edge
61+
strategy:
62+
matrix:
63+
include:
64+
- target: aarch64-unknown-linux-musl
6465
steps:
65-
- uses: actions/checkout@v2
66-
- uses: actions-rs/toolchain@v1
66+
- uses: actions/checkout@v3
67+
- uses: dtolnay/rust-toolchain@stable
6768
with:
68-
toolchain: stable
69-
override: true
69+
target: ${{ matrix.target }}
70+
- uses: Swatinem/rust-cache@v2
7071
- run: cargo fetch
71-
- name: cargo publish check
72-
run: cargo publish --dry-run
72+
- name: cargo publish
73+
run: cargo publish --dry-run --all-features --target ${{ matrix.target }}
7374

7475
release:
7576
name: Release
76-
needs: [test, deny-check]
7777
if: startsWith(github.ref, 'refs/tags/')
7878
strategy:
7979
matrix:
8080
include:
81-
- os: ubuntu-20.04
82-
rust: stable
81+
- os: ubuntu-22.04
8382
target: x86_64-unknown-linux-musl
84-
bin: gsutil
85-
- os: windows-latest
86-
rust: stable
83+
- os: ubuntu-22.04
84+
target: aarch64-unknown-linux-musl
85+
container: ghcr.io/cross-rs/aarch64-unknown-linux-musl:edge
86+
- os: windows-2022
8787
target: x86_64-pc-windows-msvc
88-
bin: gsutil.exe
89-
- os: macOS-latest
90-
rust: stable
88+
- os: macOS-12
9189
target: x86_64-apple-darwin
92-
bin: gsutil
90+
- os: macOS-12
91+
target: aarch64-apple-darwin
9392
runs-on: ${{ matrix.os }}
93+
container: ${{ matrix.container }}
9494
steps:
95-
- name: Install stable toolchain
96-
uses: actions-rs/toolchain@v1
95+
- uses: dtolnay/rust-toolchain@stable
9796
with:
98-
toolchain: ${{ matrix.rust }}
99-
override: true
10097
target: ${{ matrix.target }}
10198
- name: Install musl tools
102-
if: matrix.os == 'ubuntu-20.04'
103-
run: sudo apt-get install -y musl-tools
99+
if: matrix.target == 'x86_64-unknown-linux-musl'
100+
run: |
101+
sudo apt install -y musl-tools
104102
- name: Checkout
105-
uses: actions/checkout@v2
106-
- run: cargo fetch --target ${{ matrix.target }}
103+
uses: actions/checkout@v3
104+
- name: cargo fetch
105+
run: cargo fetch --target ${{ matrix.target }}
107106
- name: Release build
108-
run: cargo build --release --target ${{ matrix.target }}
107+
run: cargo build --release --target ${{ matrix.target }} --features=gcs,s3,fs,blob
109108
- name: Package
110109
shell: bash
111-
run: |
112-
name=gsutil
113-
tag=$(git describe --tags --abbrev=0)
114-
release_name="$name-$tag-${{ matrix.target }}"
115-
release_tar="${release_name}.tar.gz"
116-
mkdir "$release_name"
117-
118-
if [ "${{ matrix.target }}" != "x86_64-pc-windows-msvc" ]; then
119-
strip "target/${{ matrix.target }}/release/${{ matrix.bin }}"
120-
fi
121-
122-
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "$release_name/"
123-
cp README.md LICENSE-APACHE LICENSE-MIT "$release_name/"
124-
tar czvf "$release_tar" "$release_name"
125-
126-
rm -r "$release_name"
127-
128-
# Windows environments in github actions don't have the gnu coreutils installed,
129-
# which includes the shasum exe, so we just use powershell instead
130-
if [ "${{ matrix.os }}" == "windows-latest" ]; then
131-
echo "(Get-FileHash \"${release_tar}\" -Algorithm SHA256).Hash | Out-File -Encoding ASCII -NoNewline \"${release_tar}.sha256\"" | pwsh -c -
132-
else
133-
echo -n "$(shasum -ba 256 "${release_tar}" | cut -d " " -f 1)" > "${release_tar}.sha256"
134-
fi
110+
env:
111+
NAME: gsutil
112+
TARGET: ${{ matrix.target }}
113+
run: .github/scripts/package.sh
135114
- name: Publish
136115
uses: softprops/action-gh-release@v1
137116
with:

0 commit comments

Comments
 (0)