feat: Implement Driver method and ExecWrite for enhanced query execution #83
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: UnitTest | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| unit-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| go: [1.18.2] | |
| db: [MySQL8.0, MySQL5.7, MySQL5.6, Postgres9.6, Postgres14.0, SQLite3] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Setup ${{ matrix.db }} | |
| uses: ./.github/actions/setup-db | |
| with: | |
| kind: "${{ matrix.db }}" | |
| db: "xun" | |
| user: "xun" | |
| password: "123456" | |
| - name: Setup Go ${{ matrix.go }} | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: Setup Go Tools | |
| run: | | |
| make tools | |
| - name: Setup ENV | |
| run: | | |
| echo "XUN_UNIT_NAME=$DB_NAME" >> $GITHUB_ENV | |
| echo "XUN_UNIT_DRIVER=$DB_DRIVER" >> $GITHUB_ENV | |
| echo "XUN_UNIT_LOG=$HOME/${{ matrix.db }}-${{ matrix.go }}.log" >> $GITHUB_ENV | |
| echo $PATH | |
| - name: Run Test | |
| env: | |
| PASSWORD: "123456" | |
| # POSTGRES_DSN: ${{ secrets.UNIT_POSTGRES_DSN }} | |
| run: | | |
| make vet | |
| make fmt-check | |
| make misspell-check | |
| if [ "$DB_DRIVER" = "mysql" ]; then | |
| XUN_UNIT_SOURCE="$DB_USER:$PASSWORD@$DB_HOST" make test | |
| elif [ "$DB_DRIVER" = "postgres" ]; then | |
| XUN_UNIT_SOURCE="postgres://$DB_USER:$PASSWORD@$DB_HOST" make test | |
| else | |
| XUN_UNIT_SOURCE="$DB_HOST" make test | |
| fi | |
| - name: Codecov Report | |
| uses: codecov/codecov-action@v2 |