Merge pull request #3 from louloulin/master #10
This file contains hidden or 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: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| push: | |
| branches: | |
| - master | |
| env: | |
| RUSTFLAGS: -Dwarnings | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| rustfmt: | |
| name: rustfmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: sfackler/actions/rustup@master | |
| - uses: sfackler/actions/rustfmt@master | |
| clippy: | |
| name: clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: sfackler/actions/rustup@master | |
| - run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT | |
| id: rust-version | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cargo/registry/index | |
| key: index-${{ runner.os }}-${{ github.run_number }} | |
| restore-keys: | | |
| index-${{ runner.os }}- | |
| - run: cargo generate-lockfile | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cargo/registry/cache | |
| key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} | |
| - run: cargo fetch | |
| - uses: actions/cache@v3 | |
| with: | |
| path: target | |
| key: clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y | |
| - run: cargo clippy --all --all-targets | |
| check-wasm32: | |
| name: check-wasm32 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: sfackler/actions/rustup@master | |
| - run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT | |
| id: rust-version | |
| - run: rustup target add wasm32-unknown-unknown | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cargo/registry/index | |
| key: index-${{ runner.os }}-${{ github.run_number }} | |
| restore-keys: | | |
| index-${{ runner.os }}- | |
| - run: cargo generate-lockfile | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cargo/registry/cache | |
| key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} | |
| - run: cargo fetch | |
| - uses: actions/cache@v3 | |
| with: | |
| path: target | |
| key: check-wasm32-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} | |
| - run: cargo check --target wasm32-unknown-unknown --manifest-path tokio-gaussdb/Cargo.toml --no-default-features --features js | |
| env: | |
| RUSTFLAGS: --cfg getrandom_backend="wasm_js" | |
| test: | |
| name: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: docker compose up -d | |
| - name: Wait for OpenGauss to be ready | |
| run: | | |
| echo "Waiting for OpenGauss to start..." | |
| for i in {1..30}; do | |
| if docker exec opengauss-ci gsql -U gaussdb -d postgres -c "SELECT 1;" 2>/dev/null; then | |
| echo "OpenGauss is ready!" | |
| break | |
| fi | |
| echo "Waiting... ($i/30)" | |
| sleep 2 | |
| done | |
| - uses: sfackler/actions/rustup@master | |
| with: | |
| version: 1.81.0 | |
| - run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT | |
| id: rust-version | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cargo/registry/index | |
| key: index-${{ runner.os }}-${{ github.run_number }} | |
| restore-keys: | | |
| index-${{ runner.os }}- | |
| - run: cargo generate-lockfile | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cargo/registry/cache | |
| key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} | |
| - run: cargo fetch | |
| - uses: actions/cache@v3 | |
| with: | |
| path: target | |
| key: test-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y | |
| # - name: Run comprehensive tests | |
| # run: | | |
| # chmod +x scripts/ci-test.sh | |
| # bash scripts/ci-test.sh | |
| - name: Run feature tests | |
| run: | | |
| cargo test --manifest-path tokio-gaussdb/Cargo.toml --no-default-features --lib | |
| cargo test --manifest-path tokio-gaussdb/Cargo.toml --all-features --lib | |
| env: | |
| DATABASE_URL: "host=localhost port=5433 user=gaussdb password=Gaussdb@123 dbname=postgres" |