+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/actions/create/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Create Gir.Core"
description: "Creates Gir.Core from scratch"

inputs:
configuration:
description: "Build configuration to use (e.g. Release)"
required: true
source_directory:
description: "Directory containing the source code (e.g. ./src)"
required: true
shell:
description: "Shell to use"
required: true

runs:
using: "composite"
steps:
- name: Prepare .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x

- name: Compile native library
run: dotnet fsi GenerateGirTestLib.fsx
working-directory: ${{ inputs.source_directory }}
shell: ${{ inputs.shell }}

- name: Call generator
run: dotnet fsi GenerateLibs.fsx GirTest-0.1.gir
working-directory: ${{ inputs.source_directory }}
shell: ${{ inputs.shell }}

- name: Build complete solution
run: dotnet build --nologo -c ${{ inputs.configuration }}
working-directory: ${{ inputs.source_directory }}
shell: ${{ inputs.shell }}

- name: Build libraries only
run: dotnet build --nologo -c ${{ inputs.configuration }} GirCore.Libs.slnf
working-directory: ${{ inputs.source_directory }}
shell: ${{ inputs.shell }}

- name: Run unit tests
run: dotnet test --no-restore -c ${{ inputs.configuration }} --filter "TestCategory=UnitTest | TestCategory=BindingTest"
working-directory: ${{ inputs.source_directory }}
shell: ${{ inputs.shell }}
150 changes: 79 additions & 71 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: 'Continuous integration'
on:
workflow_dispatch:
inputs:
publish:
publish_release:
description: If this build should publish nuget packages
required: true
type: boolean
preview:
description: If this is a preview package
version_suffix:
description: Suffix of the version number. Can be used to create a preview package.
required: true
type: boolean
type: string
push:
branches:
- main
Expand All @@ -20,45 +20,50 @@ on:

env:
configuration: Release
publish_release: ${{ github.event.inputs.publish_release }}
version_suffix: ${{ github.event.inputs.version_suffix }}

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
include:
- os: windows-latest
shell: msys2 {0}
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash
build_macos:
name: Build (MacOS)
runs-on: macos-latest
if: github.event.inputs.publish_release != 'true'

defaults:
run:
shell: ${{ matrix.shell }}
shell: bash

steps:
- name: Install dependencies
run: brew install cairo gdk-pixbuf gobject-introspection meson

- name: Prepare git
run: git config --global core.autocrlf false
shell: bash

- name: Checkout with submodules
uses: actions/checkout@v3
with:
submodules: 'true'

- name: Prepare .NET
uses: actions/setup-dotnet@v3
- name: Create Gir.Core
uses: ./.github/actions/create
with:
dotnet-version: |
6.0.x
7.0.x

- name: Install dependencies (Windows)
if: ${{ matrix.os == 'windows-latest' }}
configuration: ${{ env.configuration }}
source_directory: './src'
shell: bash

build_windows:
name: Build (Windows)
runs-on: windows-latest
if: github.event.inputs.publish_release != 'true'

defaults:
run:
shell: msys2 {0}

steps:
- name: Install dependencies
uses: msys2/setup-msys2@v2
with:
path-type: inherit # Inherit the path so that dotnet can be found
Expand All @@ -70,65 +75,68 @@ jobs:
mingw-w64-x86_64-gobject-introspection
mingw-w64-x86_64-meson

