Skip to content

Commit d172b9b

Browse files
committed
Merge branch 'release/samedec-0.2.5'
2 parents 5daa2b7 + 4bb37fe commit d172b9b

15 files changed

Lines changed: 896 additions & 420 deletions

File tree

.cargo/.directory_intentionally_empty

Whitespace-only changes.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Opinionated default for line endings
2+
* text=auto eol=lf

.github/workflows/rust_release.yml

Lines changed: 76 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,53 @@ env:
1313
RUST_BACKTRACE: 1
1414

1515
jobs:
16+
# run `cargo vendor` and cache it
17+
vendor_sources:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- uses: actions/cache@v3
24+
name: Update crate cargo-vendor cache
25+
id: vendor_cache
26+
with:
27+
path: |
28+
.cargo
29+
vendor
30+
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
31+
restore-keys: |
32+
cargo-vendor-release
33+
cargo-vendor
34+
enableCrossOsArchive: true
35+
36+
- uses: actions/cache@v3
37+
name: Update cargo registry cache
38+
if: steps.vendor_cache.outputs.cache-hit != 'true'
39+
with:
40+
path: |
41+
~/.cargo/bin/
42+
~/.cargo/registry/index/
43+
~/.cargo/registry/cache/
44+
~/.cargo/git/db/
45+
key: ${{ runner.os }}-cargo-cache-release-${{ hashFiles('**/Cargo.lock') }}
46+
restore-keys: |
47+
${{ runner.os }}-cargo-cache-release
48+
${{ runner.os }}-cargo-cache
49+
50+
- name: Vendor sources
51+
if: steps.vendor_cache.outputs.cache-hit != 'true'
52+
run: |
53+
mkdir -p .cargo
54+
mkdir -p vendor
55+
cargo vendor --versioned-dirs --locked >.cargo/config.toml
56+
1657
# Linux builds, with Docker and qemu as required
1758
release_linux:
1859
runs-on: ubuntu-latest
1960

61+
needs: vendor_sources
62+
2063
env:
2164
# See <https://hub.docker.com/_/rust> for list of tags
2265
BUILD_RUST_TAG: 1.67.0
@@ -49,6 +92,16 @@ jobs:
4992
steps:
5093
- uses: actions/checkout@v3
5194

95+
- uses: actions/cache/restore@v3
96+
name: Restore crate cargo-vendor cache
97+
with:
98+
path: |
99+
.cargo
100+
vendor
101+
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
102+
enableCrossOsArchive: true
103+
fail-on-cache-miss: true
104+
52105
- name: Workaround for https://github.com/rust-lang/cargo/issues/8719
53106
run: |
54107
sudo mkdir -p /var/lib/docker
@@ -84,6 +137,7 @@ jobs:
84137
target: localfile
85138
build-args: |
86139
CARGO_BUILD_TARGET=${{ matrix.rust }}
140+
CARGO_NET_OFFLINE=true
87141
BUILD_OS_TAG=${{ matrix.os }}
88142
BUILD_RUST_TAG=${{ env.BUILD_RUST_TAG }}
89143
platforms: ${{ matrix.docker }}
@@ -131,9 +185,12 @@ jobs:
131185
release_windows:
132186
runs-on: windows-latest
133187

188+
needs: vendor_sources
189+
134190
env:
135191
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
136-
CARGO_INSTALL_ROOT: 'install/'
192+
CARGO_NET_OFFLINE: "true"
193+
CARGO_INSTALL_ROOT: "install/"
137194
RUSTFLAGS: '-C strip=symbols -C target-feature=+crt-static'
138195
samedec_exe: 'install/bin/samedec.exe'
139196
samedec_target_exe: install/bin/samedec-x86_64-pc-windows-msvc.exe
@@ -145,22 +202,20 @@ jobs:
145202
shell: bash
146203
run: cargo version
147204

148-
- uses: actions/cache@v3
149-
name: Restore Rust cache
205+
- uses: actions/cache/restore@v3
206+
name: Restore crate cargo-vendor cache
150207
with:
151208
path: |
152-
~/.cargo/bin/
153-
~/.cargo/registry/index/
154-
~/.cargo/registry/cache/
155-
~/.cargo/git/db/
156-
target/
157-
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
209+
.cargo
210+
vendor
211+
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
212+
enableCrossOsArchive: true
213+
fail-on-cache-miss: true
158214

159215
- name: Build
160216
shell: bash
161217
run: |
162218
mkdir -p 'install' &&
163-
cargo fetch --locked &&
164219
cargo build --offline --tests --frozen --release --workspace
165220
166221
- name: Test and install
@@ -218,9 +273,12 @@ jobs:
218273
release_macos:
219274
runs-on: macos-latest
220275

276+
needs: vendor_sources
277+
221278
env:
222279
CARGO_BUILD_TARGET: x86_64-apple-darwin
223-
CARGO_INSTALL_ROOT: 'install/'
280+
CARGO_NET_OFFLINE: "true"
281+
CARGO_INSTALL_ROOT: "install/"
224282
RUSTFLAGS: '-C strip=symbols'
225283
samedec_exe: 'install/bin/samedec'
226284
samedec_target_exe: install/bin/samedec-x86_64-apple-darwin
@@ -231,16 +289,15 @@ jobs:
231289
- name: Record environment
232290
run: cargo version
233291

234-
- uses: actions/cache@v3
235-
name: Restore Rust cache
292+
- uses: actions/cache/restore@v3
293+
name: Restore crate cargo-vendor cache
236294
with:
237295
path: |
238-
~/.cargo/bin/
239-
~/.cargo/registry/index/
240-
~/.cargo/registry/cache/
241-
~/.cargo/git/db/
242-
target/
243-
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
296+
.cargo
297+
vendor
298+
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
299+
enableCrossOsArchive: true
300+
fail-on-cache-miss: true
244301

