Skip to content

Commit 7616119

Browse files
authored
Merge pull request #80 from dotnetprojects/gh-actions
work on github actions
2 parents 94db2b5 + 2a9f932 commit 7616119

29 files changed

+598
-527
lines changed

.github/workflows/dotnet.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: .NET
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Fetch history
17+
run: git fetch --prune --unshallow
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: |
22+
9.0.x
23+
- name: Restore dependencies
24+
run: |
25+
dotnet restore Migrator.slnx
26+
27+
- name: Build
28+
run: |
29+
dotnet build -c Release Migrator.slnx

.github/workflows/dotnetpull.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: .NET Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
12+
services:
13+
sqlserver:
14+
image: mcr.microsoft.com/mssql/server:2019-latest
15+
ports:
16+
- 1433:1433
17+
env:
18+
SA_PASSWORD: YourStrong@Passw0rd
19+
ACCEPT_EULA: Y
20+
options: >-
21+
--health-cmd "bash -c '</dev/tcp/localhost/1433' && exit 0 || exit 1"
22+
--health-interval=10s
23+
--health-timeout=5s
24+
--health-retries=10
25+
26+
postgres:
27+
image: postgres:13
28+
ports:
29+
- 5432:5432
30+
env:
31+
POSTGRES_USER: testuser
32+
POSTGRES_PASSWORD: testpass
33+
POSTGRES_DB: testdb
34+
options: >-
35+
--health-cmd="pg_isready -U testuser"
36+
--health-interval=10s
37+
--health-timeout=5s
38+
--health-retries=5
39+
40+
# oracle:
41+
# image: gvenzl/oracle-xe:21.3.0-slim
42+
# ports:
43+
# - 1521:1521
44+
# env:
45+
# ORACLE_PASSWORD: testpass
46+
# options: >-
47+
# --health-cmd "echo 'exit' | sqlplus -L system/oracle@localhost/XEPDB1"
48+
# --health-interval=25s
49+
# --health-timeout=20s
50+
# --health-retries=20
51+
52+
mysql:
53+
image: mysql:8.0
54+
ports:
55+
- 3306:3306
56+
env:
57+
MYSQL_ROOT_PASSWORD: rootpass
58+
MYSQL_DATABASE: testdb
59+
MYSQL_USER: testuser
60+
MYSQL_PASSWORD: testpass
61+
options: >-
62+
--health-cmd="mysqladmin ping -h localhost -u root -prootpass"
63+
--health-interval=10s
64+
--health-timeout=5s
65+
--health-retries=10
66+
67+
steps:
68+
- uses: actions/checkout@v4
69+
- name: Setup .NET
70+
uses: actions/setup-dotnet@v4
71+
with:
72+
dotnet-version: |
73+
9.0.x
74+
- name: Install SQLCMD tools
75+
run: |
76+
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
77+
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
78+
sudo apt-get update
79+
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev
80+
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
81+
source ~/.bashrc
82+
# - name: Download and install Oracle SQLcl
83+
# run: |
84+
# curl -L -o sqlcl.zip https://download.oracle.com/otn_software/java/sqldeveloper/sqlcl-latest.zip
85+
# unzip sqlcl.zip -d sqlcl
86+
# echo "$PWD/sqlcl/sqlcl/bin" >> $GITHUB_PATH
87+
# - name: Run SQL script with Oracle SQLcl
88+
# run: |
89+
# echo "create user test identified by test;" > setup.sql
90+
# echo "grant connect, resource to test;" >> setup.sql
91+
# sql /nolog <<EOF
92+
# connect system/testpass@//localhost:1521/XEPDB1
93+
# @setup.sql
94+
# exit
95+
# EOF
96+
- name: Create SQLServer database
97+
run: |
98+
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd' -Q "CREATE DATABASE [Whatever];"
99+
- name: Restore dependencies
100+
run: |
101+
dotnet restore Migrator.slnx
102+
- name: Build
103+
run: |
104+
dotnet build Migrator.slnx
105+
- name: Test
106+
run: |
107+
dotnet test Migrator.slnx

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: .NET
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
permissions: write-all
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Fetch history
15+
run: git fetch --prune --unshallow
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: |
20+
9.0.x
21+
- name: Restore dependencies
22+
run: |
23+
dotnet restore Migrator.slnx
24+
25+
- name: Update project version
26+
uses: roryprimrose/set-vs-sdk-project-version@v1
27+
with:
28+
version: ${{ github.event.release.tag_name }}
29+
assemblyVersion: ${{ github.event.release.tag_name }}
30+
fileVersion: ${{ github.event.release.tag_name }}
31+
informationalVersion: ${{ github.event.release.tag_name }}-${{ github.sha }}
32+
33+
- name: Build
34+
run: |
35+
dotnet build -c Release Migrator.slnx

Migrator.slnx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Solution>
2+
<Folder Name="/Core/">
3+
<Project Path="src/Migrator/DotNetProjects.Migrator.csproj" />
4+
</Folder>
5+
<Folder Name="/Extras/">
6+
<File Path="doc/README.txt" />
7+
<File Path="doc/TODO.txt" />
8+
<File Path="src/MigratorDotNet.snk" />
9+
</Folder>
10+
<Folder Name="/Extras/.github/" />
11+
<Folder Name="/Extras/.github/workflows/">
12+
<File Path=".github/workflows/dotnet.yml" />
13+
<File Path=".github/workflows/dotnetpull.yml" />
14+
<File Path=".github/workflows/release.yml" />
15+
</Folder>
16+
<Folder Name="/Solution Items/">
17+
<File Path=".editorconfig" />
18+
</Folder>
19+
<Folder Name="/Tests/">
20+
<Project Path="src/Migrator.Tests/Migrator.Tests.csproj" />
21+
</Folder>
22+
</Solution>

0 commit comments

Comments
 (0)