From b7bda71521fbcb7f49c58b4d322e3f6e5eb44bf9 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Fri, 3 Mar 2023 17:15:35 +0100 Subject: [PATCH] test --- .github/workflows/build.yml | 96 ++++++++++++------------------------- sw/deployer/src/main.rs | 4 +- 2 files changed, 33 insertions(+), 67 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39659eb..a262654 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} diff --git a/sw/deployer/src/main.rs b/sw/deployer/src/main.rs index 3cb40c9..bb2c1fb 100644 --- a/sw/deployer/src/main.rs +++ b/sw/deployer/src/main.rs @@ -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, check_firmware: bool) -> Result Result, T, E>(message: String, operation: F) -> Result { print!("{}... ", message); - io::stdout().flush().unwrap(); + stdout().flush().unwrap(); let result = operation(); println!("done"); result