Merge pull request #62 from skunkteam/Deflake-txn-tests #207
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: ["master"] | |
tags: ["v*.*.*"] | |
pull_request: | |
branches: ["master"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
- name: Run tests | |
run: cargo test --workspace | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- name: Enforce formatting | |
run: cargo +nightly fmt --all --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
- name: Linting | |
run: cargo clippy --workspace -- -D warnings | |
compat-test: | |
name: Compatibility test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
- run: cargo build | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: test-suite/package-lock.json | |
- name: Run compatibility test suite | |
run: npm ci && npm run test:rust-emulator | |
working-directory: test-suite | |
deploy: | |
name: Deploy | |
needs: | |
- test | |
- fmt | |
- clippy | |
- compat-test | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
- name: Build | |
run: cargo build --release --no-default-features | |
- name: Package | |
shell: bash | |
run: | | |
cd target/release | |
tar czvf ../../firestore-emulator.tar.gz firestore-emulator | |
cd - | |
- name: Publish | |
# More info at: https://github.com/softprops/action-gh-release | |
uses: softprops/action-gh-release@v2 | |
with: | |
# Will be accessible at: | |
# - https://github.com/skunkteam/rust-firestore-emulator/releases/latest/download/firestore-emulator.tar.gz | |
# - https://github.com/skunkteam/rust-firestore-emulator/releases/download/<tag>/firestore-emulator.tar.gz | |
files: firestore-emulator.tar.gz | |
# coverage: | |
# name: Code coverage | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# with: | |
# submodules: "true" | |
# - uses: dtolnay/rust-toolchain@stable | |
# - uses: Swatinem/rust-cache@v2 | |
# - name: Install Protoc | |
# uses: arduino/setup-protoc@v3 | |
# - name: Install tarpaulin | |
# run: cargo install cargo-tarpaulin | |
# - name: Generate code coverage | |
# run: cargo tarpaulin --workspace --color always |