|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - "v*.*.*" |
| 6 | + branches: |
| 7 | + - main |
| 8 | + pull_request: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v3 |
| 20 | + with: |
| 21 | + submodules: true |
| 22 | + - uses: actions/cache@v3 |
| 23 | + with: |
| 24 | + path: | |
| 25 | + ~/.cargo/bin/ |
| 26 | + ~/.cargo/registry/index/ |
| 27 | + ~/.cargo/registry/cache/ |
| 28 | + ~/.cargo/git/db/ |
| 29 | + target/ |
| 30 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 31 | + |
| 32 | + - name: Setup Rust |
| 33 | + uses: actions-rs/toolchain@v1 |
| 34 | + with: |
| 35 | + toolchain: stable |
| 36 | + override: true |
| 37 | + - name: Check formatting |
| 38 | + run: cargo fmt -- --check |
| 39 | + - name: Clippy |
| 40 | + run: cargo clippy -- -Dwarnings |
| 41 | + - name: Tests |
| 42 | + run: cargo test |
| 43 | + - uses: cargo-bins/cargo-binstall@main |
| 44 | + - name: Validate WIT |
| 45 | + run: | |
| 46 | + cargo binstall --no-confirm wasm-tools@1.210.0 |
| 47 | + wasm-tools component wit -vv wit |
| 48 | + publish: |
| 49 | + needs: [build] |
| 50 | + if: "startsWith(github.ref, 'refs/tags/v')" |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - name: Checkout |
| 54 | + uses: actions/checkout@v3 |
| 55 | + with: |
| 56 | + submodules: true |
| 57 | + - uses: actions/cache@v3 |
| 58 | + with: |
| 59 | + path: | |
| 60 | + ~/.cargo/bin/ |
| 61 | + ~/.cargo/registry/index/ |
| 62 | + ~/.cargo/registry/cache/ |
| 63 | + ~/.cargo/git/db/ |
| 64 | + target/ |
| 65 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 66 | + |
| 67 | + - name: Setup Rust |
| 68 | + uses: actions-rs/toolchain@v1 |
| 69 | + with: |
| 70 | + toolchain: stable |
| 71 | + - id: get_version |
| 72 | + uses: battila7/get-version-action@v2 |
| 73 | + - name: Publish crate |
| 74 | + env: |
| 75 | + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
| 76 | + run: | |
| 77 | + export VERSION="${{ steps.get_version.outputs.version-without-v }}" |
| 78 | + sed -i "s/0.0.0/$VERSION/g" Cargo.toml |
| 79 | + cargo publish -p wasi-rdbms --all-features --allow-dirty |
0 commit comments