Skip to content

Commit

Permalink
Automated Releases (#53)
Browse files Browse the repository at this point in the history
* Create release pipeline with three jobs:
compile-gui uses pyinstaller on Linux and Windows to get GUI binaries
create-installer uses Inno Setup to build the Windows app installer
release uses goreleaser to package and release the binaries
the jobs share intermediate build products using actions/cache

* Roll version to 0.2.1
  • Loading branch information
foodprocessor authored Nov 30, 2023
1 parent 73469e8 commit 75a68e7
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 15 deletions.
203 changes: 203 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
name: Release binaries
on:
push:
tags:
- '*'

jobs:
compile-gui:
# Compile the GUI on Windows & Linux, and write the GUI binaries to actions/cache
name: Compile GUI
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
-
name: Checkout code
uses: actions/checkout@v4
-
name: Fetch cached compiled GUI
id: restore-compiled-gui
uses: actions/cache/restore@v3
with:
# enableCrossOsArchive always needs to be set on cached items in Windows jobs
# see cache documentation: https://github.com/actions/cache#inputs
enableCrossOsArchive: true
path: gui/dist/cloudfuseGUI_${{ runner.os }}
key: ${{ runner.os }}-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
-
name: Install Python
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit }}
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
-
name: Install pip dependencies
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit }}
run: pip3 install -r gui/requirements.txt
shell: bash
-
name: Compile GUI
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit }}
shell: bash
run: |
cd gui
./create_gui.sh
mv dist/cloudfuseGUI dist/cloudfuseGUI_${{ runner.os }}
-
name: Cache compiled GUI
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit }}
uses: actions/cache/save@v3
with:
enableCrossOsArchive: true
path: gui/dist/cloudfuseGUI_${{ runner.os }}
key: ${{ runner.os }}-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}

