Skip to content

Commit

Permalink
implement suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
erubboli committed Sep 11, 2024
1 parent 7416207 commit b5e9931
Show file tree
Hide file tree
Showing 14 changed files with 241 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
# - name: Collect coverage data with grcov
# run: grcov . --source-dir . --output-type lcov --branch --ignore-not-existing --binary-path ./target/debug/ -o grcov-report-${{ matrix.partition }}

# - uses: actions/upload-artifact@v2
# - uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report-${{ matrix.partition }}
# path: grcov-report-${{ matrix.partition }}
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
name: Build, Sign, and Release
name: Build, Sign and Release

on:
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+*'
pull_request:


jobs:
build-macos:
uses: ./.github/workflows/build-macos.yml
uses: ./.github/workflows/release_macos.yml
with:
binary_list: api-blockchain-scanner-daemon,api-web-server,dns-server,node-daemon,wallet-address-generator,wallet-cli,wallet-rpc-daemon
secrets: inherit

build-linux:
uses: ./.github/workflows/build-linux.yml
uses: ./.github/workflows/release_linux.yml
with:
binary_list: api-blockchain-scanner-daemon,api-web-server,dns-server,node-daemon,wallet-address-generator,wallet-cli,wallet-rpc-daemon
secrets: inherit

build-windows:
uses: ./.github/workflows/build-windows.yml
uses: ./.github/workflows/release_windows.yml
with:
binary_list: api-blockchain-scanner-daemon,api-web-server,dns-server,node-daemon,wallet-address-generator,wallet-cli,wallet-rpc-daemon
secrets: inherit

build-docker:
uses: ./.github/workflows/build-docker.yml
needs: [build-macos, build-linux, build-windows]
uses: ./.github/workflows/release_docker.yml
secrets: inherit

