From 9d2f716f8ad9006d8dfb9cc518407f1f41754eaf Mon Sep 17 00:00:00 2001 From: Xerbo Date: Thu, 7 Jul 2022 20:13:22 +0100 Subject: [PATCH] Rewrite workflows --- .github/workflows/{debug.yml => build.yml} | 47 +++++++++----- .github/workflows/release.yml | 73 +++++++++++++++++----- .github/workflows/win_debug.yml | 30 --------- .github/workflows/win_release.yml | 30 --------- build_windows.bat | 2 +- 5 files changed, 92 insertions(+), 90 deletions(-) rename .github/workflows/{debug.yml => build.yml} (64%) delete mode 100644 .github/workflows/win_debug.yml delete mode 100644 .github/workflows/win_release.yml diff --git a/.github/workflows/debug.yml b/.github/workflows/build.yml similarity index 64% rename from .github/workflows/debug.yml rename to .github/workflows/build.yml index 22f580a..4bc01db 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,20 @@ -name: x86 Debug +name: Build on: push: - branches: - - devel + branches: [ master ] + paths-ignore: + - '**.md' + pull_request: + branches: [ master ] + paths-ignore: + - '**.md' + env: - BUILD_TYPE: Debug + BUILD_TYPE: Release jobs: - build: + build_linux: runs-on: ubuntu-latest steps: @@ -39,16 +45,29 @@ jobs: # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config $BUILD_TYPE -# Tests are still WIP -# - name: Test -# working-directory: ${{runner.workspace}}/build -# shell: bash -# # Execute tests defined by the CMake configuration. -# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail -# run: ctest -C $BUILD_TYPE - - name: Upload compilied binary uses: actions/upload-artifact@v2 with: - name: Debug build + name: Release build path: ${{runner.workspace}}/build/aptdec + + build_windows: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + # The user does not run as root + run: sudo apt install wget cmake make mingw-w64 git unzip libsndfile-dev + + - name: Run build script + shell: bash + working-directory: ${{runner.workspace}} + run: cd $GITHUB_WORKSPACE && ./build_windows.sh $BUILD_TYPE + + - name: Upload compilied binary + uses: actions/upload-artifact@v2 + with: + name: Release build + path: ${{runner.workspace}}/aptdec/winbuild/aptdec-1.7.0.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb22324..06c3214 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,35 @@ -name: x86 Release +name: Build on: push: - branches: - - master + tags: + - 'v*' + env: BUILD_TYPE: Release jobs: - build: + prepare_release: runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + + steps: + - name: Create Release + uses: actions/create-release@v1 + id: create_release + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: A release wow + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build_linux: + runs-on: ubuntu-latest + needs: [prepare_release] steps: - uses: actions/checkout@v2 @@ -39,16 +59,39 @@ jobs: # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config $BUILD_TYPE -# Tests are still WIP -# - name: Test -# working-directory: ${{runner.workspace}}/build -# shell: bash -# # Execute tests defined by the CMake configuration. -# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail -# run: ctest -C $BUILD_TYPE + - name: Upload binary + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ needs.prepare_release.outputs.upload_url }} + asset_path: ./${{runner.workspace}}/aptdec/build/aptdec + asset_name: aptdec_lin64 + asset_content_type: application/x-executable + env: + GITHUB_TOKEN: ${{ github.token }} + + + build_windows: + runs-on: ubuntu-latest + needs: [prepare_release] + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + # The user does not run as root + run: sudo apt install wget cmake make mingw-w64 git unzip libsndfile-dev + + - name: Run build script + shell: bash + working-directory: ${{runner.workspace}} + run: cd $GITHUB_WORKSPACE && ./build_windows.sh $BUILD_TYPE - - name: Upload compilied binary - uses: actions/upload-artifact@v2 + - name: Upload zip + uses: actions/upload-release-asset@v1 with: - name: Release build - path: ${{runner.workspace}}/build/aptdec + upload_url: ${{ needs.prepare_release.outputs.upload_url }} + asset_path: ./${{runner.workspace}}/aptdec/winbuild/aptdec-1.7.0.zip + asset_name: aptdec_win64.zip + asset_content_type: application/zip + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/win_debug.yml b/.github/workflows/win_debug.yml deleted file mode 100644 index 7843a79..0000000 --- a/.github/workflows/win_debug.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: x86 Win Debug - -on: - push: - branches: - - devel -env: - BUILD_TYPE: Debug - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - # The user does not run as root - run: sudo apt install wget cmake make mingw-w64 git unzip libsndfile-dev - - - name: Run build script - shell: bash - working-directory: ${{runner.workspace}} - run: cd $GITHUB_WORKSPACE && ./build_windows.sh $BUILD_TYPE - - - name: Upload compilied binary - uses: actions/upload-artifact@v2 - with: - name: Debug build - path: ${{runner.workspace}}/aptdec/winbuild/aptdec-1.7.0.zip diff --git a/.github/workflows/win_release.yml b/.github/workflows/win_release.yml deleted file mode 100644 index 2d6b4e8..0000000 --- a/.github/workflows/win_release.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: x86 Win Release - -on: - push: - branches: - - master -env: - BUILD_TYPE: Release - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - # The user does not run as root - run: sudo apt install wget cmake make mingw-w64 git unzip libsndfile-dev - - - name: Run build script - shell: bash - working-directory: ${{runner.workspace}} - run: cd $GITHUB_WORKSPACE && ./build_windows.sh $BUILD_TYPE - - - name: Upload compilied binary - uses: actions/upload-artifact@v2 - with: - name: Release build - path: ${{runner.workspace}}/aptdec/winbuild/aptdec-1.7.0.zip diff --git a/build_windows.bat b/build_windows.bat index c0872ec..b51f2a2 100644 --- a/build_windows.bat +++ b/build_windows.bat @@ -20,7 +20,7 @@ ninja install cd ../.. REM Build libsndfile - Could build Vorbis, FLAC and Opus first for extra support -git clone https://github.com/libsndfile/libsndfile.git +git clone https://github.com/libsndfile/libsndfile cd libsndfile mkdir build cd build