ci: Refactor - Use working-directory
#75
Workflow file for this run
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: Build & Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build & Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [ '1.21.6' ] | |
services: | |
postgres: | |
image: postgres:9.6 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: ssetest | |
mysql: | |
image: mysql:8.3 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_ROOT_PASSWORD: omgroot | |
MYSQL_DATABASE: ssetest | |
MYSQL_USER: ssetestusr | |
MYSQL_PASSWORD: ssetestusrpass | |
mssql: | |
image: mcr.microsoft.com/mssql/server:2017-latest | |
env: | |
SA_PASSWORD: GithubIs2broken | |
ACCEPT_EULA: Y | |
ports: | |
- 1433:1433 | |
# options: --health-cmd="SELECT 1;" --health-interval=10s --health-timeout=5s --health-retries=10 | |
steps: | |
- name: Add mssql source | |
run: | | |
curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list | |
sudo apt-get update | |
- name: Apt packages | |
run: sudo apt-get install sqlite3 postgresql-client gcc-mingw-w64-x86-64 mysql-client mssql-tools18 unixodbc-dev | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: install go-junit-report | |
run: go install github.com/jstemmer/go-junit-report/v2@latest | |
- name: Install dependencies | |
run: go get . | |
- name: Setup - sqlite | |
working-directory: sqlite | |
run: ./setup.sh | |
- name: Test - sqlite flags | |
run: | | |
go clean -testcache | |
go test -v sse_test.go \ | |
--driver=sqlite \ | |
--display-name=testing-flags \ | |
--live=true \ | |
--listen-on-port=9999 \ | |
--sqlite-file="`pwd`/sqlite/db/test.db" \ | |
2>&1 | go-junit-report -iocopy -set-exit-code -out results-sqlite-flags-${{ matrix.go-version }}.xml | |
- name: Setup - sqlite (2) | |
working-directory: sqlite | |
run: ./setup.sh | |
- name: Test - sqlite env | |
env: | |
schemaexplorer_driver: sqlite | |
schemaexplorer_live: false | |
run: | | |
export schemaexplorer_sqlite_file="`pwd`/sqlite/db/test.db" | |
go clean -testcache | |
go test -v sse_test.go \ | |
2>&1 | go-junit-report -iocopy -set-exit-code -out results-sqlite-env-${{ matrix.go-version }}.xml | |
- name: Setup - pg | |
working-directory: pg | |
run: ./setup-ssetest.sh | |
- name: Test - pg | |
env: | |
schemaexplorer_driver: pg | |
schemaexplorer_pg_connection_string: "postgres://ssetestusr:ssetestusr@localhost/ssetest?sslmode=disable" | |
run: | | |
go clean -testcache | |
go test -v sse_test.go \ | |
2>&1 | go-junit-report -iocopy -set-exit-code -out results-pg-${{ matrix.go-version }}.xml | |
- name: Setup - mysql | |
working-directory: mysql | |
run: mysql -h 127.0.0.1 -u root -pomgroot ssetest < test-db.sql | |
- name: Test - mysql | |
env: | |
schemaexplorer_driver: mysql | |
schemaexplorer_live: false | |
schemaexplorer_mysql_connection_string: "ssetestusr:ssetestusrpass@tcp(localhost:3306)/ssetest" | |
run: | | |
go clean -testcache | |
go test -v sse_test.go \ | |
2>&1 | go-junit-report -iocopy -set-exit-code -out results-mysql-${{ matrix.go-version }}.xml | |
- name: Setup - MSSQL | |
working-directory: mssql | |
run: | | |
/opt/mssql-tools18/bin/sqlcmd -C -S localhost -W -U sa -P GithubIs2broken -d "master" -Q "create database ssetest;" | |
/opt/mssql-tools18/bin/sqlcmd -C -S localhost -W -U sa -P GithubIs2broken -d "ssetest" -i test-db.sql | |
/opt/mssql-tools18/bin/sqlcmd -C -S localhost -W -U sa -P GithubIs2broken -d "ssetest" -i test-db-ms_descriptions.sql | |
- name: Test - MSSQL | |
env: | |
schemaexplorer_driver: mssql | |
schemaexplorer_mssql_connection_string: "server=localhost;user id=sa;password=GithubIs2broken;database=ssetest" | |
run: | | |
go clean -testcache | |
go test -v sse_test.go \ | |
2>&1 | go-junit-report -iocopy -set-exit-code -out results-MSSQL-${{ matrix.go-version }}.xml | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Test Report # Name of the check run which will be created | |
path: results-*.xml # Path to test results | |
reporter: java-junit # Format of test results |