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 67c1e52
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 42 deletions.
35 changes: 9 additions & 26 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,33 +212,16 @@ 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:
submodules: true
- name: Setup .NET SDK ${{ env.DotnetVersion }}
- name: Setup .NET SDK ${{ env.DotNetVersionForMauiGtk }}
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
dotnet-version: ${{ env.DotNetVersionForMauiGtk }}
- name: Install gtk workload & add Maui Nuget source
run: ./scripts/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,18 +623,15 @@ 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
run: ./scripts/install_snapcraft.sh maui

- name: Setup .NET SDK ${{ env.DotnetVersion }}
- name: Setup .NET SDK ${{ env.DotNetVersionForMauiGtk }}
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: ${{ env.DotnetVersion }}
dotnet-version: ${{ env.DotNetVersionForMauiGtk }}

- name: Bump snap version
run: |
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 67c1e52

Please sign in to comment.