From 49fd3ae28a4957469d4b843bf1e569b0446b2b81 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 4 Apr 2024 20:13:21 +0100 Subject: [PATCH] Add reusable action for Windows installer --- .github/actions/windows-installer/action.yml | 57 ++++++++++++++++++++ .github/workflows/build-test.yml | 46 +--------------- .github/workflows/release-packages.yml | 13 +++++ 3 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 .github/actions/windows-installer/action.yml diff --git a/.github/actions/windows-installer/action.yml b/.github/actions/windows-installer/action.yml new file mode 100644 index 00000000..5d0cc004 --- /dev/null +++ b/.github/actions/windows-installer/action.yml @@ -0,0 +1,57 @@ +runs: + using: "composite" + steps: + - uses: msys2/setup-msys2@v2 + with: + msystem: clang64 + install: >- + base-devel + mingw-w64-clang-x86_64-llvm + mingw-w64-clang-x86_64-check + mingw-w64-clang-x86_64-ncurses + mingw-w64-clang-x86_64-libffi + mingw-w64-clang-x86_64-pkgconf + mingw-w64-clang-x86_64-tcl + mingw-w64-clang-x86_64-zstd + mingw-w64-clang-x86_64-clang + mingw-w64-clang-x86_64-nodejs + unzip + git + autoconf + automake-wrapper + - name: Generate configure script + shell: msys2 {0} + run: bash autogen.sh + - name: Configure + shell: msys2 {0} + run: | + echo $PATH + export PATH=$PATH:/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.14/bin + mkdir build + cd build + bash ../configure --enable-static-llvm --enable-tcl \ + --enable-verilog --enable-gui CFLAGS="-O2" \ + --prefix=`pwd`/installdir --without-system-cc + - name: Build + shell: msys2 {0} + working-directory: ./build + run: | + make + - name: Install + shell: msys2 {0} + working-directory: ./build + run: | + make install + - name: Build MSI installer + working-directory: ./build + shell: msys2 {0} + run: | + export PATH=$PATH:/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.14/bin + which candle + make V=1 msi-installer + echo "MSI=$(ls *.msi)" >> $GITHUB_ENV + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: 'Windows installer' + path: build/${{ env.MSI }} diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 4e554e95..7859de97 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -468,7 +468,7 @@ jobs: make -C cocotb/tests SIM=nvc TOPLEVEL_LANG=vhdl msi-installer: - name: Windows MSI installer + name: Windows installer runs-on: windows-2019 defaults: run: @@ -477,47 +477,5 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: msys2/setup-msys2@v2 - with: - msystem: clang64 - install: >- - base-devel - mingw-w64-clang-x86_64-llvm - mingw-w64-clang-x86_64-check - mingw-w64-clang-x86_64-ncurses - mingw-w64-clang-x86_64-libffi - mingw-w64-clang-x86_64-pkgconf - mingw-w64-clang-x86_64-tcl - mingw-w64-clang-x86_64-zstd - mingw-w64-clang-x86_64-clang - mingw-w64-clang-x86_64-nodejs - unzip - git - autoconf - automake-wrapper - - name: Generate configure script - run: bash autogen.sh - - name: Configure - run: | - echo $PATH - export PATH=$PATH:/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.14/bin - mkdir build - cd build - bash ../configure --enable-static-llvm --enable-tcl \ - --enable-verilog --enable-gui CFLAGS="-O2" \ - --prefix=`pwd`/installdir --without-system-cc - - name: Build - run: make -C build - - name: Install - run: make -C build install - name: Build MSI installer - run: | - export PATH=$PATH:/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.14/bin - which candle - make -C build V=1 msi-installer - echo "MSI=$(ls build/*.msi)" >> $GITHUB_ENV - - name: 'Upload artifact' - uses: actions/upload-artifact@v4 - with: - name: 'Windows installer' - path: ${{ env.MSI }} + uses: ./.github/actions/windows-installer diff --git a/.github/workflows/release-packages.yml b/.github/workflows/release-packages.yml index 00f5704e..b435e520 100644 --- a/.github/workflows/release-packages.yml +++ b/.github/workflows/release-packages.yml @@ -83,3 +83,16 @@ jobs: with: name: '${{matrix.os}} package' path: nvc_${{ env.VERSION }}-1_amd64_${{ matrix.os }}.deb + + msi-installer: + name: Windows installer + runs-on: windows-2019 + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build MSI installer + uses: ./.github/actions/windows-installer -- 2.39.2