Skip to content

work on github actions #11

work on github actions

work on github actions #11

Workflow file for this run

name: .NET Pull Request
on:
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
ports:
- 1433:1433
env:
SA_PASSWORD: YourStrong@Passw0rd
ACCEPT_EULA: Y
options: >-
--health-cmd "bash -c '</dev/tcp/localhost/1433' && exit 0 || exit 1"
--health-interval=10s
--health-timeout=5s
--health-retries=10
postgres:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: testdb
options: >-
--health-cmd="pg_isready -U testuser"
--health-interval=10s
--health-timeout=5s
--health-retries=5
oracle:
image: gvenzl/oracle-xe:21.3.0-slim
ports:
- 1521:1521
env:
ORACLE_PASSWORD: oracle
options: >-
--health-cmd "echo 'exit' | sqlplus -L system/oracle@localhost/XEPDB1"
--health-interval=15s
--health-timeout=10s
--health-retries=10
mysql:
image: mysql:8.0
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: testdb
MYSQL_USER: testuser
MYSQL_PASSWORD: testpass
options: >-
--health-cmd="mysqladmin ping -h localhost -u root -prootpass"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
- name: Install SQLCMD tools
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
- name: Install PostgreSQL client tools
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Install Oracle client
run: |
sudo apt-get update
sudo apt-get install -y libaio1 alien
wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linux.x64-21.13.0.0.0dbru.zip
wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linux.x64-21.13.0.0.0dbru.zip
unzip instantclient-*.zip
sudo mkdir -p /opt/oracle
sudo mv instantclient_* /opt/oracle/instantclient
export LD_LIBRARY_PATH=/opt/oracle/instantclient
export PATH=$PATH:/opt/oracle/instantclient
- name: Create Oracle schema
run: |
echo "CREATE USER test IDENTIFIED BY test DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON users;" |
sqlplus -L system/oracle@//localhost:1521/XEPDB1
echo "GRANT CONNECT, RESOURCE TO test;" |
sqlplus -L system/oracle@//localhost:1521/XEPDB1
- name: Install MySQL client
run: sudo apt-get update && sudo apt-get install -y mysql-client
- name: Create SQLServer database
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd' -Q "CREATE DATABASE [Whatever];"
- name: Restore dependencies
run: |
dotnet restore Migrator.slnx
- name: Build
run: |
dotnet build Migrator.slnx
- name: Test
run: |
dotnet test Migrator.slnx