|
| 1 | +name: Remote Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + fullName: |
| 11 | + description: The full name of the release |
| 12 | + default: Adept 3.0 |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + shortVersion: |
| 16 | + description: The short version number |
| 17 | + default: "3.0" |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + longVersion: |
| 21 | + description: The long version number |
| 22 | + default: "3.0.0" |
| 23 | + required: true |
| 24 | + type: string |
| 25 | + alternativeBinaryName: |
| 26 | + description: The alternative binary name |
| 27 | + default: "adept3-0" |
| 28 | + required: true |
| 29 | + type: string |
| 30 | + |
| 31 | +env: |
| 32 | + BUILD_TYPE: Release |
| 33 | + IS_GITHUB_WORKFLOW: On |
| 34 | + |
| 35 | +jobs: |
| 36 | + build: |
| 37 | + runs-on: ${{matrix.os}} |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + os: [windows-latest, macos-latest, ubuntu-latest] |
| 42 | + defaults: |
| 43 | + run: |
| 44 | + working-directory: ${{github.workspace}} |
| 45 | + name: ${{ format('Build / {0}', matrix.os) }} |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v3 |
| 48 | + - name: Configure to use MinGW-w64 (Windows) |
| 49 | + if: matrix.os == 'windows-latest' |
| 50 | + shell: bash |
| 51 | + run: | |
| 52 | + export CC=x86_64-w64-mingw32-gcc |
| 53 | + export CXX=x86_64-w64-mingw32-g++ |
| 54 | + - name: Download and extract prebuilt LLVM (Windows) |
| 55 | + if: ${{ matrix.os == 'windows-latest' }} |
| 56 | + shell: bash |
| 57 | + run: | |
| 58 | + pacman -S mingw-w64-x86_64-gcc --no-confirm |
| 59 | + pacman -S mingw-w64-x86_64-llvm --no-confirm |
| 60 | + - name: Download static zlib libraries (Windows) |
| 61 | + if: ${{ matrix.os == 'windows-latest' }} |
| 62 | + run: | |
| 63 | + C:\msys64\usr\bin\pacman -S mingw-w64-x86_64-zlib --noconfirm |
| 64 | + - name: Download zstd library (Windows) |
| 65 | + if: ${{ matrix.os == 'windows-latest' }} |
| 66 | + run: | |
| 67 | + C:\msys64\usr\bin\pacman -S mingw-w64-x86_64-zstd --noconfirm |
| 68 | + - name: Install LLVM and dependencies (macOS) |
| 69 | + if: ${{ matrix.os == 'macos-latest' }} |
| 70 | + run: | |
| 71 | + brew install llvm@18 |
| 72 | + brew install zstd |
| 73 | + - name: Install LLVM and dependencies (Ubuntu) |
| 74 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 75 | + run: | |
| 76 | + sudo apt-get update |
| 77 | + sudo apt-get remove -y llvm-13 |
| 78 | + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" |
| 79 | + brew install llvm@18 |
| 80 | + brew install zstd |
| 81 | + - name: Build (Windows) |
| 82 | + if: ${{ matrix.os == 'windows-latest' }} |
| 83 | + run: | |
| 84 | + cargo build --release |
| 85 | + env: |
| 86 | + CFLAGS: -static-libstdc++ |
| 87 | + CXXFLAGS: -static-libstdc++ |
| 88 | + LLVM_SYS_181_PREFIX: C:\msys64\mingw64 |
| 89 | + zstd_DIR: C:\msys64\mingw64 |
| 90 | + zstd_LIBRARY: C:\msys64\mingw64\lib\libzstd.a |
| 91 | + ZLIB_INCLUDE_DIR: C:\msys64\mingw64\include |
| 92 | + ZLIB_LIBRARY: C:\msys64\mingw64\lib\libz.a |
| 93 | + - name: Build (macOS) |
| 94 | + env: |
| 95 | + CC: /opt/homebrew/opt/llvm/bin/clang |
| 96 | + LLVM_SYS_181_PREFIX: /opt/homebrew/opt/llvm |
| 97 | + zstd_DIR: /usr/local/opt/zstd |
| 98 | + CFLAGS: -static-libstdc++ |
| 99 | + CXXFLAGS: -static-libstdc++ |
| 100 | + LDFLAGS: /opt/homebrew/opt/llvm/lib/libunwind.a |
| 101 | + - name: Build (Linux) |
| 102 | + if: ${{ matrix.os == 'linux-latest' }} |
| 103 | + run: | |
| 104 | + cargo build --release |
| 105 | + env: |
| 106 | + LLVM_SYS_181_PREFIX: /home/linuxbrew/.linuxbrew/opt/llvm@18 |
| 107 | + zstd_DIR: /home/linuxbrew/.linuxbrew/opt/zstd |
| 108 | + - name: Archive Build Result |
| 109 | + if: ${{ matrix.os == 'windows-latest' }} |
| 110 | + |
| 111 | + with: |
| 112 | + command: c |
| 113 | + files: target/release/adept.exe |
| 114 | + outPath: build-${{ matrix.os }}.tar.gz |
| 115 | + - name: Archive Build Result |
| 116 | + if: ${{ matrix.os != 'windows-latest' }} |
| 117 | + |
| 118 | + with: |
| 119 | + command: c |
| 120 | + files: target/release/adept |
| 121 | + outPath: build-${{ matrix.os }}.tar.gz |
| 122 | + - name: Upload Build Artifact |
| 123 | + uses: actions/upload-artifact@v3 |
| 124 | + with: |
| 125 | + name: build-${{ matrix.os }}-archive |
| 126 | + path: build-${{ matrix.os }}.tar.gz |
| 127 | + test: |
| 128 | + needs: build |
| 129 | + runs-on: ${{ matrix.os }} |
| 130 | + strategy: |
| 131 | + fail-fast: false |
| 132 | + matrix: |
| 133 | + os: [windows-latest, macos-latest, ubuntu-latest] |
| 134 | + name: ${{ format('Test / {0}', matrix.os) }} |
| 135 | + steps: |
| 136 | + - name: Download Build Artifact |
| 137 | + uses: actions/download-artifact@v3 |
| 138 | + with: |
| 139 | + name: build-${{ matrix.os }}-archive |
| 140 | + - name: Unpack Build Artifact |
| 141 | + |
| 142 | + with: |
| 143 | + command: x |
| 144 | + files: build-${{ matrix.os }}.tar.gz |
| 145 | + deploy: |
| 146 | + name: Deploy |
| 147 | + needs: [test] |
| 148 | + runs-on: ubuntu-latest |
| 149 | + if: ${{ github.event_name == 'push' }} |
| 150 | + steps: |
| 151 | + - name: Get workflow dispatch inputs (workflow dispatch) |
| 152 | + if: github.event_name == 'workflow_dispatch' |
| 153 | + shell: bash |
| 154 | + run: | |
| 155 | + echo 'fullName=${{github.event.inputs.fullName}}' >> $GITHUB_ENV |
| 156 | + echo 'shortVersion=${{github.event.inputs.shortVersion}}' >> $GITHUB_ENV |
| 157 | + echo 'longVersion=${{github.event.inputs.longVersion}}' >> $GITHUB_ENV |
| 158 | + echo 'alternativeBinaryName=${{github.event.inputs.alternativeBinaryName}}' >> $GITHUB_ENV |
| 159 | + echo 'releaseName=${{github.event.inputs.fullName}}' >> $GITHUB_ENV |
| 160 | + echo 'releaseTagName=v${{github.event.inputs.shortVersion}}' >> $GITHUB_ENV |
| 161 | + - name: Get default inputs (push / pr) |
| 162 | + if: github.event_name != 'workflow_dispatch' |
| 163 | + shell: bash |
| 164 | + run: | |
| 165 | + echo 'fullName=Adept Nightly' >> $GITHUB_ENV |
| 166 | + echo 'shortVersion=nightly' >> $GITHUB_ENV |
| 167 | + echo 'longVersion=nightly' >> $GITHUB_ENV |
| 168 | + echo 'alternativeBinaryName=adept-nightly' >> $GITHUB_ENV |
| 169 | + echo 'releaseName=Nightly' >> $GITHUB_ENV |
| 170 | + echo 'releaseTagName=Nightly' >> $GITHUB_ENV |
| 171 | + - name: Download Build Artifact (windows-latest) |
| 172 | + uses: actions/download-artifact@v3 |
| 173 | + with: |
| 174 | + name: build-windows-latest-archive |
| 175 | + - name: Download Build Artifact (macos-latest) |
| 176 | + uses: actions/download-artifact@v3 |
| 177 | + with: |
| 178 | + name: build-macos-latest-archive |
| 179 | + - name: Download Build Artifact (ubuntu-latest) |
| 180 | + uses: actions/download-artifact@v3 |
| 181 | + with: |
| 182 | + name: build-ubuntu-latest-archive |
| 183 | + - name: Get current date |
| 184 | + id: date |
| 185 | + run: echo "::set-output name=date::$(date '+%B %d %Y at %l:%M %p %Z')" |
| 186 | + - name: Release |
| 187 | + uses: IsaacShelton/[email protected] |
| 188 | + with: |
| 189 | + token: ${{secrets.GITHUB_TOKEN}} |
| 190 | + release: ${{env.releaseName}} |
| 191 | + body: ${{ format('Last built on {0} - {1}', steps.date.outputs.date, github.sha) }} |
| 192 | + tag: ${{env.releaseTagName}} |
| 193 | + replace: true |
| 194 | + files: > |
| 195 | + build-windows-latest.tar.gz |
| 196 | + build-macos-latest.tar.gz |
| 197 | + build-linux-latest.tar.gz |
0 commit comments