245302
- name: Build
246303
run: |

.github/workflows/rust_test.yml

Lines changed: 102 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,68 +8,126 @@ on:
88

99
env:
1010
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
1112

1213
jobs:
13-
test_linux:
14+
# run `cargo vendor` and cache it
15+
vendor_sources:
1416
runs-on: ubuntu-latest
17+
1518
steps:
1619
- uses: actions/checkout@v3
17-
- name: Record environment
18-
run: cat /etc/os-release && cargo version
20+
21+
- uses: actions/cache@v3
22+
name: Update crate cargo-vendor cache
23+
id: vendor_cache
24+
with:
25+
path: |
26+
.cargo
27+
vendor
28+
key: cargo-vendor-${{ hashFiles('**/Cargo.lock') }}
29+
restore-keys: |
30+
cargo-vendor
31+
enableCrossOsArchive: true
32+
1933
- uses: actions/cache@v3
20-
name: Restore Rust cache
34+
name: Update cargo registry cache
35+
if: steps.vendor_cache.outputs.cache-hit != 'true'
2136
with:
2237
path: |
2338
~/.cargo/bin/
2439
~/.cargo/registry/index/
2540
~/.cargo/registry/cache/
2641
~/.cargo/git/db/
27-
target/
28-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
29-
- name: Build
30-
run: cargo build --verbose
31-
- name: Run tests
32-
run: cargo test --verbose
33-
test_windows:
34-
runs-on: windows-latest
42+
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-cargo-cache
45+
46+
- name: Vendor sources
47+
if: steps.vendor_cache.outputs.cache-hit != 'true'
48+
run: |
49+
mkdir -p .cargo
50+
mkdir -p vendor
51+
cargo vendor --versioned-dirs --locked >.cargo/config.toml
52+
53+
test_sameold:
54+
strategy:
55+
matrix:
56+
os: [ubuntu-latest, windows-latest, macos-latest]
57+
features: ['', 'chrono']
58+
59+
runs-on: ${{ matrix.os }}
60+
61+
needs: vendor_sources
62+
63+
env:
64+
CARGO_NET_OFFLINE: "true"
65+
3566
steps:
3667
- uses: actions/checkout@v3
68+
3769
- name: Record environment
3870
shell: bash
3971
run: cargo version
40-
- uses: actions/cache@v3
41-
name: Restore Rust cache
72+
73+
- uses: actions/cache/restore@v3
74+
name: Restore crate cargo-vendor cache
4275
with:
4376
path: |
44-
~/.cargo/bin/
45-
~/.cargo/registry/index/
46-
~/.cargo/registry/cache/
47-
~/.cargo/git/db/
48-
target/
49-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
50-
- name: Build
51-
shell: bash
52-
run: cargo build --verbose
53-
- name: Run tests
77+
.cargo
78+
vendor
79+
key: cargo-vendor-${{ hashFiles('**/Cargo.lock') }}
80+
enableCrossOsArchive: true
81+
fail-on-cache-miss: true
82+
83+
- name: Build and test sameold
5484
shell: bash
55-
run: cargo test --verbose
56-
test_macos:
57-
runs-on: macos-latest
85+
run: |
86+
cargo test --frozen -p sameold --verbose --no-default-features --features "${{ matrix.features }}"
87+
88+
test_samedec:
89+
strategy:
90+
matrix:
91+
os: [ubuntu-latest, windows-latest, macos-latest]
92+
93+
runs-on: ${{ matrix.os }}
94+
95+
needs: vendor_sources
96+
97+
env:
98+
CARGO_NET_OFFLINE: "true"
99+
58100
steps:
59-
- uses: actions/checkout@v3
60-
- name: Record environment
61-
run: cargo version
62-
- uses: actions/cache@v3
63-
name: Restore Rust cache
64-
with:
65-
path: |
66-
~/.cargo/bin/
67-
~/.cargo/registry/index/
68-
~/.cargo/registry/cache/
69-
~/.cargo/git/db/
70-
target/
71-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
72-
- name: Build
73-
run: cargo build --verbose
74-
- name: Run tests
75-
run: cargo test --verbose
101+
- uses: actions/checkout@v3
102+
103+
- name: Record environment
104+
shell: bash
105+
run: cargo version
106+
107+
- uses: actions/cache/restore@v3
108+
name: Restore crate cargo-vendor cache
109+
with:
110+
path: |
111+
.cargo
112+
vendor
113+
key: cargo-vendor-${{ hashFiles('**/Cargo.lock') }}
114+
enableCrossOsArchive: true
115+
fail-on-cache-miss: true
116+
117+
- name: Build and test samedec
118+
shell: bash
119+
run: |
120+
cargo test --frozen -p samedec --verbose
121+
122+
- name: Run integration tests
123+
shell: bash
124+
run: |
125+
EXPECT="$(cat <sample/long_message.22050.s16le.txt)" &&
126+
OUT="$(cargo run -p samedec -- -r 22050 <sample/long_message.22050.s16le.bin)" &&
127+
echo "$OUT" &&
128+
if [ "$OUT" = "$EXPECT" ]; then
129+
echo "PASS";
130+
else
131+
echo "FAIL!";
132+
exit 1;
133+
fi

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
**/*.rs.bk
33
*.iml
44
/.idea
5+
6+
# containerized build can use vendoring on the host side,
7+
# but we would prefer that this not be committed.
8+
.cargo
9+
/vendor

0 commit comments

Comments
 (0)