create-release:
needs: [build-macos, build-linux, build-windows]
needs: [build-macos, build-linux, build-windows, build-docker]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
echo "" >> $GITHUB_OUTPUT
echo "Linux:" >> $GITHUB_OUTPUT
echo "- Mintlayer Node GUI (DEB) for x86_64 and ARM64" >> $GITHUB_OUTPUT
echo "- Mintlayer Node (DEB and ZIP) for x86_64 and ARM64" >> $GITHUB_OUTPUT
echo "- Mintlayer Node (DEB and TGZ) for x86_64 and ARM64" >> $GITHUB_OUTPUT
echo "- Mintlayer Node GUI (RPM) for x86_64" >> $GITHUB_OUTPUT
echo "- Mintlayer Node (RPM) for x86_64" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
Expand All @@ -96,7 +96,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "Mintlayer_Node_*/*.dmg,Mintlayer_Node_*/*.deb,Mintlayer_Node_*/*.rpm,Mintlayer_Node_*/*.zip,Mintlayer_Node_*/*_Setup.exe"
artifacts: "Mintlayer_Node_*/*.dmg,Mintlayer_Node_*/*.deb,Mintlayer_Node_*/*.rpm,Mintlayer_Node_*/*.zip,Mintlayer_Node_*/*.tar.gz,Mintlayer_Node_*/*_Setup.exe"
artifactErrorsFailBuild: true
name: "Release ${{ steps.get_version.outputs.VERSION }}"
body: ${{ steps.generate_body.outputs.BODY }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
arch: [aarch64, x86_64]
Expand Down Expand Up @@ -58,13 +58,13 @@ jobs:
mkdir -p debian-gui/usr/share/icons/hicolor/128x128/apps
mkdir -p debian-gui/usr/share/icons/hicolor/64x64/apps
cp target/${{ matrix.arch }}-unknown-linux-gnu/release/node-gui debian-gui/usr/bin/
# Copy and convert icon files
cp build-tools/assets/node-gui-icon_512.png debian-gui/usr/share/icons/hicolor/512x512/apps/mintlayer-node-gui.png
convert build-tools/assets/node-gui-icon_512.png -resize 256x256 debian-gui/usr/share/icons/hicolor/256x256/apps/mintlayer-node-gui.png
convert build-tools/assets/node-gui-icon_512.png -resize 128x128 debian-gui/usr/share/icons/hicolor/128x128/apps/mintlayer-node-gui.png
convert build-tools/assets/node-gui-icon_512.png -resize 64x64 debian-gui/usr/share/icons/hicolor/64x64/apps/mintlayer-node-gui.png
# Create .desktop file
cat << EOF > debian-gui/usr/share/applications/mintlayer-node-gui.desktop
[Desktop Entry]
Expand All @@ -74,7 +74,7 @@ jobs:
Type=Application
Categories=Utility;Network;
EOF
cat << EOF > debian-gui/DEBIAN/control
Package: mintlayer-node-gui
Version: ${{ steps.get_version.outputs.VERSION }}
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
mkdir -p rpm-gui/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
mkdir -p rpm-gui/BUILDROOT/mintlayer-node-gui-${{ steps.get_version.outputs.VERSION }}-1.x86_64
cp -r debian-gui/usr rpm-gui/BUILDROOT/mintlayer-node-gui-${{ steps.get_version.outputs.VERSION }}-1.x86_64/
cat << EOF > rpm-gui/SPECS/mintlayer-node-gui.spec
Name: mintlayer-node-gui
Version: ${{ steps.get_version.outputs.VERSION }}
Expand All @@ -139,7 +139,7 @@ jobs:
* $(date "+%a %b %d %Y") Mintlayer <[email protected]> - ${{ steps.get_version.outputs.VERSION }}-1
- Initial RPM release
EOF
rpmbuild -bb --define "_topdir $(pwd)/rpm-gui" --buildroot $(pwd)/rpm-gui/BUILDROOT/mintlayer-node-gui-${{ steps.get_version.outputs.VERSION }}-1.x86_64 rpm-gui/SPECS/mintlayer-node-gui.spec
mv rpm-gui/RPMS/x86_64/mintlayer-node-gui-${{ steps.get_version.outputs.VERSION }}-1.x86_64.rpm Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_x86_64.rpm
Expand All @@ -149,7 +149,7 @@ jobs:
mkdir -p rpm-node/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
mkdir -p rpm-node/BUILDROOT/mintlayer-node-${{ steps.get_version.outputs.VERSION }}-1.x86_64
cp -r debian-node/usr rpm-node/BUILDROOT/mintlayer-node-${{ steps.get_version.outputs.VERSION }}-1.x86_64/
cat << EOF > rpm-node/SPECS/mintlayer-node.spec
Name: mintlayer-node
Version: ${{ steps.get_version.outputs.VERSION }}
Expand All @@ -168,18 +168,18 @@ jobs:
* $(date "+%a %b %d %Y") Mintlayer <[email protected]> - ${{ steps.get_version.outputs.VERSION }}-1
- Initial RPM release
EOF
rpmbuild -bb --define "_topdir $(pwd)/rpm-node" --buildroot $(pwd)/rpm-node/BUILDROOT/mintlayer-node-${{ steps.get_version.outputs.VERSION }}-1.x86_64 rpm-node/SPECS/mintlayer-node.spec
mv rpm-node/RPMS/x86_64/mintlayer-node-${{ steps.get_version.outputs.VERSION }}-1.x86_64.rpm Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_x86_64.rpm
- name: Package Mintlayer Node (without GUI) as ZIP
- name: Package Mintlayer Node (without GUI) as tar.gz
run: |
mkdir -p Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}
IFS=',' read -ra BINARIES <<< "${{ inputs.binary_list }}"
for binary in "${BINARIES[@]}"; do
cp target/${{ matrix.arch }}-unknown-linux-gnu/release/$binary Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}/
done
zip -r Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.zip Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}
tar -czvf Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.tar.gz Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}
- name: Upload GUI DEB Artifact
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -207,8 +207,22 @@ jobs:
name: Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_x86_64_rpm
path: Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_x86_64.rpm

- name: Upload Node ZIP Artifact (without GUI)
- name: List tar.gz files
run: |
echo "Matching tar.gz files:"
ls -l Mintlayer_Node_linux_*.tar.gz
- name: Upload Node tar.gz Artifact (without GUI)
id: upload_artifact # Add this id to reference this step
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}_zip
path: Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.zip
name: Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}_tar.gz
path: Mintlayer_Node_linux_*.tar.gz
if-no-files-found: warn

