fit 3.0.0 #15
Workflow file for this run
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
# | |
# This CI workflow builds fit packages for all supported platforms | |
# and creates a draft GitHub release with packages built in this | |
# workflow uploaded as assets. | |
# | |
# | |
# GitHub maintains the run number sequence per workflow file name, | |
# which means that this file needs to be renamed when the version | |
# is changed, so the run number starts a new sequence. | |
# | |
name: fit 3.0.0 | |
on: workflow_dispatch | |
env: | |
VERSION: 3.0.0 | |
BUILD_NUMBER: ${{ github.run_number }} | |
jobs: | |
# | |
# Windows build | |
# | |
build-windows: | |
name: Windows build | |
runs-on: windows-2022 | |
env: | |
VCVARSALL: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall' | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Restore Nuget packages | |
run: nuget restore | |
- name: Set up SHA256 source | |
run: devops\get-sha256.bat | |
# only x64 binaries are built on all platforms | |
- name: Build fit x64 | |
run: | | |
call "${{ env.VCVARSALL }}" x64 | |
msbuild /nologo /target:Rebuild /property:Configuration=Release;Platform=x64;GH_BUILD_NUMBER=$(BUILD_NUMBER) /nr:false fit.vcxproj | |
# | |
# The only way to avoid hard-coded references to Nuget packages | |
# is to build the application package as a VS project. Use the | |
# hard-coded Nuget version for now and if SQLite gets updated | |
# more than expected, a dedicated packaging VS project may be | |
# introduced into this solution. | |
# | |
- name: Create Windows package | |
run: | | |
mkdir fit-${{ env.VERSION }}-windows | |
mkdir fit-${{ env.VERSION }}-windows\sql | |
copy /y x64\Release\fit.exe fit-${{ env.VERSION }}-windows | |
copy /y packages\StoneSteps.SQLite.VS2022.Static.3.39.4.1\build\native\bin\sqlite3.exe fit-${{ env.VERSION }}-windows | |
copy /y README.md fit-${{ env.VERSION }}-windows | |
copy /y LICENSE. fit-${{ env.VERSION }}-windows | |
copy /y sql\* fit-${{ env.VERSION }}-windows\sql\ | |
7z a fit-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.windows.x64.zip fit-${{ env.VERSION }}-windows | |
- name: Upload Windows package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fit-${{ env.VERSION }}-windows | |
path: fit-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.windows.x64.zip | |
# | |
# Linux build (all flavors) | |
# | |
build-linux: | |
name: Linux build | |
strategy: | |
# no need for x86/x64 in the matrix, as there's no plan to build x86 for this project | |
matrix: | |
linux-flavor: | |
- fedora | |
- ubuntu | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/stonestepsinc/fit/${{ matrix.linux-flavor }}:20231026 | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Set up SHA-256 | |
run: | | |
devops/get-sha256 | |
- name: Build binaries | |
run: | | |
make GH_BUILD_NUMBER=${{ env.BUILD_NUMBER }} | |
- name: Create ${{ matrix.linux-flavor }} package | |
run: | | |
mkdir fit-${{ env.VERSION }}-${{ matrix.linux-flavor }} | |
mkdir fit-${{ env.VERSION }}-${{ matrix.linux-flavor }}/sql | |
cp build/fit fit-${{ env.VERSION }}-${{ matrix.linux-flavor }} | |
cp README.md fit-${{ env.VERSION }}-${{ matrix.linux-flavor }} | |
cp LICENSE fit-${{ env.VERSION }}-${{ matrix.linux-flavor }} | |
cp sql/* fit-${{ env.VERSION }}-${{ matrix.linux-flavor }}/sql | |
tar czf fit-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.${{ matrix.linux-flavor }}.x64.tar.gz fit-${{ env.VERSION }}-${{ matrix.linux-flavor }} | |
- name: Upload ${{ matrix.linux-flavor }} package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fit-${{ env.VERSION }}-${{ matrix.linux-flavor }} | |
path: fit-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.${{ matrix.linux-flavor }}.x64.tar.gz | |
# | |
# Create a draft release | |
# | |
create-draft-release: | |
name: Create a draft release | |
runs-on: ubuntu-22.04 | |
needs: | |
- build-windows | |
- build-linux | |
outputs: | |
draft-release-upload-url: ${{ steps.draft-release.outputs.upload_url }} | |
steps: | |
- name: Create a draft release | |
id: draft-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: fit ${{ env.VERSION }} | |
draft: true | |
# | |
# Upload all artifacts as draft release assets | |
# | |
upload-release-assets: | |
name: Upload release assets | |
runs-on: ubuntu-22.04 | |
needs: | |
- create-draft-release | |
strategy: | |
matrix: | |
build-flavor: | |
- fedora | |
- ubuntu | |
- windows | |
include: | |
- asset-content-type: application/gzip | |
asset-ext: tar.gz | |
- build-flavor: windows | |
asset-content-type: application/zip | |
asset-ext: zip | |
steps: | |
- name: Download ${{ matrix.build-flavor }} package | |
uses: actions/download-artifact@v3 | |
with: | |
name: fit-${{ env.VERSION }}-${{ matrix.build-flavor }} | |
path: . | |
- name: Add ${{ matrix.build-flavor }} package | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-draft-release.outputs.draft-release-upload-url }} | |
asset_path: fit-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.${{ matrix.build-flavor }}.x64.${{ matrix.asset-ext }} | |
asset_name: fit-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.${{ matrix.build-flavor }}.x64.${{ matrix.asset-ext }} | |
asset_content_type: ${{ matrix.asset-content-type }} |