- name: Install dependencies (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: brew install cairo gdk-pixbuf gobject-introspection meson
- name: Prepare git
run: git config --global core.autocrlf false
shell: bash

# Note: gobject-introspection is the actual dependency, but
# libgirepository1.0-dev is needed so that meson can find it via pkg-config
- name: Install dependencies (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt update && sudo apt install meson libgirepository1.0-dev
- name: Checkout with submodules
uses: actions/checkout@v3
with:
submodules: 'true'

- name: Compile native library
run: dotnet fsi GenerateGirTestLib.fsx
working-directory: './src'
- name: Create Gir.Core
uses: ./.github/actions/create
with:
configuration: ${{ env.configuration }}
source_directory: './src'
shell: msys2 {0}

build_linux:
name: Build (Linux)
runs-on: ubuntu-latest
container:
image: fedora:latest
env:
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1

defaults:
run:
shell: bash

steps:
- name: Install dependencies
run: sudo dnf -y upgrade && sudo dnf -y install meson gobject-introspection-devel git gcc glib2-devel gdk-pixbuf2 gdk-pixbuf2-modules cairo-gobject

- name: Call generator
run: dotnet fsi GenerateLibs.fsx GirTest-0.1.gir
working-directory: './src'
- name: Prepare git
run: git config --global core.autocrlf false
shell: bash

- name: Build complete solution
run: dotnet build --nologo -c ${{ env.configuration }}
working-directory: './src'
- name: Checkout with submodules
uses: actions/checkout@v3
with:
submodules: 'true'

- name: Build libraries only
run: dotnet build --nologo -c ${{ env.configuration }} GirCore.Libs.slnf
working-directory: './src'
- name: Create Gir.Core
uses: ./.github/actions/create
with:
configuration: ${{ env.configuration }}
source_directory: './src'
shell: bash

- name: Verify code format
if: ${{ matrix.os == 'ubuntu-latest' }}
run: dotnet format GirCore.sln --no-restore --verify-no-changes --exclude *.Generated.cs
working-directory: './src'

- name: Run unit tests
run: dotnet test --no-restore -c ${{ env.configuration }} --filter "TestCategory=UnitTest | TestCategory=BindingTest"
working-directory: './src'

- name: Run integration tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: dotnet test --no-restore -c ${{ env.configuration }} --filter TestCategory=IntegrationTest
run: dotnet test --no-restore -c $configuration --filter TestCategory=IntegrationTest
working-directory: './src'

- name: Get current time
if: ${{ github.event.inputs.publish == 'true' && github.event.inputs.preview == 'true' && matrix.os == 'ubuntu-latest' }}
uses: josStorer/get-current-time@v2.1.1
id: current-time
with:
format: YYYYMMDD-HHmmss

- name: Pack preview version
if: ${{ github.event.inputs.publish == 'true' && github.event.inputs.preview == 'true' && matrix.os == 'ubuntu-latest'}}
run: dotnet pack --no-build --nologo -c ${{ env.configuration }} --version-suffix "CI-${{ steps.current-time.outputs.formattedTime }}" -o ../Nuget
working-directory: './src'

- name: Pack release version
if: ${{ github.event.inputs.publish == 'true' && github.event.inputs.preview == 'false' && matrix.os == 'ubuntu-latest' }}
run: dotnet pack --no-build --nologo -c ${{ env.configuration }} -o ../Nuget
if: env.publish_release == 'true'
run: dotnet pack --no-build --nologo -c $configuration --version-suffix "$version_suffix" -o ../Nuget
working-directory: './src'

- name: Publish to nuget org
if: ${{ github.event.inputs.publish == 'true' && matrix.os == 'ubuntu-latest' }}
if: env.publish_release == 'true'
run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s nuget.org
working-directory: './Nuget'

8 changes: 3 additions & 5 deletions src/GenerateGirTestLib.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
open SimpleExec

let libSrcDir = System.IO.Path.Combine(
System.IO.Directory.GetCurrentDirectory(),
"Native/GirTestLib")
System.IO.Directory.GetCurrentDirectory(), "Native", "GirTestLib")
let libBuildDir = System.IO.Path.Combine(libSrcDir, "builddir")
let libInstallDir = System.IO.Path.Combine(libSrcDir, "installdir")

let girFileName = "GirTest-0.1.gir"
let girFilePath = System.IO.Path.Combine(libInstallDir, "share/gir-1.0", girFileName)
let girFilePath = System.IO.Path.Combine(libInstallDir, "share", "gir-1.0", girFileName)

let extGirFileDir = System.IO.Path.Combine(
System.IO.Directory.GetCurrentDirectory(),
"../ext/gir-files")
System.IO.Directory.GetCurrentDirectory(), "..", "ext", "gir-files")

(* Configure the project.
We explicitly set the install folder to 'lib' to have a consistent path on all platforms
Expand Down
9 changes: 9 additions & 0 deletions src/GirCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JavascriptCall", "Samples/W
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JavascriptCallback", "Samples/WebKit-6.0/JavascriptCallback/JavascriptCallback.csproj", "{9CF39E8D-5543-47E9-A136-A85009FF12C3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "actions", "actions", "{A8607D28-5605-4833-803F-AB6DC85E8BBD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "create", "create", "{C095C48D-7B27-47D5-9472-ACFB5A188099}"
ProjectSection(SolutionItems) = preProject
..\.github\actions\create\action.yml = ..\.github\actions\create\action.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -885,5 +892,7 @@ Global
{1E2FA4E9-75B8-4410-B3D7-15A5AF2FC5C8} = {386AE10F-B7AC-4C97-AC5C-202D3662A868}
{1751A21D-3D4D-4668-A95A-B6969D3ACE0B} = {825BF602-98A7-45E7-A2C9-9E68160B7DF3}
{9CF39E8D-5543-47E9-A136-A85009FF12C3} = {825BF602-98A7-45E7-A2C9-9E68160B7DF3}
{A8607D28-5605-4833-803F-AB6DC85E8BBD} = {A2ECECDD-9986-450D-A0AC-D2BE32A0B23E}
{C095C48D-7B27-47D5-9472-ACFB5A188099} = {A8607D28-5605-4833-803F-AB6DC85E8BBD}
EndGlobalSection
EndGlobal
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载