diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ac5d9c..5eaef19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,9 @@ defaults: jobs: build-trixie: + strategy: + matrix: + devbuild: ['enabled', 'disabled'] runs-on: ubuntu-latest container: docker.io/library/debian:trixie-slim name: Build Trixie @@ -38,79 +41,24 @@ jobs: apt-get install -y ./powershell.deb rm powershell.deb - - name: Build Lingmo + - name: Build Lingmo Nightly + if: ${{ matrix.devbuild == 'enabled' }} run: | git config --global http.sslVerify false git config --global advice.detachedHead false - pwsh ./build.ps1 + chmod +x ./build.ps1 + pwsh -c "./build.ps1 -BuildFromGit" + + - name: Build Lingmo Using Tag + if: ${{ matrix.devbuild == 'disabled' }} + run: | + git config --global http.sslVerify false + git config --global advice.detachedHead false + chmod +x ./build.ps1 + pwsh -c "./build.ps1" - uses: actions/upload-artifact@v4 with: - name: Lingmo Artifacts hydrogen + name: Lingmo Artifacts With Nightly ${{ matrix.devbuild }} path: BuildArtifacts compression-level: 9 # maximum compression - - - # upload: - # needs: build - # runs-on: ubuntu-latest - # name: Update to repo - # steps: - # - uses: actions/checkout@v4 - - # - uses: actions/download-artifact@v4 - # with: - # # Destination path. Supports basic tilde expansion. - # # Optional. Default is $GITHUB_WORKSPACE - # path: ./zips - - # # The repository owner and the repository name joined together by "/". - # # If github-token is specified, this is the repository that artifacts will be downloaded from. - # # Optional. Default is ${{ github.repository }} - # repository: ${{ github.repository }} - - # # The id of the workflow run where the desired download artifact was uploaded from. - # # If github-token is specified, this is the run that artifacts will be downloaded from. - # # Optional. Default is ${{ github.run_id }} - # run-id: ${{ github.run_id }} - - # - name: Prepare envs - # run: | - # sudo apt update && sudo apt install reprepro gnupg - # echo "${{ secrets.GPG_SIGN_KEY }}" >> key.key - # gpg --import key.key - - # - name: Clone repo - # run: | - # git clone https://github.com/LingmoOS-Testing/lingmo-rolling-mirror.git pkg_site - # DEB_FILE_DIR="$(pwd)/zips" - - # rm -rf pkg_site/devrepo/* - # cd pkg_site/helpers - # bash init_repo.sh - - # git checkout --orphan latest_branch - - # DEB_FILES=$(find $DEB_FILE_DIR -type f -name '*.deb') - # for debfile in $DEB_FILES; do - # bash add_deb.sh "$debfile" - # done - # cd .. - - # git config --global user.email "automation@lingmo.org" - # git config --global user.name "Lingmo Automation Packer" - # git add . && git commit -m "Update Packages By Actions $(date)" - - # git branch -D master - # git branch -m master - - # - name: Push changes - # uses: ad-m/github-push-action@9870d48124da805820c70ebc6ba563c715551019 - # with: - # github_token: ${{ secrets.API_GITHUB_TOKEN }} - # repository: "LingmoOS-Testing/lingmo-rolling-mirror" - # directory: "./pkg_site" - # branch: 'master' - # force: true - - diff --git a/Configs/lingmo-archive-keyring.json b/Configs/lingmo-archive-keyring.json deleted file mode 100644 index 20d85f8..0000000 --- a/Configs/lingmo-archive-keyring.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Name": "lingmo-archive-keyring", - "Repository": "https://github.com/LingmoOS/lingmo-archive-keyring.git", - "BuildType": "Debian", - "Tag": "2024.8.0+fix1" -} diff --git a/Configs/lingmo-plymouth-theme.json b/Configs/lingmo-plymouth-theme.json new file mode 100644 index 0000000..b07a141 --- /dev/null +++ b/Configs/lingmo-plymouth-theme.json @@ -0,0 +1,6 @@ +{ + "Name": "lingmo-plymouth-theme", + "Repository": "https://github.com/LingmoOS/lingmo-plymouth-theme.git", + "Tag": "2.0.1", + "BuildType": "Debian" +} diff --git a/Modules/BuildUtils.psm1 b/Modules/BuildUtils.psm1 index 6dbc18f..9e82d45 100644 --- a/Modules/BuildUtils.psm1 +++ b/Modules/BuildUtils.psm1 @@ -5,6 +5,7 @@ Import-Module "$PSScriptRoot/GlobalConfig" Import-Module "$PSScriptRoot/GitModule" Import-Module "$PSScriptRoot/SourceRepoTools" +Import-Module "$PSScriptRoot/CommonUtils" function Get-SudoPrivilege { Write-Host "Now checking for root privileges." @@ -28,22 +29,17 @@ function Get-SudoPrivilege { function Install-GlobalDepends { Write-Host "Installing Common build dependencies" - $Env:LC_ALL="C.UTF-8" + $env:LC_ALL="C.UTF-8" - sudo apt-get --yes install git devscripts equivs | Out-Null - - # Assuming Windows has "LingmoOSBuildDeps" directory support - $repoPath = Import-LingmoRepo "https://github.com/LingmoOS/LingmoOSBuildDeps.git" "LingmoOSBuildDeps" $true - Set-Location $repoPath - sudo mk-build-deps -i -t "apt-get -y" -r | Out-Null + Start-ShellProcess "sudo" @("apt-get", "--yes", "install", "git devscripts equivs") } function Install-RepoDepends($repoPath) { - $Env:LC_ALL="C.UTF-8" + $env:LC_ALL="C.UTF-8" # Assuming Windows has "LingmoOSBuildDeps" directory support Set-Location $repoPath - sudo mk-build-deps -i -t "apt-get -y" -r | Out-Null + Start-ShellProcess "sudo" @("mk-build-deps", "-i -t", "`"apt-get -y`"", "-r") } function Start-CompileDeb($repo) { @@ -55,7 +51,8 @@ function Start-CompileDeb($repo) { Install-RepoDepends $repo.m_repoPath Write-Host "Build $($repo.repoName) ..." - dpkg-buildpackage -b -uc -us -tc -j"$(nproc)" | Out-Null + $totalCPUS = (nproc).ToString() + Start-ShellProcess "dpkg-buildpackage" @("-b", "-uc", "-us", "-tc", "-j$($totalCPUS)") Write-Host "$($repo.repoName) Complete!" diff --git a/Modules/CommonUtils.psm1 b/Modules/CommonUtils.psm1 new file mode 100644 index 0000000..a069d3b --- /dev/null +++ b/Modules/CommonUtils.psm1 @@ -0,0 +1,28 @@ +<# + .DESCRIPTION + Contain commonly used funcions. +#> + +<# + .DESCRIPTION + Execute a process and throw an error if not exit correctly + .OUTPUTS + True if sucess. Throw error if failed +#> +function Start-ShellProcess { + param ( + [Parameter(Mandatory)] + [string] $execName, + [System.Collections.ArrayList] $params + ) + + $proc = Start-Process $execName -ArgumentList $params -Wait -PassThru + + if ($proc.ExitCode -ne 0) { + # 如果非正常结束,就会报错 + throw "Error executing $($repoURL) with param: $($cloneDst)" + } + + return $true +} +Export-ModuleMember -Function Start-ShellProcess diff --git a/Modules/GitModule.psm1 b/Modules/GitModule.psm1 index 2734d67..95bed2d 100644 --- a/Modules/GitModule.psm1 +++ b/Modules/GitModule.psm1 @@ -4,6 +4,7 @@ #> Import-Module "$PSScriptRoot/GlobalConfig" +Import-Module "$PSScriptRoot/CommonUtils" <# .DESCRIPTION @@ -44,9 +45,11 @@ function Import-LingmoRepo { Remove-DirIfExist $cloneDst if ($cloneDevGit -eq $true) { - git clone $repoURL $cloneDst | Out-Null + $params = @("clone", "--recursive", "$($repoURL)", "$($cloneDst)") + $ret = Start-ShellProcess "git" $params } else { - git clone -b $Tag $repoURL $cloneDst | Out-Null + $params = @("clone", "--recursive", "-b", "$($Tag)", "$($repoURL)", "$($cloneDst)") + $ret = Start-ShellProcess "git" $params } return $cloneDst diff --git a/Modules/SourceRepoTools.psm1 b/Modules/SourceRepoTools.psm1 index f57f5f3..b8d7663 100644 --- a/Modules/SourceRepoTools.psm1 +++ b/Modules/SourceRepoTools.psm1 @@ -101,9 +101,9 @@ function Get-AllRepoConfigs { $fullPath = "$(Get-ConfigPath)/$name" $item = Get-ConfigFromFile $fullPath $cloneDevGit if ($clone) { - $item.CloneRepo() | Out-Null + $item.CloneRepo() } - $results.Add($item) | Out-Null + $results.Add($item) } return $results diff --git a/build.ps1 b/build.ps1 index d1824ce..0a9fa38 100755 --- a/build.ps1 +++ b/build.ps1 @@ -15,6 +15,7 @@ $LingMainScriptPath = $MyInvocation.MyCommand.Definition $LingMainScriptDirectory = Split-Path $LingMainScriptPath -Parent # Import modules +Import-Module (Join-Path $LingMainScriptDirectory "/Modules/CommonUtils") Import-Module (Join-Path $LingMainScriptDirectory "/Modules/GlobalConfig") Import-Module (Join-Path $LingMainScriptDirectory "/Modules/GitModule") Import-Module (Join-Path $LingMainScriptDirectory "/Modules/SourceRepoTools")