Skip to content

Commit

Permalink
Always use Ubuntu as runner image (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
masesdevelopers authored Sep 23, 2024
1 parent 3b3370b commit e83600b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 123 deletions.
75 changes: 5 additions & 70 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,20 @@ jobs:
needs: check_changes
if: "always() && needs.check_changes.outputs.run_build_windows == 'true'"
# The type of runner that the job will run on
runs-on: windows-2022
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
# Support longpaths
- name: Support long paths
run: git config --system core.longpaths true


# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: '1'
submodules: 'true'

- name: Pre compile
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\Netdroid\Netdroid.csproj
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/Netdroid/Netdroid.csproj
env:
GITHUB_SIMPLIFIED_GENERATION: true

Expand Down Expand Up @@ -276,73 +273,11 @@ jobs:
nuget-version: '5.x'

- name: Recompile to create nuget packages
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\Netdroid.sln
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/Netdroid.sln
env:
GITHUB_TEST_PREPARATION: true

- uses: actions/upload-artifact@v4
with:
name: Netdroid
path: .\bin\*nupkg

# - name: Save Netdroid bin in cache
# uses: actions/cache/save@v4
# with:
# enableCrossOsArchive: true
# path: ./bin/
# key: JNet_bin_${{ github.sha }}
#
# execute_tests:
# needs: build_windows
# strategy:
# fail-fast: false
# matrix:
# os: [ 'ubuntu-latest', 'windows-latest' ]
# framework: [ 'net462', 'net6.0', 'net8.0' ]
# jdk_vendor: [ 'temurin', 'zulu', 'microsoft', 'corretto', 'oracle']
# jdk_version: [ '11', '17', '21' ] # only LTS versions
# exclude:
# - os: ubuntu-latest
# framework: net462
# - jdk_vendor: oracle
# jdk_version: 11
#
# runs-on: ${{ matrix.os }}
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v4
# with:
# fetch-depth: '1'
#
# - name: Restore JNet bin from cache
# uses: actions/cache/restore@v4
# with:
# fail-on-cache-miss: true
# enableCrossOsArchive: true
# path: ./bin/
# key: JNet_bin_${{ github.sha }}
#
# - name: Set up JDK distribution
# uses: actions/setup-java@v4
# with: # running setup-java again overwrites the settings.xml
# distribution: ${{ matrix.jdk_vendor }}
# java-version: ${{ matrix.jdk_version }}
# cache: 'maven'
#
# - name: Executing JNetTest on Ubuntu with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
# if: matrix.os == 'ubuntu-latest'
# run: dotnet ./bin/${{ matrix.framework }}/JNetTest.dll
# env:
# JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}
#
# - name: Executing JNetTest on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
# if: ${{ matrix.os == 'windows-latest' && matrix.framework != 'net462' }}
# run: dotnet .\bin\${{ matrix.framework }}\JNetTest.dll
# env:
# JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}
#
# - name: Executing JNetTest on Windows with ${{ matrix.jdk_vendor }} ${{ matrix.jdk_version }}
# if: ${{ matrix.os == 'windows-latest' && matrix.framework == 'net462' }}
# run: .\bin\${{ matrix.framework }}\JNetTest.exe
# env:
# JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}
path: ./bin/*nupkg
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
needs: check_changes
if: "always() && needs.check_changes.outputs.run_build_windows == 'true'"
name: Analyze
runs-on: windows-2022
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,27 @@ on:
jobs:
build_documentation:
# The type of runner that the job will run on
runs-on: windows-2022
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
# Support longpaths
- name: Support long paths
run: git config --system core.longpaths true


# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: '1'
submodules: 'true'

- name: Clear documentation folder
run: Remove-Item .\docs\* -Recurse -Force -Exclude _config.yml,CNAME
- name: Clear documentation folder
shell: pwsh
run: Remove-Item ./docs/* -Recurse -Force -Exclude _config.yml,CNAME

- run: dotnet tool update -g docfx

- name: Build documentation
run: |
cd src\documentation
cd src/documentation
docfx
- name: Extract commit SHA
Expand Down
42 changes: 19 additions & 23 deletions .github/workflows/generateclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
required: true
default: false
type: boolean
ContinueOnLatestJNetReflectorError:
ContinueOnCompilationError:
description: 'Shall continue execution in case of failure of build from latest unpublished version of JNetReflector'
required: true
default: false
Expand All @@ -27,18 +27,10 @@ on:
jobs:
build_classes:
# The type of runner that the job will run on
runs-on: windows-2022
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- run: set
shell: cmd

# Runs a set of commands using the runners shell
# Support longpaths
- name: Support long paths
run: git config --system core.longpaths true

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -76,14 +68,16 @@ jobs:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Clear C# generated files
run: Remove-Item .\src\net\Netdroid\Generated\* -Recurse -Force -Exclude README.md
shell: pwsh
run: Remove-Item ./src/net/Netdroid/Generated\* -Recurse -Force -Exclude README.md

- name: Clear Java generated files
run: Remove-Item .\src\jvm\netdroid\src\main\java\org\mases\netdroid\generated\* -Recurse -Force -Exclude README.md
shell: pwsh
run: Remove-Item ./src/jvm/netdroid/src/main/java/org/mases/netdroid/generated/* -Recurse -Force -Exclude README.md

- name: Prebuild JNetReflector
if: ${{ inputs.UseLatestJNetReflector == true }}
run: dotnet build --no-incremental --configuration Release JNet\src\net\JNetReflector\JNetReflector.csproj
run: dotnet build --no-incremental --configuration Release JNet/src/net/JNetReflector/JNetReflector.csproj

- name: Create Jars of JNetReflector
if: ${{ inputs.UseLatestJNetReflector == true }}
Expand Down Expand Up @@ -111,29 +105,31 @@ jobs:

- name: Build classes with unpublished JNetReflector
if: ${{ inputs.UseLatestJNetReflector == true }}
shell: cmd
run: |
cd JNet\binReflector\net8.0
MASES.JNetReflector.exe -TraceLevel 0 -OriginRootPath %ANDROID_HOME%\platforms\android-35 -DestinationRootPath %GITHUB_WORKSPACE%\src\ -ConfigurationFile %GITHUB_WORKSPACE%\src\configuration.json
cd JNet/binReflector/net8.0
dotnet MASES.JNetReflector -TraceLevel 0 -OriginRootPath $ANDROID_HOME/platforms/android-35 -DestinationRootPath $GITHUB_WORKSPACE/src/ -ConfigurationFile $GITHUB_WORKSPACE/src/configuration.json
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

- name: Build classes with latest published version of JNetReflector
if: ${{ inputs.UseLatestJNetReflector == false }}
shell: cmd
run: jnetreflector -TraceLevel 0 -OriginRootPath %ANDROID_HOME%\platforms\android-35 -DestinationRootPath %GITHUB_WORKSPACE%\src\ -ConfigurationFile %GITHUB_WORKSPACE%\src\configuration.json
run: jnetreflector -TraceLevel 0 -OriginRootPath $ANDROID_HOME/platforms/android-35 -DestinationRootPath $GITHUB_WORKSPACE/src/ -ConfigurationFile $GITHUB_WORKSPACE/src/configuration.json
env:
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ONLINE }}

- name: Pre compile
continue-on-error: ${{ inputs.ContinueOnCompilationError == true }}
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/Netdroid/Netdroid.csproj
env:
GITHUB_SIMPLIFIED_GENERATION: true

- name: Try compilation of Jars
continue-on-error: ${{ inputs.ContinueOnLatestJNetReflectorError == true }}
if: ${{ inputs.UseLatestJNetReflector == true }}
continue-on-error: ${{ inputs.ContinueOnCompilationError == true }}
run: mvn --file ./src/jvm/netdroid/pom.xml --no-transfer-progress package

- name: Try compilation of C#
continue-on-error: ${{ inputs.ContinueOnLatestJNetReflectorError == true }}
if: ${{ inputs.UseLatestJNetReflector == true }}
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\Netdroid.sln
continue-on-error: ${{ inputs.ContinueOnCompilationError == true }}
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/Netdroid.sln

- name: Request a PR to commit changes made with unpublished version of JNetReflector
if: ${{ github.repository_owner == 'masesgroup' && inputs.GeneratePR == true && inputs.UseLatestJNetReflector == true }} #do not push any changes outside main repo or GeneratePR is false
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,19 @@ jobs:
needs: check_changes
if: "always() && needs.check_changes.outputs.run_build_windows == 'true'"
# The type of runner that the job will run on
runs-on: windows-2022
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
# Support longpaths
- name: Support long paths
run: git config --system core.longpaths true


# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: '1'
submodules: 'true'

# - name: Pre compile tests and templates
# run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" tests\net\JNetTest.sln

- name: Pre compile
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\Netdroid\Netdroid.csproj
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/Netdroid/Netdroid.csproj
env:
GITHUB_SIMPLIFIED_GENERATION: true

Expand Down Expand Up @@ -149,4 +143,4 @@ jobs:
nuget-version: '5.x'

- name: Recompile to create nuget packages
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\Netdroid.sln
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/Netdroid.sln
19 changes: 8 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@ jobs:
# This workflow contains a single job called "build_release"
build_release:
# The type of runner that the job will run on
runs-on: windows-2022
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
# Support longpaths
- name: Support long paths
run: git config --system core.longpaths true


# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: '1'
submodules: 'true'

- name: Pre compile
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\Netdroid\Netdroid.csproj
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/Netdroid/Netdroid.csproj
env:
GITHUB_SIMPLIFIED_GENERATION: true

Expand Down Expand Up @@ -57,17 +54,17 @@ jobs:
nuget-version: '5.x'

- name: Recompile to create nuget packages
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\Netdroid.sln
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src/net/Netdroid.sln

- name: Authnticate to GitHub
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"

- name: Publish to GitHub
run: |
nuget push .\bin\*.nupkg -ApiKey ${{ secrets.GITHUB_TOKEN }} -Source "github" -SkipDuplicate
nuget push .\bin\*.snupkg -ApiKey ${{ secrets.GITHUB_TOKEN }} -Source "github" -SkipDuplicate
nuget push ./bin/*.nupkg -ApiKey ${{ secrets.GITHUB_TOKEN }} -Source "github" -SkipDuplicate
nuget push ./bin/*.snupkg -ApiKey ${{ secrets.GITHUB_TOKEN }} -Source "github" -SkipDuplicate
- name: Publish to NuGet
run: |
nuget push .\bin\*.nupkg -ApiKey ${{ secrets.MASES_NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json -SkipDuplicate
nuget push .\bin\*.snupkg -ApiKey ${{ secrets.MASES_NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json -SkipDuplicate
nuget push ./bin/*.nupkg -ApiKey ${{ secrets.MASES_NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json -SkipDuplicate
nuget push ./bin/*.snupkg -ApiKey ${{ secrets.MASES_NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json -SkipDuplicate

0 comments on commit e83600b

Please sign in to comment.