trim with xargs #162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Build' | |
env: | |
VERSION: 3.6.0 | |
BUILD_TYPE: Release | |
ARCH: x64 | |
VCPKG_CONFIG: Release | |
VCPKG_HASH: e8c2a04eb7ca058b6e2f0e6e33c67fdbffeee846 | |
DOC_ARTIFACT: webHelpBT2-all.zip | |
on: [push, workflow_dispatch] | |
# Gives the workflow permissions to clone the repo and create a page deployment | |
permissions: | |
id-token: write | |
pages: write | |
jobs: | |
build-win: | |
runs-on: windows-latest | |
name: 'Windows Build' | |
env: | |
VCPKG_DEFAULT_VCPKG_TRIPLET: x64-windows-static | |
VCPKG_TRIPLET: x64-windows-static | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: pre-build patch script | |
run: .\pre-build.ps1 | |
shell: pwsh | |
- uses: friendlyanon/setup-vcpkg@v1 | |
# seems like the absense of commit hash expects vcpkg submodule, i don't want that | |
with: | |
committish: ${{ env.VCPKG_HASH }} | |
# set to false to clear any cache in case of build errors | |
cache: false | |
- name: ⚙️ configure | |
run: > | |
cmake -B build -S . | |
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
-D "CMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" | |
-D "VCPKG_TARGET_TRIPLET=${{ env.VCPKG_TRIPLET }}" | |
working-directory: . | |
- name: 🏭 build | |
run: cmake --build build --config ${{ env.VCPKG_CONFIG }} | |
working-directory: . | |
#- name: 🧪 unit tests | |
# run: test.exe | |
# working-directory: build/test/Release | |
- name: 📦 pack | |
run: cpack -C ${{ env.BUILD_TYPE }} | |
working-directory: build | |
- name: debug | |
run: ls -R | |
working-directory: build | |
# creates "atf" subdir and put the following: | |
# 1. msi installer, renamed after version number | |
# 2. zipped .exe | |
# 3. version.txt containing version number | |
- name: prep artifacts | |
run: | | |
mkdir atf | |
cp build/bt.msi atf/${{ env.MSI_FILE_NAME }} | |
Compress-Archive -Path build/bt/Release/bt.exe -DestinationPath atf/${{ env.ZIP_FILE_NAME }} -CompressionLevel Optimal | |
Compress-Archive -Path build/bt/Release/bt.pdb -DestinationPath atf/${{ env.PDB_FILE_NAME }} -CompressionLevel Optimal | |
"${{ env.VERSION }}" | Out-File atf/version.txt | |
(Get-FileHash -Algorithm SHA256 -Path atf/${{ env.ZIP_FILE_NAME }}).Hash | Out-File atf/${{ env.ZIP_FILE_NAME }}.sha256.txt | |
(Get-FileHash -Algorithm SHA256 -Path atf/${{ env.MSI_FILE_NAME }}).Hash | Out-File atf/${{ env.MSI_FILE_NAME }}.sha256.txt | |
cp docs/release-notes.md atf/ | |
cp docs/instructions.md atf/ | |
env: | |
ZIP_FILE_NAME: bt-${{ env.VERSION }}.zip | |
PDB_FILE_NAME: bt-${{ env.VERSION }}.pdb.zip | |
MSI_FILE_NAME: bt-${{ env.VERSION }}.msi | |
- uses: actions/upload-artifact@v3 | |
name: collect binaries | |
with: | |
name: bin | |
path: atf/* | |
- name: VirusTotal Scan | |
uses: crazy-max/ghaction-virustotal@v4 | |
with: | |
vt_api_key: ${{ secrets.VT_API_KEY }} | |
files: | | |
build/bt/Release/bt.exe | |
build-linux: | |
runs-on: ubuntu-latest | |
name: 'Linux Build' | |
env: | |
VCPKG_DEFAULT_VCPKG_TRIPLET: x64-linux | |
VCPKG_TRIPLET: x64-linux | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: friendlyanon/setup-vcpkg@v1 | |
with: | |
committish: ${{ env.VCPKG_HASH }} | |
cache: true | |
- name: ⚙️ configure | |
run: > | |
cmake -B build -S . | |
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
-D "CMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" | |
-D "VCPKG_TARGET_TRIPLET=${{ env.VCPKG_TRIPLET }}" | |
working-directory: . | |
- name: 🏭 build | |
run: cmake --build build --config ${{ env.VCPKG_CONFIG }} | |
working-directory: . | |
- name: debug | |
run: ls -R | |
working-directory: build | |
- name: 🧪 unit tests | |
run: ./test | |
working-directory: build/test | |
writerside-build: | |
runs-on: ubuntu-latest | |
name: 'Build Docs' | |
env: | |
PRODUCT: Writerside/bt | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Build Writerside docs using Docker | |
uses: JetBrains/writerside-github-action@v3 | |
- name: Upload documentation | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: artifacts/*.zip | |
retention-days: 7 | |
writerside-deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: writerside-build | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
name: 'Deploy Docs to GitHub Pages' | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: docs | |
- name: Unzip artifact | |
uses: montudor/action-zip@v1 | |
with: | |
args: unzip -qq ${{ env.DOC_ARTIFACT }} -d dir | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: dir | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |