Skip to content

Commit

Permalink
Unify builds and add matrix build with LTS versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
codecop committed Jun 8, 2024
1 parent b7d80b9 commit f46ba22
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 136 deletions.
43 changes: 12 additions & 31 deletions .github/workflows/csharp-build.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,53 @@
# Workflow to build and test the csharp version
name: csharp-build

# Controls when the action will run.
on:
push:
paths:
- 'csharp/**'
- '**/csharp-build.yml'
- '.github/workflows/csharp-build.yml'
pull_request:
paths:
- 'csharp/**'
- '**/csharp-build.yml'

defaults:
run:
working-directory: ./csharp
- '.github/workflows/csharp-build.yml'

jobs:
build:

defaults:
run:
working-directory: ./csharp

runs-on: ubuntu-latest

env:
DB_USER: root
DB_OLD_PASSWORD: root
DB_PASSWORD: mysql

permissions:
id-token: write
contents: read
statuses: write
checks: write

steps:
- name: checkout source
uses: actions/checkout@v2
- name: Checkout Repository
uses: actions/checkout@v4

- name: Start MYSQL and import DB
run: |
sudo systemctl start mysql
mysqladmin --user=${{ env.DB_USER }} --password=${{ env.DB_OLD_PASSWORD }} password ${{ env.DB_PASSWORD }}
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ../database/initDatabase.sql
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/database/initDatabase.sql
- name: Setup dotnet build
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.1.x

- name: use nuget cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
restore-keys: ${{ runner.os }}-nuget

- name: install dependencies
run: dotnet restore

- name: build solution
run: dotnet build

- name: Test Reporter
uses: dorny/[email protected]
if: always()
with:
name: publish test results

path: "unit_test_results.xml"
reporter: dotnet-trx
fail-on-error: false
36 changes: 11 additions & 25 deletions .github/workflows/csharp-simple-build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
# Workflow to build and test the csharp version
name: csharp-simple-build

# Controls when the action will run.
on:
push:
paths:
- 'csharp-simple/**'
- '**/csharp-simple-build.yml'
- '.github/workflows/csharp-simple-build.yml'
pull_request:
paths:
- 'csharp-simple/**'
- '**/csharp-simple-build.yml'

defaults:
run:
working-directory: ./csharp-simple
- '.github/workflows/csharp-simple-build.yml'

jobs:
build:
defaults:
run:
working-directory: ./csharp-simple

runs-on: ubuntu-latest

Expand All @@ -27,27 +24,26 @@ jobs:
DB_PASSWORD: mysql

steps:
- name: checkout source
uses: actions/checkout@v2
- name: Checkout Repository
uses: actions/checkout@v4

- name: Start MYSQL and import DB
run: |
sudo systemctl start mysql
mysqladmin --user=${{ env.DB_USER }} --password=${{ env.DB_OLD_PASSWORD }} password ${{ env.DB_PASSWORD }}
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ../database/initDatabase.sql
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/database/initDatabase.sql
- name: Setup dotnet build
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.1.x

- name: use nuget cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
restore-keys: ${{ runner.os }}-nuget

- name: install dependencies
run: dotnet restore
Expand All @@ -57,13 +53,3 @@ jobs:

- name: run unit tests
run: dotnet test --logger "trx;logfilename=${GITHUB_WORKSPACE}/unit_test_results.xml"

- name: Test Reporter
uses: dorny/[email protected]
if: always()
with:
name: publish test results

path: "unit_test_results.xml"
reporter: dotnet-trx
fail-on-error: false
35 changes: 12 additions & 23 deletions .github/workflows/java-build.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
# Workflow to build and test the java version

name: java-build

env:
PROJECT_DIR: java

# Controls when the action will run.
on:
push:
paths:
- 'java/**'
- '**/java-build.yml'

- '.github/workflows/java-build.yml'
pull_request:
paths:
- 'java/**'
- '**/java-build.yml'
- '.github/workflows/java-build.yml'

jobs:
# This workflow contains a single job called "build"
build:
defaults:
run:
working-directory: ./${{ env.PROJECT_DIR }}
working-directory: ./java

# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
DB_USER: root
DB_OLD_PASSWORD: root
DB_PASSWORD: mysql

strategy:
matrix:
java-version: [8, 11, 17, 21]

steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Start MYSQL and import DB
run: |
Expand All @@ -43,24 +38,18 @@ jobs:
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/database/initDatabase.sql
- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: ${{ matrix.java-version }}

- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('./pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build and test
run: |
mvn -B clean install -DskipTests
- name: Publish Unit Tests
uses: EnricoMi/[email protected]
if: always()
with:
files: ./${{ env.PROJECT_DIR }}/target/**/*.xml
mvn -B clean verify -DskipTests
35 changes: 12 additions & 23 deletions .github/workflows/java-simple-build.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
# Workflow to build and test the java-simple version

name: java-simple-build

env:
PROJECT_DIR: java-simple

# Controls when the action will run.
on:
push:
paths:
- 'java-simple/**'
- '**/java-simple-build.yml'

- '.github/workflows/java-simple-build.yml'
pull_request:
paths:
- 'java-simple/**'
- '**/java-simple-build.yml'
- '.github/workflows/java-simple-build.yml'

jobs:
# This workflow contains a single job called "build"
build:
defaults:
run:
working-directory: ./${{ env.PROJECT_DIR }}
working-directory: ./java-simple

# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
DB_USER: root
DB_OLD_PASSWORD: root
DB_PASSWORD: mysql

strategy:
matrix:
java-version: [8, 11, 17, 21]

steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Start MYSQL and import DB
run: |
Expand All @@ -43,24 +38,18 @@ jobs:
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/database/initDatabase.sql
- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: ${{ matrix.java-version }}

- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('./pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build and test
run: |
mvn -B clean install
- name: Publish Unit Tests
uses: EnricoMi/[email protected]
if: always()
with:
files: ./${{ env.PROJECT_DIR }}/target/**/*.xml
mvn -B clean verify
17 changes: 9 additions & 8 deletions .github/workflows/javascript-build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: javascript-buld

env:
PROJECT_DIR: javascript

on:
push:
paths:
Expand All @@ -17,7 +14,7 @@ jobs:
build:
defaults:
run:
working-directory: ./${{ env.PROJECT_DIR }}
working-directory: ./javascript

runs-on: ubuntu-latest

Expand All @@ -26,9 +23,13 @@ jobs:
DB_OLD_PASSWORD: root
DB_PASSWORD: mysql

strategy:
matrix:
node-version: [10, 12, 14, 16, 18]

steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Start MYSQL and import DB
run: |
Expand All @@ -37,9 +38,9 @@ jobs:
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/database/initDatabase.sql
- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 15.x
node-version: ${{ matrix.node-version }}

- name: Set up dependencies
run: npm install
run: npm install --force
Loading

0 comments on commit f46ba22

Please sign in to comment.