create-installer:
# Run Inno Setup to create the Windows app installer, then write it to actions/cache
name: Create Windows Installer
needs: compile-gui
runs-on: windows-latest
env:
go: '1.20'
cgo: '0'
winfsp: winfsp-2.0.23075.msi
steps:
- # Build the command-line program
name: Checkout code
uses: actions/checkout@v4
-
name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.go }}
check-latest: true
-
name: Set CGO
shell: bash
run: |
if [[ "${{ env.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ env.cgo }}' >> $GITHUB_ENV ; fi
-
name: Build
shell: bash
run: |
commitDate=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S)
ldflags="-s -w -X main.version=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$commitDate"
go build -trimpath -ldflags ''"$ldflags"'' -o cloudfuse.exe
go build -trimpath -ldflags ''"$ldflags"'' -o cfusemon.exe ./tools/health-monitor/
touch -m -d $commitDate cloudfuse.exe
touch -m -d $commitDate cfusemon.exe
- # Get the WinFSP installer (from cache or download)
name: Get cached WinFSP installer
id: restore-winfsp-installer
uses: actions/cache/restore@v3
with:
path: ${{ env.winfsp }}
key: ${{ env.winfsp }}
-
name: Download WinFSP installer
if: ${{ ! steps.restore-winfsp-installer.outputs.cache-hit }}
shell: bash
run: |
curl -LOf https://github.com/winfsp/winfsp/releases/download/v2.0/${{ env.winfsp }}
-
name: Cache WinFSP installer
if: ${{ ! steps.restore-winfsp-installer.outputs.cache-hit }}
uses: actions/cache/save@v3
with:
path: ${{ env.winfsp }}
key: ${{ env.winfsp }}
-
name: Fetch cached compiled GUI
uses: actions/cache/restore@v3
with:
enableCrossOsArchive: true
path: gui/dist/cloudfuseGUI_${{ runner.os }}
key: ${{ runner.os }}-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
fail-on-cache-miss: true
# don't continue if we fail get the compiled GUI for the Windows installer
continue-on-error: false
- # Build the installer and save it to actions/cache
name: Run Inno Setup
# Inno Setup is pre-installed on GitHub's windows-latest image
# see documentation: https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
run: |
& "C:/Program Files (x86)/Inno Setup 6/iscc.exe" build/windows_installer_build.iss
-
name: Rename installer
run: |
mv build/Output/cloudfuse.exe build/Output/cloudfuse_install_Windows_x86_64.exe
-
name: Cache windows installer
uses: actions/cache/save@v3
with:
enableCrossOsArchive: true
path: build/Output/cloudfuse_install_Windows_x86_64.exe
key: windows-cloudfuse-installer-${{ github.sha }}

release:
# Use GoReleaser to package and publish Linux releases along with the Windows installer
name: Release Binaries
needs: create-installer
runs-on: ubuntu-latest
env:
go: '1.20'

steps:
- # libfuse-dev is required to build our command-line program
name: Install Libfuse
run: |
sudo apt-get install -y libfuse-dev
- # enable GoReleaser to build for ARM64
name: Install ARM64 compilers
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu
- # Get code and Go ready
name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.go }}
check-latest: true
- # Get cached intermediate build products
name: Restore cached Windows installer
uses: actions/cache/restore@v3
with:
enableCrossOsArchive: true
path: build/Output/cloudfuse_install_Windows_x86_64.exe
key: windows-cloudfuse-installer-${{ github.sha }}
fail-on-cache-miss: true
continue-on-error: false
-
name: Restore Linux compiled GUI
uses: actions/cache/restore@v3
with:
path: gui/dist/cloudfuseGUI_Linux
key: Linux-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
fail-on-cache-miss: true
continue-on-error: false
-
name: Restore Windows compiled GUI
uses: actions/cache/restore@v3
with:
enableCrossOsArchive: true
path: gui/dist/cloudfuseGUI_Windows
key: Windows-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
# the hash value comes out different on Linux vs Windows
# so we need to use restore-keys to match the Windows compiled GUI
# see documentation: https://github.com/actions/cache/blob/main/restore/README.md#inputs
restore-keys: Windows-compiled-gui-
continue-on-error: false
- # Run GoReleaser (see .goreleaser.yaml)
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
if [[ "${{ env.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ env.cgo }}' >> $GITHUB_ENV ; fi
- name: Build
shell: bash
run: |
./build.sh
Expand Down
8 changes: 3 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- id: windows
Expand Down Expand Up @@ -76,7 +74,7 @@ archives:
- LICENSE
- README.md
- NOTICE
- src: "./gui/dist/cloudfuseGUI_linux/*"
- src: "./gui/dist/cloudfuseGUI_Linux/*"
dst: "./"
- src: "setup/baseConfig.yaml"
dst: "./samples/baseConfig.yaml"
Expand Down Expand Up @@ -136,7 +134,7 @@ archives:
- LICENSE
- README.md
- NOTICE
- src: "./gui/dist/cloudfuseGUI_windows/*"
- src: "./gui/dist/cloudfuseGUI_Windows/*"
dst: "./"
- src: "setup/baseConfig.yaml"
dst: "./samples/baseConfig.yaml"
Expand Down Expand Up @@ -204,7 +202,7 @@ nfpms:

- src: ./gui/cloudfuse.desktop
dst: /usr/share/applications/cloudfuse.desktop
- src: "./gui/dist/cloudfuseGUI_linux/*"
- src: "./gui/dist/cloudfuseGUI_Linux/*"
dst: "/opt/cloudfuse"

overrides:
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Cloudfuse Changelog #

## 0.2.1 (WIP) ##
## 0.2.1 ##

This version is based on [blobfuse2 2.1.2](https://github.com/Azure/azure-storage-fuse/releases/tag/blobfuse2-2.1.2) (upstream).
**Changes**
Changed sync-to-flush to true by default.
-- Changed sync-to-flush to true by default.
**Bug Fixes**
-- [#48](https://github.com/Seagate/cloudfuse/pull/48) Prevent "Access Denied" when running as a Windows service

## 0.2.0 ##

Expand Down
10 changes: 5 additions & 5 deletions build/windows_installer_build.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Cloudfuse"
#define MyAppVersion "0.2.0"
#define MyAppVersion "0.2.1"
#define MyAppPublisher "Seagate Technology"
#define MyAppURL "https://github.com/Seagate/cloudfuse"
#define MyAppExeName "cloudfuseGUI.exe"
Expand All @@ -22,7 +22,7 @@ AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=C:\Users\721190\code\cloudfuse\LICENSE
LicenseFile=..\LICENSE
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=commandline
Expand All @@ -39,8 +39,8 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "..\gui\dist\cloudfuseGUI\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\gui\dist\cloudfuseGUI\_internal\*"; DestDir: "{app}\_internal\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\gui\dist\cloudfuseGUI_Windows\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\gui\dist\cloudfuseGUI_Windows\_internal\*"; DestDir: "{app}\_internal\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\cloudfuse.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\LICENSE"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\README.md"; DestDir: "{app}"; Flags: ignoreversion
Expand All @@ -51,7 +51,7 @@ Source: "..\sampleFileCacheWithSASConfigAzure.yaml"; DestDir: "{app}"; Flags: ig
Source: "..\sampleStreamingConfigAzure.yaml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\sampleStreamingConfigS3.yaml"; DestDir: "{app}"; Flags: ignoreversion

Source: ".\winfsp-2.0.23075.msi"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\winfsp-2.0.23075.msi"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Dirs]
Expand Down
2 changes: 1 addition & 1 deletion common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (

// Standard config default values
const (
cloudfuseVersion_ = "0.2.0"
cloudfuseVersion_ = "0.2.1"

DefaultMaxLogFileSize = 512
DefaultLogFileCount = 10
Expand Down
2 changes: 1 addition & 1 deletion gui/compile_ui.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh -x

rm ui*.py || true
rm ui_*.py || true

pyside6-uic mountPrimaryWindow.ui > ui_mountPrimaryWindow.py
pyside6-uic s3_config_common.ui > ui_s3_config_common.py
Expand Down
4 changes: 3 additions & 1 deletion gui/create_gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

source ./compile_ui.sh

pyinstaller cloudfuse_gui.spec --distpath=./dist
pyinstaller cloudfuse_gui.spec --distpath=./dist

rm ui_*.py || true
3 changes: 3 additions & 0 deletions gui/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pyinstaller==6.2.0
PySide6==6.5.3
PyYAML==6.0.1

0 comments on commit 75a68e7

Please sign in to comment.