Skip to content

Commit

Permalink
CI,scripts: refactoring of Maui/Gtk builds
Browse files Browse the repository at this point in the history
Extracted installation of gtk workload and adding Maui nuget
source to separate script to remove code duplication.

Renamed DotNetVersion to DotNetVersionForMauiGtk and made it
and GtkSharpVersion workflow-level env vars in CI.yml.
  • Loading branch information
webwarrior-ws committed May 29, 2024
1 parent bd5d320 commit 176bbe2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 38 deletions.
27 changes: 5 additions & 22 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
schedule:
- cron: "0 0 * * *"

env:
GtkSharpVersion: 3.24.24.95
DotNetVersionForMauiGtk: 6.0.400

# FIXME: figure out why we need to clean after make if we
# want 'make strict' target to really happen without
Expand Down Expand Up @@ -209,9 +212,6 @@ jobs:
linux-github--dotnet-and-mono:
runs-on: ubuntu-22.04
env:
GtkSharpVersion: 3.24.24.95
DotnetVersion: 6.0.400
steps:
- uses: actions/checkout@v1
with:
Expand All @@ -220,22 +220,8 @@ jobs:
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: ${{ env.DotnetVersion }}
- name: Install gtk workload
run: |
wget -O gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg https://globalcdn.nuget.org/packages/gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.$GtkSharpVersion.nupkg
DOTNET_DIR=/home/runner/.dotnet
WORKLOAD_MANIFEST_DIR=$DOTNET_DIR/sdk-manifests/${{ env.DotnetVersion }}/gtksharp.net.sdk.gtk
mkdir -p $WORKLOAD_MANIFEST_DIR/
unzip -j gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg "data/*" -d $WORKLOAD_MANIFEST_DIR/
rm gtksharp.net.sdk.gtk.manifest-${{ env.DotnetVersion }}.nupkg
# otherwise we get System.UnauthorizedAccessException: Access to the path '/home/runner/.dotnet/sdk-manifests/6.0.300/gtksharp.net.sdk.gtk/WorkloadManifest.json' is denied.
chmod 764 $WORKLOAD_MANIFEST_DIR/*
dotnet workload search
dotnet workload install gtk --skip-manifest-update
- name: Add Maui Nuget source
run: |
cd dependencies/maui
dotnet nuget add source --name nuget https://api.nuget.org/v3/index.json
- name: Install gtk workload & add Maui Nuget source
run: ./prepare_maui_gtk.sh
- name: install missing dependencies
run: sudo apt install --yes fsharp nunit-console
- name: check mono version
Expand Down Expand Up @@ -637,9 +623,6 @@ jobs:
- conventions

runs-on: ubuntu-22.04
env:
GtkSharpVersion: 3.24.24.95
DotnetVersion: 6.0.400
steps:
- uses: actions/checkout@v1
- name: Install snap tools
Expand Down
19 changes: 19 additions & 0 deletions scripts/prepare_maui_gtk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euxo pipefail

# Install gtk workload
wget -O gtksharp.net.sdk.gtk.manifest-$DotNetVersionForMauiGtk.nupkg https://globalcdn.nuget.org/packages/gtksharp.net.sdk.gtk.manifest-$DotNetVersionForMauiGtk.$GtkSharpVersion.nupkg
DOTNET_DIR=~/.dotnet
WORKLOAD_MANIFEST_DIR=$DOTNET_DIR/sdk-manifests/$DotNetVersionForMauiGtk/gtksharp.net.sdk.gtk
mkdir -p $WORKLOAD_MANIFEST_DIR/
unzip -j gtksharp.net.sdk.gtk.manifest-$DotNetVersionForMauiGtk.nupkg "data/*" -d $WORKLOAD_MANIFEST_DIR/
rm gtksharp.net.sdk.gtk.manifest-$DotNetVersionForMauiGtk.nupkg
# otherwise we get System.UnauthorizedAccessException: Access to the path '/home/runner/.dotnet/sdk-manifests/6.0.300/gtksharp.net.sdk.gtk/WorkloadManifest.json' is denied.
chmod 764 $WORKLOAD_MANIFEST_DIR/*
dotnet workload search
dotnet workload install gtk --skip-manifest-update

#Add Maui Nuget source
cd dependencies/maui
dotnet nuget add source --name nuget https://api.nuget.org/v3/index.json
cd ../..
18 changes: 2 additions & 16 deletions scripts/snap_build_maui.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
#!/usr/bin/env bash
set -euxo pipefail

# Install gtk workload
wget -O gtksharp.net.sdk.gtk.manifest-$DotnetVersion.nupkg https://globalcdn.nuget.org/packages/gtksharp.net.sdk.gtk.manifest-$DotnetVersion.$GtkSharpVersion.nupkg
DOTNET_DIR=~/.dotnet
WORKLOAD_MANIFEST_DIR=$DOTNET_DIR/sdk-manifests/$DotnetVersion/gtksharp.net.sdk.gtk
mkdir -p $WORKLOAD_MANIFEST_DIR/
unzip -j gtksharp.net.sdk.gtk.manifest-$DotnetVersion.nupkg "data/*" -d $WORKLOAD_MANIFEST_DIR/
rm gtksharp.net.sdk.gtk.manifest-$DotnetVersion.nupkg
# otherwise we get System.UnauthorizedAccessException: Access to the path '/home/runner/.dotnet/sdk-manifests/6.0.300/gtksharp.net.sdk.gtk/WorkloadManifest.json' is denied.
chmod 764 $WORKLOAD_MANIFEST_DIR/*
dotnet workload search
dotnet workload install gtk --skip-manifest-update

#Add Maui Nuget source
cd dependencies/maui
dotnet nuget add source --name nuget https://api.nuget.org/v3/index.json
cd ../..
# Install gtk workload and add Maui nuget source
./prepare_maui_gtk.sh

# Build GWallet MAUI Gtk project
./configure.sh
Expand Down

0 comments on commit 176bbe2

Please sign in to comment.