Skip to content

Commit

Permalink
Merge branch 'release/samedec-0.2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
cbs228 committed Feb 26, 2023
2 parents 5daa2b7 + 4bb37fe commit d172b9b
Show file tree
Hide file tree
Showing 15 changed files with 896 additions and 420 deletions.
Empty file.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Opinionated default for line endings
* text=auto eol=lf
95 changes: 76 additions & 19 deletions .github/workflows/rust_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,53 @@ env:
RUST_BACKTRACE: 1

jobs:
# run `cargo vendor` and cache it
vendor_sources:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
name: Update crate cargo-vendor cache
id: vendor_cache
with:
path: |
.cargo
vendor
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-vendor-release
cargo-vendor
enableCrossOsArchive: true

- uses: actions/cache@v3
name: Update cargo registry cache
if: steps.vendor_cache.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-cache-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-cache-release
${{ runner.os }}-cargo-cache
- name: Vendor sources
if: steps.vendor_cache.outputs.cache-hit != 'true'
run: |
mkdir -p .cargo
mkdir -p vendor
cargo vendor --versioned-dirs --locked >.cargo/config.toml
# Linux builds, with Docker and qemu as required
release_linux:
runs-on: ubuntu-latest

needs: vendor_sources

env:
# See <https://hub.docker.com/_/rust> for list of tags
BUILD_RUST_TAG: 1.67.0
Expand Down Expand Up @@ -49,6 +92,16 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/cache/restore@v3
name: Restore crate cargo-vendor cache
with:
path: |
.cargo
vendor
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Workaround for https://github.com/rust-lang/cargo/issues/8719
run: |
sudo mkdir -p /var/lib/docker
Expand Down Expand Up @@ -84,6 +137,7 @@ jobs:
target: localfile
build-args: |
CARGO_BUILD_TARGET=${{ matrix.rust }}
CARGO_NET_OFFLINE=true
BUILD_OS_TAG=${{ matrix.os }}
BUILD_RUST_TAG=${{ env.BUILD_RUST_TAG }}
platforms: ${{ matrix.docker }}
Expand Down Expand Up @@ -131,9 +185,12 @@ jobs:
release_windows:
runs-on: windows-latest

needs: vendor_sources

env:
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
CARGO_INSTALL_ROOT: 'install/'
CARGO_NET_OFFLINE: "true"
CARGO_INSTALL_ROOT: "install/"
RUSTFLAGS: '-C strip=symbols -C target-feature=+crt-static'
samedec_exe: 'install/bin/samedec.exe'
samedec_target_exe: install/bin/samedec-x86_64-pc-windows-msvc.exe
Expand All @@ -145,22 +202,20 @@ jobs:
shell: bash
run: cargo version

- uses: actions/cache@v3
name: Restore Rust cache
- uses: actions/cache/restore@v3
name: Restore crate cargo-vendor cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
.cargo
vendor
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Build
shell: bash
run: |
mkdir -p 'install' &&
cargo fetch --locked &&
cargo build --offline --tests --frozen --release --workspace
- name: Test and install
Expand Down Expand Up @@ -218,9 +273,12 @@ jobs:
release_macos:
runs-on: macos-latest

needs: vendor_sources

env:
CARGO_BUILD_TARGET: x86_64-apple-darwin
CARGO_INSTALL_ROOT: 'install/'
CARGO_NET_OFFLINE: "true"
CARGO_INSTALL_ROOT: "install/"
RUSTFLAGS: '-C strip=symbols'
samedec_exe: 'install/bin/samedec'
samedec_target_exe: install/bin/samedec-x86_64-apple-darwin
Expand All @@ -231,16 +289,15 @@ jobs:
- name: Record environment
run: cargo version

- uses: actions/cache@v3
name: Restore Rust cache
- uses: actions/cache/restore@v3
name: Restore crate cargo-vendor cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
.cargo
vendor
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Build
run: |
Expand Down
146 changes: 102 additions & 44 deletions .github/workflows/rust_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,126 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
test_linux:
# run `cargo vendor` and cache it
vendor_sources:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Record environment
run: cat /etc/os-release && cargo version

- uses: actions/cache@v3
name: Update crate cargo-vendor cache
id: vendor_cache
with:
path: |
.cargo
vendor
key: cargo-vendor-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-vendor
enableCrossOsArchive: true

- uses: actions/cache@v3
name: Restore Rust cache
name: Update cargo registry cache
if: steps.vendor_cache.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
test_windows:
runs-on: windows-latest
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-cache
- name: Vendor sources
if: steps.vendor_cache.outputs.cache-hit != 'true'
run: |
mkdir -p .cargo
mkdir -p vendor
cargo vendor --versioned-dirs --locked >.cargo/config.toml
test_sameold:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
features: ['', 'chrono']

runs-on: ${{ matrix.os }}

needs: vendor_sources

env:
CARGO_NET_OFFLINE: "true"

steps:
- uses: actions/checkout@v3

- name: Record environment
shell: bash
run: cargo version
- uses: actions/cache@v3
name: Restore Rust cache

- uses: actions/cache/restore@v3
name: Restore crate cargo-vendor cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
shell: bash
run: cargo build --verbose
- name: Run tests
.cargo
vendor
key: cargo-vendor-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Build and test sameold
shell: bash
run: cargo test --verbose
test_macos:
runs-on: macos-latest
run: |
cargo test --frozen -p sameold --verbose --no-default-features --features "${{ matrix.features }}"
test_samedec:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

needs: vendor_sources

env:
CARGO_NET_OFFLINE: "true"

steps:
- uses: actions/checkout@v3
- name: Record environment
run: cargo version
- uses: actions/cache@v3
name: Restore Rust cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v3

- name: Record environment
shell: bash
run: cargo version

- uses: actions/cache/restore@v3
name: Restore crate cargo-vendor cache
with:
path: |
.cargo
vendor
key: cargo-vendor-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Build and test samedec
shell: bash
run: |
cargo test --frozen -p samedec --verbose
- name: Run integration tests
shell: bash
run: |
EXPECT="$(cat <sample/long_message.22050.s16le.txt)" &&
OUT="$(cargo run -p samedec -- -r 22050 <sample/long_message.22050.s16le.bin)" &&
echo "$OUT" &&
if [ "$OUT" = "$EXPECT" ]; then
echo "PASS";
else
echo "FAIL!";
exit 1;
fi
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
**/*.rs.bk
*.iml
/.idea

# containerized build can use vendoring on the host side,
# but we would prefer that this not be committed.
.cargo
/vendor
Loading

0 comments on commit d172b9b

Please sign in to comment.