From 77e0bbe5658ac88f3a90d75f01b2a2ab478aceda Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Tue, 5 Jan 2021 23:02:07 -0700 Subject: [PATCH 1/9] Add automatic releases to CI for pushes to master --- .github/workflows/ci.yml | 94 +++++++++++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78ba3835f..b2fcadc00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -261,17 +261,43 @@ jobs: run: | lcov --rc lcov_branch_coverage=1 -rc lcov_function_coverage --directory . --capture --no-external --output-file "pcb2gcode-lcov.info" lcov --rc lcov_branch_coverage=1 -rc lcov_function_coverage -r "pcb2gcode-lcov.info" '*_tests.cpp' -o "pcb2gcode-lcov.info" - - name: Export coverage artifact + - name: Upload coverage artifact if: matrix.code_coverage - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: lcov-${{ steps.sanitize-key.outputs.key }} path: pcb2gcode-lcov.info - - name: Export build - uses: actions/upload-artifact@v1 + - name: Prepare build for upload + run: | + mkdir pcb2gcode-$(./pcb2gcode --version | head -1) + mkdir pcb2gcode-$(./pcb2gcode --version | head -1)/.libs + cp ./pcb2gcode pcb2gcode-$(./pcb2gcode --version | head -1) + if [[ -e ~/.local/lib/libgerbv.so.1 ]]; then + cp -L ~/.local/lib/libgerbv.so.1 pcb2gcode-$(./pcb2gcode --version | head -1)/.libs; + fi + if [[ -e ~/.local/lib/libgeos-3.8.1.so ]]; then + cp -L ~/.local/lib/libgeos-3.8.1.so pcb2gcode-$(./pcb2gcode --version | head -1)/.libs; + fi + + cat > pcb2gcode-$(./pcb2gcode --version | head -1)/pcb2gcode.sh << EOF + #!/bin/bash + + if [[ \$EUID > 0 ]]; then MAYBE_SUDO=sudo; fi + + export DEBIAN_FRONTEND=noninteractive + \$MAYBE_SUDO apt-get update -y + \$MAYBE_SUDO apt-get install -y libglib2.0-bin + \$MAYBE_SUDO apt-get install -y libgtkmm-2.4-1v5 + LD_LIBRARY_PATH=\$PWD/.libs:\$LD_LIBRARY_PATH ./pcb2gcode "\$@" + EOF + + chmod a+x pcb2gcode-$(./pcb2gcode --version | head -1)/pcb2gcode.sh + tar cvf pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar pcb2gcode-$(./pcb2gcode --version | head -1) + - name: Upload build + uses: actions/upload-artifact@v2 with: name: pcb2gcode-${{ steps.sanitize-key.outputs.key }} - path: pcb2gcode + path: pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar - name: Upload coverage to coveralls if: matrix.code_coverage uses: coverallsapp/github-action@master @@ -279,7 +305,16 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: pcb2gcode-lcov.info parallel: true - + - name: Save version number + if: matrix.code_coverage + run: echo "$(./pcb2gcode --version | head -1)" > version.txt + - name: Upload version artifact + if: matrix.code_coverage + uses: actions/upload-artifact@v2 + with: + name: version + path: version.txt + build-and-test-windows: name: ${{ matrix.os }}_${{ matrix.boost }}_${{ matrix.compiler }}_${{ matrix.geos }} strategy: @@ -419,10 +454,10 @@ jobs: echo "Finished on {}"; popd' popd - - name: Prepare for export + - name: Prepare build for upload run: | - mkdir bin - pushd bin + mkdir pcb2gcode-$(./pcb2gcode --version | head -1) + pushd pcb2gcode-$(./pcb2gcode --version | head -1) cp ../pcb2gcode.exe . mkdir .libs pushd .libs @@ -466,13 +501,14 @@ jobs: cp /mingw64/bin/zlib1.dll . popd popd + tar cvf pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar pcb2gcode-$(./pcb2gcode --version | head -1) env: GEOS: ${{ matrix.geos }} - - name: Export build - uses: actions/upload-artifact@v1 + - name: Upload build + uses: actions/upload-artifact@v2 with: name: pcb2gcode-${{ steps.sanitize-key.outputs.key }} - path: bin + path: pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar finalize-coverage: needs: [build-and-test, build-and-test-windows] name: Finalize coverage @@ -487,3 +523,37 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true + release: + needs: [build-and-test, build-and-test-windows] + name: release + runs-on: ubuntu-latest + steps: + - name: Download the artifacts to release + uses: actions/download-artifact@v2 + - run: echo "PCB2GCODE_VERSION=$(cat version/version.txt)" >> $GITHUB_ENV + - name: Prepare the artifacts + run: | + mkdir -p pcb2gcode-{windows,ubuntu,macos} + + mv pcb2gcode-windows_1_75_gplusplus_3.8.1/pcb2gcode-windows_1_75_gplusplus_3.8.1.tar pcb2gcode-windows/pcb2gcode-windows-${PCB2GCODE_VERSION}.tar + + pushd pcb2gcode-windows + tar xvf pcb2gcode-windows-${PCB2GCODE_VERSION}.tar + zip -r pcb2gcode-windows-${PCB2GCODE_VERSION}.zip pcb2gcode-${PCB2GCODE_VERSION} + popd + + mv pcb2gcode-ubuntu_1_66_gplusplus_3.8.1/pcb2gcode-ubuntu_1_66_gplusplus_3.8.1.tar pcb2gcode-ubuntu/pcb2gcode-ubuntu-${PCB2GCODE_VERSION}.tar + gzip pcb2gcode-ubuntu/pcb2gcode-ubuntu-${PCB2GCODE_VERSION}.tar + + mv pcb2gcode-macos_1_75_gplusplus_3.8.1/pcb2gcode-macos_1_75_gplusplus_3.8.1.tar pcb2gcode-macos/pcb2gcode-macos-${PCB2GCODE_VERSION}.tar + gzip pcb2gcode-macos/pcb2gcode-macos-${PCB2GCODE_VERSION}.tar + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + title: "Development Build" + files: | + pcb2gcode-windows/pcb2gcode-windows-${{ env.PCB2GCODE_VERSION }}.zip + pcb2gcode-ubuntu/pcb2gcode-ubuntu-${{ env.PCB2GCODE_VERSION }}.tar.gz + pcb2gcode-macos/pcb2gcode-macos-${{ env.PCB2GCODE_VERSION }}.tar.gz From 592d0e6c9a1132b083d8bf7c4572e249d4a38952 Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Wed, 6 Jan 2021 10:13:48 -0700 Subject: [PATCH 2/9] zip before exporting the artifacts --- .github/workflows/ci.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2fcadc00..382897b49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: push: branches: - master + - auto_release schedule: - cron: '5 4 * * 1' @@ -293,11 +294,12 @@ jobs: chmod a+x pcb2gcode-$(./pcb2gcode --version | head -1)/pcb2gcode.sh tar cvf pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar pcb2gcode-$(./pcb2gcode --version | head -1) + gzip pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar - name: Upload build uses: actions/upload-artifact@v2 with: name: pcb2gcode-${{ steps.sanitize-key.outputs.key }} - path: pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar + path: pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar.gz - name: Upload coverage to coveralls if: matrix.code_coverage uses: coverallsapp/github-action@master @@ -501,14 +503,14 @@ jobs: cp /mingw64/bin/zlib1.dll . popd popd - tar cvf pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar pcb2gcode-$(./pcb2gcode --version | head -1) + zip -r pcb2gcode-${{ steps.sanitize-key.outputs.key }}.zip pcb2gcode-$(./pcb2gcode --version | head -1) env: GEOS: ${{ matrix.geos }} - name: Upload build uses: actions/upload-artifact@v2 with: name: pcb2gcode-${{ steps.sanitize-key.outputs.key }} - path: pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar + path: pcb2gcode-${{ steps.sanitize-key.outputs.key }}.zip finalize-coverage: needs: [build-and-test, build-and-test-windows] name: Finalize coverage @@ -535,18 +537,11 @@ jobs: run: | mkdir -p pcb2gcode-{windows,ubuntu,macos} - mv pcb2gcode-windows_1_75_gplusplus_3.8.1/pcb2gcode-windows_1_75_gplusplus_3.8.1.tar pcb2gcode-windows/pcb2gcode-windows-${PCB2GCODE_VERSION}.tar - - pushd pcb2gcode-windows - tar xvf pcb2gcode-windows-${PCB2GCODE_VERSION}.tar - zip -r pcb2gcode-windows-${PCB2GCODE_VERSION}.zip pcb2gcode-${PCB2GCODE_VERSION} - popd + mv pcb2gcode-windows_1_75_gplusplus_3.8.1/pcb2gcode-windows_1_75_gplusplus_3.8.1.zip pcb2gcode-windows/pcb2gcode-windows-${PCB2GCODE_VERSION}.zip - mv pcb2gcode-ubuntu_1_66_gplusplus_3.8.1/pcb2gcode-ubuntu_1_66_gplusplus_3.8.1.tar pcb2gcode-ubuntu/pcb2gcode-ubuntu-${PCB2GCODE_VERSION}.tar - gzip pcb2gcode-ubuntu/pcb2gcode-ubuntu-${PCB2GCODE_VERSION}.tar + mv pcb2gcode-ubuntu_1_66_gplusplus_3.8.1/pcb2gcode-ubuntu_1_66_gplusplus_3.8.1.tar.gz pcb2gcode-ubuntu/pcb2gcode-ubuntu-${PCB2GCODE_VERSION}.tar.gz - mv pcb2gcode-macos_1_75_gplusplus_3.8.1/pcb2gcode-macos_1_75_gplusplus_3.8.1.tar pcb2gcode-macos/pcb2gcode-macos-${PCB2GCODE_VERSION}.tar - gzip pcb2gcode-macos/pcb2gcode-macos-${PCB2GCODE_VERSION}.tar + mv pcb2gcode-macos_1_75_gplusplus_3.8.1/pcb2gcode-macos_1_75_gplusplus_3.8.1.tar.gz pcb2gcode-macos/pcb2gcode-macos-${PCB2GCODE_VERSION}.tar.gz - uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" From d45118409191e68308cddbbbbeb511c9fd860aa4 Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Wed, 6 Jan 2021 10:31:02 -0700 Subject: [PATCH 3/9] add zip to mingw i hope --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 382897b49..cf289e362 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -341,7 +341,7 @@ jobs: with: msystem: MINGW64 update: true - install: mingw-w64-x86_64-gtkmm git base-devel bash mingw-w64-x86_64-gcc mingw-w64-x86_64-boost mingw-w64-x86_64-cairo + install: mingw-w64-x86_64-gtkmm git base-devel bash mingw-w64-x86_64-gcc mingw-w64-x86_64-boost mingw-w64-x86_64-cairo mingw-w64-x86_64-libzip - name: Setup paths and env run: | mkdir -p ${LOCAL_INSTALL_PATH}/bin From b7bfeacb8e03e4011322926446dc1a266555c54f Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Wed, 6 Jan 2021 10:31:35 -0700 Subject: [PATCH 4/9] remove examples for now --- .github/workflows/ci.yml | 64 ++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf289e362..38fb2c85e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -217,24 +217,24 @@ jobs: run: sed -i 's/-g /-g0 /g' Makefile - name: Make pcb2gcode run: make -j ${NUM_CPUS} - - name: Run examples - if: '! matrix.code_coverage' - run: | - pushd testing/gerbv_example - ls | parallel -k -j ${NUM_CPUS} --halt soon,fail=1 ' - pushd {}; - echo "Running on {}"; - if [[ -f "no-valgrind" ]]; then - cat no-valgrind; - fi; - if [[ -f "no-valgrind" || "${{ matrix.os }}" != "ubuntu" ]]; then - time ../../../pcb2gcode || exit; - else - time valgrind --error-exitcode=127 --errors-for-leak-kinds=definite --leak-check=full -- ../../../pcb2gcode || exit; - fi; - echo "Finished on {}"; - popd' - popd + #- name: Run examples + # if: '! matrix.code_coverage' + # run: | + # pushd testing/gerbv_example + # ls | parallel -k -j ${NUM_CPUS} --halt soon,fail=1 ' + # pushd {}; + # echo "Running on {}"; + # if [[ -f "no-valgrind" ]]; then + # cat no-valgrind; + # fi; + # if [[ -f "no-valgrind" || "${{ matrix.os }}" != "ubuntu" ]]; then + # time ../../../pcb2gcode || exit; + # else + # time valgrind --error-exitcode=127 --errors-for-leak-kinds=definite --leak-check=full -- ../../../pcb2gcode || exit; + # fi; + # echo "Finished on {}"; + # popd' + # popd - name: Reset coverage if: matrix.code_coverage continue-on-error: true @@ -442,20 +442,20 @@ jobs: || (cat config.log && false) - name: Make pcb2gcode run: make -j ${NUM_CPUS} - - name: Run examples - if: '! matrix.code_coverage' - run: | - pushd testing/gerbv_example - ls | parallel -k -j ${NUM_CPUS} --halt soon,fail=1 ' - pushd {}; - echo "Running on {}"; - if [[ -f "no-valgrind" ]]; then - cat no-valgrind; - fi; - time ../../../pcb2gcode || exit; - echo "Finished on {}"; - popd' - popd + #- name: Run examples + # if: '! matrix.code_coverage' + # run: | + # pushd testing/gerbv_example + # ls | parallel -k -j ${NUM_CPUS} --halt soon,fail=1 ' + # pushd {}; + # echo "Running on {}"; + # if [[ -f "no-valgrind" ]]; then + # cat no-valgrind; + # fi; + # time ../../../pcb2gcode || exit; + # echo "Finished on {}"; + # popd' + # popd - name: Prepare build for upload run: | mkdir pcb2gcode-$(./pcb2gcode --version | head -1) From ebb3f4e4edf0eeb346ccff4601f6db0d41c06642 Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Wed, 6 Jan 2021 11:11:47 -0700 Subject: [PATCH 5/9] gzip before release step but zip after --- .github/workflows/ci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38fb2c85e..f1e9243a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -341,7 +341,7 @@ jobs: with: msystem: MINGW64 update: true - install: mingw-w64-x86_64-gtkmm git base-devel bash mingw-w64-x86_64-gcc mingw-w64-x86_64-boost mingw-w64-x86_64-cairo mingw-w64-x86_64-libzip + install: mingw-w64-x86_64-gtkmm git base-devel bash mingw-w64-x86_64-gcc mingw-w64-x86_64-boost mingw-w64-x86_64-cairo - name: Setup paths and env run: | mkdir -p ${LOCAL_INSTALL_PATH}/bin @@ -503,14 +503,14 @@ jobs: cp /mingw64/bin/zlib1.dll . popd popd - zip -r pcb2gcode-${{ steps.sanitize-key.outputs.key }}.zip pcb2gcode-$(./pcb2gcode --version | head -1) + tar cvf pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar pcb2gcode-$(./pcb2gcode --version | head -1) env: GEOS: ${{ matrix.geos }} - name: Upload build uses: actions/upload-artifact@v2 with: name: pcb2gcode-${{ steps.sanitize-key.outputs.key }} - path: pcb2gcode-${{ steps.sanitize-key.outputs.key }}.zip + path: pcb2gcode-${{ steps.sanitize-key.outputs.key }}.tar finalize-coverage: needs: [build-and-test, build-and-test-windows] name: Finalize coverage @@ -537,7 +537,11 @@ jobs: run: | mkdir -p pcb2gcode-{windows,ubuntu,macos} - mv pcb2gcode-windows_1_75_gplusplus_3.8.1/pcb2gcode-windows_1_75_gplusplus_3.8.1.zip pcb2gcode-windows/pcb2gcode-windows-${PCB2GCODE_VERSION}.zip + mv pcb2gcode-windows_1_75_gplusplus_3.8.1/pcb2gcode-windows_1_75_gplusplus_3.8.1.tar pcb2gcode-windows/pcb2gcode-windows-${PCB2GCODE_VERSION}.tar + pushd pcb2gcode-windows + tar xvf pcb2gcode-windows-${PCB2GCODE_VERSION}.tar + zip -r pcb2gcode-windows-${PCB2GCODE_VERSION}.zip pcb2gcode-${PCB2GCODE_VERSION} + popd mv pcb2gcode-ubuntu_1_66_gplusplus_3.8.1/pcb2gcode-ubuntu_1_66_gplusplus_3.8.1.tar.gz pcb2gcode-ubuntu/pcb2gcode-ubuntu-${PCB2GCODE_VERSION}.tar.gz From 52230b8d7b4354c1d81dd87178fbb458da961099 Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Wed, 6 Jan 2021 11:38:17 -0700 Subject: [PATCH 6/9] print out the tojson of github --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1e9243a2..ea2171329 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,9 @@ jobs: echo "PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + echo $GITHUB_JSON + env: + GITHUB_JSON: ${{ toJSON(github) }} - name: Ubuntu specific setup if: matrix.os == 'ubuntu' run: | From d96791320982bbef389d519d2084a8aa29a8e2a3 Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Wed, 6 Jan 2021 12:00:22 -0700 Subject: [PATCH 7/9] filter by push and ref --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea2171329..ce8b5b1de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,8 @@ on: branches: - master - auto_release + tags: + - "v*" schedule: - cron: '5 4 * * 1' @@ -529,6 +531,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true release: + if: ${{ github.event_name == "push" && github.ref == "refs/head/master" }} needs: [build-and-test, build-and-test-windows] name: release runs-on: ubuntu-latest From b9c60fe476ce0069aaab6e494ace49335ee083b2 Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Wed, 6 Jan 2021 12:03:26 -0700 Subject: [PATCH 8/9] filter by push and ref --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce8b5b1de..a95ff5c5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -531,7 +531,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true release: - if: ${{ github.event_name == "push" && github.ref == "refs/head/master" }} + if: github.event_name == "push" && github.ref == "refs/head/master" needs: [build-and-test, build-and-test-windows] name: release runs-on: ubuntu-latest From 187b4cdb7f7e766f4295cfbcbaf5cf255001a4ab Mon Sep 17 00:00:00 2001 From: eyal0 <109809+eyal0@users.noreply.github.com> Date: Wed, 6 Jan 2021 12:04:34 -0700 Subject: [PATCH 9/9] filter by push and ref --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a95ff5c5b..420a29a73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -531,7 +531,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true release: - if: github.event_name == "push" && github.ref == "refs/head/master" + if: github.event_name == 'push' && github.ref == 'refs/head/master' needs: [build-and-test, build-and-test-windows] name: release runs-on: ubuntu-latest