This commit is contained in:
Mateusz Faderewski 2023-03-03 17:15:35 +01:00
parent ad4f4db137
commit b7bda71521
2 changed files with 33 additions and 67 deletions

View File

@ -55,27 +55,23 @@ jobs:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
# pyinstaller-build-options: --target-arch=64bit
# pyinstaller-options: --onefile --console --icon ../../assets/sc64_logo_256_256.png
executable-name: sc64deployer.exe
package-name: sc64deployer-windows
# package-options: -c -a -f
# package-extension: zip
executable: sc64deployer.exe
name: sc64deployer-windows
options: -c -a -f
extension: zip
- os: ubuntu-latest
# pyinstaller-options: --onefile
linux-packages: libudev-dev
executable-name: sc64deployer
package-name: sc64deployer-linux
# package-options: -czf
# package-extension: tar.gz
executable: sc64deployer
name: sc64deployer-linux
options: -czf
extension: tar.gz
- os: macos-latest
# pyinstaller-options: --onedir --console --icon ../../assets/sc64_logo_256_256.png
executable-name: sc64deployer
package-name: sc64deployer-macos
# package-options: -czf
# package-extension: tgz
executable: sc64deployer
name: sc64deployer-macos
options: -czf
extension: tgz
runs-on: ${{ matrix.os }}
@ -83,15 +79,15 @@ jobs:
- name: Download SummerCart64 repository
uses: actions/checkout@v3
- name: Set SC64 version
- name: Set package version
uses: frabert/replace-string-action@v2
id: sc64version
id: version
with:
pattern: '\/'
string: '-${{ github.ref_name }}'
replace-with: '-'
- name: Install required linux packages
- name: Install linux packages
if: matrix.linux-packages
run: |
sudo apt-get update
@ -101,54 +97,24 @@ jobs:
run: cargo b -r
working-directory: sw/deployer
# - name: Setup python
# uses: actions/setup-python@v4
# with:
# python-version: '3.11'
# - name: Download pyinstaller repository
# uses: actions/checkout@v3
# with:
# repository: 'pyinstaller/pyinstaller'
# ref: 'v5.8.0'
# path: pyinstaller
# - name: Compile and install pyinstaller
# run: |
# pip3 uninstall pyinstaller
# pip3 install wheel
# pushd bootloader
# python3 ./waf all ${{ matrix.pyinstaller-build-options }}
# popd
# pip3 install .
# working-directory: pyinstaller
# - name: Install sc64.py requirements
# run: pip3 install -r requirements.txt
# working-directory: sw/pc
# - name: Create sc64.py executable
# run: python3 -m PyInstaller --clean ${{ matrix.pyinstaller-options }} sc64.py
# working-directory: sw/pc
# - name: Package executable
# run: |
# mkdir package
# pushd dist
# tar ${{ matrix.package-options }} ../package/${{ matrix.package-name }}${{ steps.sc64version.outputs.replaced }}.${{ matrix.package-extension }} *
# popd
# working-directory: sw/pc
- name: Package executable
run: |
mkdir package
cd target/release
tar ${{ matrix.options }} \
../../package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }} \
${{ matrix.executable }}
working-directory: sw/deployer
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.package-name }}${{ steps.sc64version.outputs.replaced }}
path: sw/deployer/target/release/${{ matrix.executable-name }}
# path: sw/pc/package/${{ matrix.package-name }}${{ steps.sc64version.outputs.replaced }}.${{ matrix.package-extension }}
name: ${{ matrix.name }}${{ steps.version.outputs.replaced }}
path: sw/deployer/package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }}
# - name: Upload release assets
# if: github.event_name == 'release' && github.event.action == 'created'
# uses: softprops/action-gh-release@v0.1.15
# with:
# files: |
# sw/pc/package/${{ matrix.package-name }}${{ steps.sc64version.outputs.replaced }}.${{ matrix.package-extension }}
- name: Upload release assets
if: github.event_name == 'release' && github.event.action == 'created'
uses: softprops/action-gh-release@v0.1.15
with:
files: |
sw/deployer/package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }}

View File

@ -9,7 +9,7 @@ use colored::Colorize;
use panic_message::panic_message;
use std::{
fs::File,
io::{self, BufReader, Read, Write},
io::{stdout, BufReader, Read, Write},
path::PathBuf,
sync::{
atomic::{AtomicBool, Ordering},
@ -518,7 +518,7 @@ fn init_sc64(sn: Option<String>, check_firmware: bool) -> Result<sc64::SC64, sc6
fn log_wait<F: FnOnce() -> Result<T, E>, T, E>(message: String, operation: F) -> Result<T, E> {
print!("{}... ", message);
io::stdout().flush().unwrap();
stdout().flush().unwrap();
let result = operation();
println!("done");
result