From b3b6c0276e3ac257ca5d5377ca2015b110566761 Mon Sep 17 00:00:00 2001 From: Jaromil Date: Sat, 31 Dec 2022 16:10:04 +0100 Subject: [PATCH] feat(build): osx build in CI (#146) also cleanup and separation of test and release workflows --- .github/workflows/main.yml | 206 ---------------------------------- .github/workflows/release.yml | 180 +++++++++++++++++++++++++++++ .github/workflows/test.yml | 97 ++++++++++++++++ 3 files changed, 277 insertions(+), 206 deletions(-) delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 4a681c84..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,206 +0,0 @@ -name: frei0r - -on: - push: - paths-ignore: - - 'doc/**' - - '*.md' - branches: - - master - pull_request: - paths-ignore: - - 'doc/**' - - '*.md' - branches: - - master - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - - # reuse: - # name: 🚨 REUSE Compliance - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: fsfe/reuse-action@v1 - - c-lint: - name: 🚨 C lint - runs-on: ubuntu-latest - if: "!contains(github.event.pull_request.labels.*.name, 'skip-lint')" - steps: - - uses: actions/checkout@v3 - - uses: reviewdog/action-cpplint@master - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - reporter: github-pr-check - targets: --recursive src - level: warning - flags: --linelength=120 # Optional - filter: "-readability/braces\ - ,-readability/casting\ - ,-readability/todo\ - ,-whitespace/comma\ - ,-whitespace/braces\ - ,-whitespace/comments\ - ,-whitespace/indent\ - ,-whitespace/newline\ - ,-whitespace/operators\ - ,-whitespace/parens\ - ,-whitespace/tab\ - ,-whitespace/end_of_line\ - ,-whitespace/line_length\ - ,-whitespace/blank_line\ - ,-whitespace/semicolon\ - ,-build/include_subdir\ - ,-build/include_order\ - " - - test-suite: - name: 🔬 test - needs: [c-lint] - if: "!contains(github.event.pull_request.labels.*.name, 'skip-test')" - strategy: - matrix: - compiler: [clang-14] - fail-fast: false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: install dependencies - run: | - sudo apt-get update -qy - sudo apt-get install --no-install-recommends -y ${{ matrix.compiler }} cmake ninja-build libfreetype-dev libopencv-dev libcairo2-dev libgavl-dev - - name: ${{ matrix.compiler }} initialize cmake build - run: | - mkdir -p build && cd build - cmake -G "Ninja" ../ - - name: ${{ matrix.compiler }} run ninja build - run: | - cd build && ninja - - name: ${{ matrix.compiler }} analyze plugins - run: | - cd test && make - - name: ${{ matrix.compiler }} upload plugin analysis - uses: actions/upload-artifact@v3 - with: - name: release-plugin-analysis - path: test/*.json - - semantic-release: - name: 🤖 Semantic release - runs-on: ubuntu-latest - needs: [test-suite] - if: "!contains(github.event.pull_request.labels.*.name, 'skip-release')" - # if: ${{ github.ref_name == 'master' && github.event_name == 'push' }} - outputs: - release: ${{ steps.tag_release.outputs.release }} - version: ${{ steps.tag_release.outputs.version }} - steps: - - uses: actions/checkout@v3 - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 16.x - - name: Install semantic-release - run: | - npm i npx - npm i semantic-release/changelog - - name: Tag release - id: tag_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - npx semantic-release | tee semantic-release.log - if [[ `git tag --points-at HEAD` == "" ]]; then - echo "release=False" >> $GITHUB_OUTPUT - else - echo "release=True" >> $GITHUB_OUTPUT - awk '/Published release/ { printf("version=v%s\n",$8) }' semantic-release.log >> $GITHUB_OUTPUT - fi - - msvc-build: - name: 💻 msvc build win64 - runs-on: windows-latest - needs: [semantic-release, test-suite, c-lint] - if: ${{ needs.semantic-release.outputs.release == 'True' }} - steps: - - uses: actions/checkout@v3 - - uses: ilammy/msvc-dev-cmd@v1 - - name: choco install deps - uses: crazy-max/ghaction-chocolatey@v2 - with: - args: install libopencv-dev - - name: Build using nmake - run: | - mkdir build && cd build - cmake -G "NMake Makefiles" ../ - nmake - - name: Upload win64 filters - uses: actions/upload-artifact@v3 - with: - name: release-win64-filters - path: build/src/filter/**/*.dll - - name: Upload win64 mixers - uses: actions/upload-artifact@v3 - with: - name: release-win64-mixers - path: build/src/mixer*/**/*.dll - - name: Upload win64 generators - uses: actions/upload-artifact@v3 - with: - name: release-win64-generators - path: build/src/generator/**/*.dll - - draft-binary-release: - name: 📦 Pack release - needs: [semantic-release, msvc-build] - if: ${{ needs.semantic-release.outputs.release == 'True' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: download binary artifacts - uses: actions/download-artifact@v3 - with: - path: | - frei0r-bin - - name: create compressed archives - run: | - cd frei0r-bin - dst=frei0r-filters_${{ needs.semantic-release.outputs.version }}_win64 - mkdir $dst && find release-win64-filters -type f -name '*.dll' -exec cp {} $dst \; - cp ../README.md ../COPYING ../ChangeLog ../AUTHORS $dst - echo "${{ needs.semantic-release.outputs.version }}" > $dst/VERSION - zip -r -9 $dst.zip $dst - dst=frei0r-mixers_${{ needs.semantic-release.outputs.version }}_win64 - mkdir $dst && find release-win64-mixers -type f -name '*.dll' -exec cp {} $dst \; - cp ../README.md ../COPYING ../ChangeLog ../AUTHORS $dst - echo "${{ needs.semantic-release.outputs.version }}" > $dst/VERSION - zip -r -9 $dst.zip $dst - dst=frei0r-generators_${{ needs.semantic-release.outputs.version }}_win64 - mkdir $dst && find release-win64-generators -type f -name '*.dll' -exec cp {} $dst \; - cp ../README.md ../COPYING ../ChangeLog ../AUTHORS $dst - echo "${{ needs.semantic-release.outputs.version }}" > $dst/VERSION - zip -r -9 $dst.zip $dst - sha256sum *.zip > SHA256SUMS.txt - - name: show directory structure - run: tree -dL 3 - - name: release all archives - uses: softprops/action-gh-release@v1 - with: - files: | - frei0r-bin/*.zip - frei0r-bin/SHA256SUMS.txt - frei0r-bin/release-plugin-analysis/*.json - tag_name: ${{ needs.semantic-release.outputs.version }} - draft: true - prerelease: false - fail_on_unmatched_files: true - generate_release_notes: true - - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..6c990bc4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,180 @@ +name: 020-Release + +on: + workflow_run: + workflows: + - 010-Test + types: [completed] + branches: + - master + - release/** + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + semantic-release: + name: 🤖 Semantic release + runs-on: ubuntu-latest + if: "!contains(github.event.pull_request.labels.*.name, 'skip-release')" + # if: ${{ github.ref_name == 'master' && github.event_name == 'push' }} + outputs: + release: ${{ steps.tag_release.outputs.release }} + version: ${{ steps.tag_release.outputs.version }} + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install semantic-release + run: | + npm i npx + npm i semantic-release/changelog + - name: Tag release + id: tag_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npx semantic-release | tee semantic-release.log + if [[ `git tag --points-at HEAD` == "" ]]; then + echo "release=False" >> $GITHUB_OUTPUT + else + echo "release=True" >> $GITHUB_OUTPUT + awk '/Published release/ { printf("version=v%s\n",$8) }' semantic-release.log >> $GITHUB_OUTPUT + fi + + win-build: + name: 💻 win64 build + runs-on: windows-latest + needs: [semantic-release] + if: ${{ needs.semantic-release.outputs.release == 'True' }} + steps: + - uses: actions/checkout@v3 + - uses: ilammy/msvc-dev-cmd@v1 + - name: choco install deps + uses: crazy-max/ghaction-chocolatey@v2 + with: + args: install libopencv-dev + - name: Build using nmake + run: | + mkdir build && cd build + cmake -G "NMake Makefiles" ../ + nmake + - name: Upload win64 filter + uses: actions/upload-artifact@v3 + with: + name: release-win64-filter + path: build/src/filter/**/*.dll + - name: Upload win64 mixer2 + uses: actions/upload-artifact@v3 + with: + name: release-win64-mixer2 + path: build/src/mixer2/**/*.dll + - name: Upload win64 mixer3 + uses: actions/upload-artifact@v3 + with: + name: release-win64-mixer3 + path: build/src/mixer3/**/*.dll + - name: Upload win64 generator + uses: actions/upload-artifact@v3 + with: + name: release-win64-generator + path: build/src/generator/**/*.dll + + osx-build: + name: 💻 osx build + runs-on: macos-latest + needs: [semantic-release] + if: ${{ needs.semantic-release.outputs.release == 'True' }} + steps: + - uses: actions/checkout@v3 + - name: Update Homebrew + run: | + brew update --preinstall + - name: Install Homebrew dependencies + run: | + env HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 \ + brew install cmake ninja cairo + - name: Build using ninja + run: | + mkdir build && cd build + cmake -G "Ninja" ../ + ninja + - name: Upload osx filter + uses: actions/upload-artifact@v3 + with: + name: release-osx-filter + path: build/src/filter/**/*.so + - name: Upload osx mixer2 + uses: actions/upload-artifact@v3 + with: + name: release-osx-mixer2 + path: build/src/mixer2/**/*.so + - name: Upload osx mixer3 + uses: actions/upload-artifact@v3 + with: + name: release-osx-mixer3 + path: build/src/mixer3/**/*.so + - name: Upload osx generator + uses: actions/upload-artifact@v3 + with: + name: release-osx-generator + path: build/src/generator/**/*.so + + draft-binary-release: + name: 📦 Pack release + needs: [semantic-release, win-build, osx-build] + if: ${{ needs.semantic-release.outputs.release == 'True' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: download binary artifacts + uses: actions/download-artifact@v3 + with: + path: | + frei0r-bin + - name: create compressed archives + run: | + dst=frei0r-${{ needs.semantic-release.outputs.version }}_win64 + mkdir -p $dst/filter $dst/generator $dst/mixer2 $dst/mixer3 + find frei0r-bin/release-win64-filter -type f -name '*.dll' -exec cp {} $dst/filter \; + find frei0r-bin/release-win64-generator -type f -name '*.dll' -exec cp {} $dst/generator \; + find frei0r-bin/release-win64-mixer2 -type f -name '*.dll' -exec cp {} $dst/mixer2 \; + find frei0r-bin/release-win64-mixer3 -type f -name '*.dll' -exec cp {} $dst/mixer3 \; + cp README.md $dst/README.txt + cp COPYING $dst/LICENSE.txt + cp ChangeLog $dst/ChangeLog.txt + cp AUTHORS $dst/AUTHORS.txt + cp include/frei0r.h include/frei0r.hpp $dst/ + echo "${{ needs.semantic-release.outputs.version }}" > $dst/VERSION.txt + zip -r -9 $dst.zip $dst + + dst=frei0r-${{ needs.semantic-release.outputs.version }}_osx + mkdir -p $dst/filter $dst/generator $dst/mixer2 $dst/mixer3 + find frei0r-bin/release-osx-filter -type f -name '*.so' -exec cp {} $dst/filter \; + find frei0r-bin/release-osx-generator -type f -name '*.so' -exec cp {} $dst/generator \; + find frei0r-bin/release-osx-mixer2 -type f -name '*.so' -exec cp {} $dst/mixer2 \; + find frei0r-bin/release-osx-mixer3 -type f -name '*.so' -exec cp {} $dst/mixer3 \; + cp README.md $dst/README.txt + cp COPYING $dst/LICENSE.txt + cp ChangeLog $dst/ChangeLog.txt + cp AUTHORS $dst/AUTHORS.txt + cp include/frei0r.h include/frei0r.hpp $dst/ + echo "${{ needs.semantic-release.outputs.version }}" > $dst/VERSION.txt + zip -r -9 $dst.zip $dst + + sha256sum *.zip > SHA256SUMS.txt + + - name: release all archives + uses: softprops/action-gh-release@v1 + with: + files: | + *.zip + SHA256SUMS.txt + tag_name: ${{ needs.semantic-release.outputs.version }} + draft: true + prerelease: false + fail_on_unmatched_files: true + generate_release_notes: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..7c12a9c1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,97 @@ +name: 010-Test + +on: + push: + paths-ignore: + - 'doc/**' + - '*.md' + branches: + - master + - release/** + + pull_request: + paths-ignore: + - 'doc/**' + - '*.md' + branches: + - master + - release/** + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + + # reuse: + # name: 🚨 REUSE Compliance + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: fsfe/reuse-action@v1 + + c-lint: + name: 🚨 C lint + runs-on: ubuntu-latest + if: "!contains(github.event.pull_request.labels.*.name, 'skip-lint')" + steps: + - uses: actions/checkout@v3 + - uses: reviewdog/action-cpplint@master + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-check + targets: --recursive src + level: warning + flags: --linelength=120 # Optional + filter: "-readability/braces\ + ,-readability/casting\ + ,-readability/todo\ + ,-whitespace/comma\ + ,-whitespace/braces\ + ,-whitespace/comments\ + ,-whitespace/indent\ + ,-whitespace/newline\ + ,-whitespace/operators\ + ,-whitespace/parens\ + ,-whitespace/tab\ + ,-whitespace/end_of_line\ + ,-whitespace/line_length\ + ,-whitespace/blank_line\ + ,-whitespace/semicolon\ + ,-build/include_subdir\ + ,-build/include_order\ + " + + test-suite: + name: 🔬 test + needs: [c-lint] + if: "!contains(github.event.pull_request.labels.*.name, 'skip-test')" + strategy: + matrix: + compiler: [clang-14] + fail-fast: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: install dependencies + run: | + sudo apt-get update -qy + sudo apt-get install --no-install-recommends -y ${{ matrix.compiler }} cmake ninja-build libfreetype-dev libopencv-dev libcairo2-dev libgavl-dev + - name: ${{ matrix.compiler }} initialize cmake build + run: | + mkdir -p build && cd build + cmake -G "Ninja" ../ + - name: ${{ matrix.compiler }} run ninja build + run: | + cd build && ninja + - name: ${{ matrix.compiler }} analyze plugins + run: | + cd test && make + - name: ${{ matrix.compiler }} upload plugin analysis + uses: actions/upload-artifact@v3 + with: + name: release-plugin-analysis + path: test/*.json +