- name: Check artifact upload status
if: steps.upload_artifact.outcome == 'failure'
run: |
echo "Warning: Artifact upload failed or found duplicate files."
echo "Please check the artifacts manually."
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,44 @@ jobs:
$VERSION = "${{ steps.get_version.outputs.VERSION }}"
$DEST = "Mintlayer_Node_win_${VERSION}"
New-Item -ItemType Directory -Path $DEST
$binary_list = "${{ inputs.binary_list }}" -split ',' | Where-Object { $_ -ne "node-gui" }
foreach ($binary in $binary_list) {
$binary = $binary.Trim()
if (Test-Path "target\release\$binary.exe") {
if (Test-Path "target\release\$binary.exe") {
Copy-Item "target\release\$binary.exe" -Destination $DEST
} else {
Write-Warning "Binary not found: $binary.exe"
}
}
Compress-Archive -Path $DEST -DestinationPath "${DEST}.zip"
shell: pwsh

- name: Install NSIS
run: |
choco install nsis -y --force
echo "C:\Program Files (x86)\NSIS" >> $env:GITHUB_PATH
shell: pwsh

- name: Create License File
run: .\build-tools\win\create-license.ps1
shell: pwsh

- name: Create NSIS Installer Script
run: .\build-tools\win\create-nsis-script.ps1 -Version "${{ steps.get_version.outputs.VERSION }}"
shell: pwsh

- name: Build NSIS Installer
run: |
$makensisPath = (Get-Command makensis.exe).Source
Write-Host "Using makensis at: $makensisPath"
& $makensisPath installer.nsi
shell: pwsh

- name: Display NSIS Script
run: |
Get-Content -Path installer.nsi
shell: pwsh

- name: Package Mintlayer Node GUI
run: |
$VERSION = "${{ steps.get_version.outputs.VERSION }}"
Expand All @@ -71,42 +95,6 @@ jobs:
name: Mintlayer_Node_GUI_win_${{ steps.get_version.outputs.VERSION }}
path: Mintlayer_Node_GUI_win_${{ steps.get_version.outputs.VERSION }}.zip

- name: Install NSIS
run: |
choco install nsis -y
echo "C:\Program Files (x86)\NSIS" >> $env:GITHUB_PATH
shell: pwsh

- name: Create NSIS Installer Script
run: |
$VERSION = "${{ steps.get_version.outputs.VERSION }}"
$NSIS_SCRIPT = @"
!include "MUI2.nsh"
Name "Mintlayer Node GUI"
OutFile "Mintlayer_Node_GUI_win_${VERSION}_Setup.exe"
InstallDir "$PROGRAMFILES64\Mintlayer Node GUI"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "Install"
SetOutPath "$INSTDIR"
File "target\release\node-gui.exe"
CreateShortCut "$DESKTOP\Mintlayer Node GUI.lnk" "$INSTDIR\node-gui.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\node-gui.exe"
Delete "$INSTDIR\uninstall.exe"
Delete "$DESKTOP\Mintlayer Node GUI.lnk"
RMDir "$INSTDIR"
SectionEnd
"@
$NSIS_SCRIPT | Out-File -FilePath "installer.nsi" -Encoding utf8
shell: pwsh

- name: Build NSIS Installer
run: makensis installer.nsi

- name: Upload NSIS Installer Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion build-tools/codecheck/codecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ def check_trailing_whitespaces():
'script/src/test/test_vectors_4opc.csv.gz',
'wasm-wrappers/pkg/wasm_wrappers_bg.wasm',
'wasm-wrappers/doc/*',
'build-tools/assets/*'
'build-tools/assets/*',
'build-tools\osx\DeveloperIDG2CA.cer'
]

ok = True
Expand Down
27 changes: 27 additions & 0 deletions build-tools/win/create-license.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# build-tools/win/create-license.ps1

$LICENSE_TEXT = @"
MIT License
Copyright (c) 2024 RBB LAB
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"@

$LICENSE_TEXT | Out-File -FilePath "LICENSE.txt" -Encoding ASCII
Loading

0 comments on commit b5e9931

Please sign in to comment.