33 pull_request :
44 push :
55 tags :
6- - ' v* '
6+ - " v* "
77 paths-ignore :
8- - ' **/CHANGELOG.md'
9- - ' **/package.json'
8+ - " **/CHANGELOG.md"
9+ - " **/package.json"
10+ - " **/Cargo.toml"
11+ - " **/Cargo.lock"
1012 branches :
1113 - main
1214 - develop
2931 steps :
3032 - name : Checkout repository
3133 uses : actions/checkout@v2
32-
34+
3335 - name : Install Rust toolchain
3436 uses : actions-rs/toolchain@v1
3537 with :
5153 run : cargo install cargo-audit
5254
5355 - name : Run audit
54- run : cargo audit
56+ run : cargo audit --ignore RUSTSEC-2021-0076
5557
5658 - name : Run rustfmt
5759 run : cargo fmt --all -- --check
@@ -179,6 +181,10 @@ jobs:
179181 profile : minimal
180182 override : true
181183
184+ - name : Install wix (Windows)
185+ if : matrix.os == 'windows-latest'
186+ run : cargo install cargo-wix
187+
182188 - if : matrix.os != 'windows-latest'
183189 run : sudo chown -R $(whoami):$(id -ng) ~/.cargo/
184190
@@ -210,19 +216,73 @@ jobs:
210216 # CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: ${{ matrix.cc }}
211217 # CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: ${{ matrix.cc }}
212218
219+ - name : Code sign bin (Windows)
220+ if : matrix.os == 'windows-latest'
221+ run : |
222+ $certificate_file_name = "${env:TEMP}\certificate.pfx"
223+
224+ $bytes_cert = [Convert]::FromBase64String('${{ secrets.WINDOWS_CODE_SIGNING_CERTIFICATE }}')
225+ [IO.File]::WriteAllBytes(${certificate_file_name}, ${bytes_cert})
226+
227+ $signtool_path = ((Resolve-Path -Path "${env:ProgramFiles(x86)}/Windows Kits/10/bin/10*/x86").Path[-1]) + "/signtool.exe"
228+ $bin_path = (Resolve-Path -Path "target/${{ matrix.target }}/release/*.exe").Path
229+ & ${signtool_path} sign `
230+ /d "Clarinet is a clarity runtime packaged as a command line tool, designed to facilitate smart contract understanding, development, testing and deployment." `
231+ /du "https://github.com/hirosystems/clarinet" `
232+ /tr http://timestamp.digicert.com `
233+ /td sha256 `
234+ /fd sha256 `
235+ -f "${certificate_file_name}" `
236+ -p "${{ secrets.WINDOWS_CODE_SIGNING_PASSWORD }}" `
237+ "${bin_path}"
238+
239+ - name : Build Installer (Windows)
240+ if : matrix.os == 'windows-latest'
241+ run : cargo wix -v --no-build --nocapture
242+
243+ - name : Code sign installer (Windows)
244+ if : matrix.os == 'windows-latest'
245+ run : |
246+ $certificate_file_name = "${env:TEMP}\certificate.pfx"
247+
248+ $bytes_cert = [Convert]::FromBase64String('${{ secrets.WINDOWS_CODE_SIGNING_CERTIFICATE }}')
249+ [IO.File]::WriteAllBytes(${certificate_file_name}, ${bytes_cert})
250+
251+ $signtool_path = ((Resolve-Path -Path "${env:ProgramFiles(x86)}/Windows Kits/10/bin/10*/x86").Path[-1]) + "/signtool.exe"
252+ $msi_path = (Resolve-Path -Path "target/wix/*.msi").Path
253+ & ${signtool_path} sign `
254+ /d "Clarinet is a clarity runtime packaged as a command line tool, designed to facilitate smart contract understanding, development, testing and deployment." `
255+ /du "https://github.com/hirosystems/clarinet" `
256+ /tr http://timestamp.digicert.com `
257+ /td sha256 `
258+ /fd sha256 `
259+ -f "${certificate_file_name}" `
260+ -p "${{ secrets.WINDOWS_CODE_SIGNING_PASSWORD }}" `
261+ "${msi_path}"
262+
263+ # Don't compress for Windows because winget can't yet unzip files
213264 - name : Compress artifact (Not Windows)
214265 if : matrix.os != 'windows-latest'
215- run : zip --junk-paths ${{ matrix.platform }} ./target/${{ matrix.target }}/release/clarinet
266+ run : zip --junk-paths clarinet- ${{ matrix.platform }} ./target/${{ matrix.target }}/release/clarinet
216267
217- - name : Compress artifact (Windows)
268+ - name : Rename artifact (Windows)
218269 if : matrix.os == 'windows-latest'
219- run : Compress-Archive -Path ./ target/${{ matrix.target }}/release/clarinet.exe -DestinationPath ${{ matrix.platform }}
270+ run : mv target/wix/*.msi clarinet- ${{ matrix.platform }}.msi
220271
221- - name : Upload artifact
272+ # Separate uploads to prevent paths from being preserved
273+ - name : Upload artifact (Not Windows)
274+ if : matrix.os != 'windows-latest'
222275 uses : actions/upload-artifact@v2
223276 with :
224- name : ${{ matrix.platform }}
225- path : ${{ matrix.platform }}.zip
277+ name : clarinet-${{ matrix.platform }}
278+ path : clarinet-${{ matrix.platform }}.zip
279+
280+ - name : Upload artifact (Windows)
281+ if : matrix.os == 'windows-latest'
282+ uses : actions/upload-artifact@v2
283+ with :
284+ name : clarinet-${{ matrix.platform }}
285+ path : clarinet-${{ matrix.platform }}.msi
226286
227287 - name : Unit Tests
228288 run : cargo test --release --locked --target ${{ matrix.target }}
@@ -234,20 +294,27 @@ jobs:
234294 ./target/${{ matrix.target }}/release/clarinet test --manifest-path examples/${testdir}/Clarinet.toml
235295 done
236296
237- # - name: Functional Tests (Windows)
238- # if: matrix.os == 'windows-latest'
239- # run: |
240- # foreach($testdir in Get-ChildItem examples) {
241- # ./target/${{ matrix.target }}/release/clarinet test --manifest-path examples/${testdir}/Clarinet.toml
242- # }
297+ - name : Functional Tests (Windows)
298+ if : matrix.os == 'windows-latest'
299+ run : |
300+ foreach($testdir in Get-ChildItem examples) {
301+ ./target/${{ matrix.target }}/release/clarinet test --manifest-path ${testdir}/Clarinet.toml
302+ }
303+
304+ - name : Upload Artifacts to GH release (Not Windows)
305+ uses : svenstaro/upload-release-action@v2
306+ if : startsWith(github.ref, 'refs/tags/v') && matrix.os != 'windows-latest'
307+ with :
308+ repo_token : ${{ secrets.GITHUB_TOKEN }}
309+ file : clarinet-${{ matrix.platform }}.zip
310+ tag : ${{ github.ref }}
243311
244- - name : Upload Artifacts to GH release
312+ - name : Upload Artifacts to GH release (Windows)
245313 uses : svenstaro/upload-release-action@v2
246- if : startsWith(github.ref, 'refs/tags/v')
314+ if : startsWith(github.ref, 'refs/tags/v') && matrix.os == 'windows-latest'
247315 with :
248316 repo_token : ${{ secrets.GITHUB_TOKEN }}
249- file : ${{ matrix.platform }}.zip
250- asset_name : ${{ matrix.platform }}
317+ file : clarinet-${{ matrix.platform }}.msi
251318 tag : ${{ github.ref }}
252319
253320 # Cleans the `./target` dir after the build such that only dependencies are cached on CI
@@ -268,7 +335,7 @@ jobs:
268335 id : docker_meta
269336 uses : docker/metadata-action@v3
270337 with :
271- images : blockstack/ ${{ github.event. repository.name }}
338+ images : ${{ github.repository }}
272339 tags : |
273340 type=ref,event=branch
274341 type=ref,event=pr
@@ -303,7 +370,7 @@ jobs:
303370 uses : actions/checkout@v2
304371 with :
305372 # Necessary for Semantic Release
306- token : ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
373+ token : ${{ secrets.GH_TOKEN }}
307374
308375 - name : Semantic Release
309376 uses : cycjimmy/semantic-release-action@v2
0 commit comments