Skip to content

Commit

Permalink
Generalize Versioning (#288)
Browse files Browse the repository at this point in the history
Still need to test on master whether release by tag actually works
  • Loading branch information
harelba authored Jan 22, 2022
1 parent ce8733e commit 0162202
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 62 deletions.
96 changes: 66 additions & 30 deletions .github/workflows/build-and-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,44 @@ on:
- "*.md"
- "*.markdown"
- "mkdocs/**/*"
tags-ignore:
- "*"

jobs:
version_info:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- id: vars
run: |
set -e -x
echo "github event ref is ${{ github.ref }}"
if [ "x${{ startsWith(github.ref, 'refs/tags/v') }}" == "xtrue" ]
then
echo "Trigger was a version tag - ${{ github.ref }}"
echo ::set-output name=q_version::${GITHUB_REF#refs/tags/v}
else
# For testing version propagation inside the PR
echo "Either branch of a non-version tag - setting version to 0.0.0"
echo ::set-output name=q_version::0.0.0
fi
outputs:
q_version: ${{ steps.vars.outputs.q_version }}

check_version_info:
runs-on: ubuntu-18.04
needs: version_info
steps:
- name: test q_version
run: |
set -e -x
echo q_version is ${{ needs.version_info.outputs.q_version }}
create-man:
runs-on: ubuntu-18.04
steps:
Expand Down Expand Up @@ -106,7 +142,7 @@ jobs:
Q_EXECUTABLE=`pwd`/linux-q Q_SKIP_EXECUTABLE_VALIDATION=true ./run-tests.sh -v
package-linux-deb:
needs: [test-linux, create-man]
needs: [test-linux, create-man, version_info]
runs-on: ubuntu-18.04
steps:
- name: Checkout
Expand All @@ -133,25 +169,27 @@ jobs:
chmod 755 ./linux-q
export q_version=${{ needs.version_info.outputs.q_version }}
gem install fpm
cp dist/fpm-config ~/.fpm
fpm -s dir -t deb --deb-use-file-permissions -p packages/linux/q-text-as-data-3.1.6-1.x86_64.deb --version 3.1.6 ./linux-q=/usr/bin/q USAGE.gz=/usr/share/man/man1/q.1.gz
fpm -s dir -t deb --deb-use-file-permissions -p packages/linux/q-text-as-data-${q_version}-1.x86_64.deb --version ${q_version} ./linux-q=/usr/bin/q USAGE.gz=/usr/share/man/man1/q.1.gz
- name: Upload DEB Package
uses: actions/[email protected]
with:
name: q-text-as-data-3.1.6-1.x86_64.deb
path: packages/linux/q-text-as-data-3.1.6-1.x86_64.deb
name: q-text-as-data-${{ needs.version_info.outputs.q_version }}-1.x86_64.deb
path: packages/linux/q-text-as-data-${{ needs.version_info.outputs.q_version }}-1.x86_64.deb

test-deb-packaging:
runs-on: ubuntu-18.04
needs: package-linux-deb
needs: [package-linux-deb, version_info]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download DEB
uses: actions/download-artifact@v2
with:
name: q-text-as-data-3.1.6-1.x86_64.deb
name: q-text-as-data-${{ needs.version_info.outputs.q_version }}-1.x86_64.deb
- name: Install Python for Testing
uses: actions/setup-python@v2
with:
Expand All @@ -163,10 +201,10 @@ jobs:
pip3 install -r test-requirements.txt
- name: Test DEB Package Installation
run: ./dist/test-using-deb.sh ./q-text-as-data-3.1.6-1.x86_64.deb
run: ./dist/test-using-deb.sh ./q-text-as-data-${{ needs.version_info.outputs.q_version }}-1.x86_64.deb

package-linux-rpm:
needs: [test-linux, create-man]
needs: [test-linux, create-man, version_info]
runs-on: ubuntu-18.04
steps:
- name: Checkout
Expand All @@ -189,31 +227,32 @@ jobs:
mkdir -p packages/linux
find ./ -ls
chmod 755 ./linux-q
export q_version=${{ needs.version_info.outputs.q_version }}
gem install fpm
cp dist/fpm-config ~/.fpm
fpm -s dir -t rpm --rpm-use-file-permissions -p packages/linux/q-text-as-data-3.1.6.x86_64.rpm --version 3.1.6 ./linux-q=/usr/bin/q USAGE.gz=/usr/share/man/man1/q.1.gz
fpm -s dir -t rpm --rpm-use-file-permissions -p packages/linux/q-text-as-data-${q_version}.x86_64.rpm --version ${q_version} ./linux-q=/usr/bin/q USAGE.gz=/usr/share/man/man1/q.1.gz
- name: Upload RPM Package
uses: actions/[email protected]
with:
name: q-text-as-data-3.1.6.x86_64.rpm
path: packages/linux/q-text-as-data-3.1.6.x86_64.rpm
name: q-text-as-data-${{ needs.version_info.outputs.q_version }}.x86_64.rpm
path: packages/linux/q-text-as-data-${{ needs.version_info.outputs.q_version }}.x86_64.rpm

test-rpm-packaging:
runs-on: ubuntu-18.04
needs: package-linux-rpm
needs: [package-linux-rpm, version_info]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download RPM
uses: actions/download-artifact@v2
with:
name: q-text-as-data-3.1.6.x86_64.rpm
name: q-text-as-data-${{ needs.version_info.outputs.q_version }}.x86_64.rpm
- name: Retest using RPM
run: ./dist/test-using-rpm.sh ./q-text-as-data-3.1.6.x86_64.rpm
run: ./dist/test-using-rpm.sh ./q-text-as-data-${{ needs.version_info.outputs.q_version }}.x86_64.rpm

build-mac:
runs-on: macos-11
Expand Down Expand Up @@ -307,6 +346,7 @@ jobs:
build-windows:
runs-on: windows-latest
needs: version_info
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -331,7 +371,7 @@ jobs:
run: |
set -e -x
pyoxidizer build --release
pyoxidizer build --release --var Q_VERSION ${{ needs.version_info.outputs.q_version }}
export Q_EXECUTABLE=./build/x86_64-pc-windows-msvc/release/install/q
chmod 755 $Q_EXECUTABLE
Expand Down Expand Up @@ -374,7 +414,7 @@ jobs:
seq 1 10000 | ./win-q.exe -c 1 "select sum(c1),count(*) from -" -S some-db.sqlite
package-windows:
needs: [create-man, not-really-test-windows]
needs: [create-man, not-really-test-windows, version_info]
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -400,39 +440,35 @@ jobs:
run: |
set -e -x
pyoxidizer build --release msi_installer
find ./ -ls
# TODO Windows versions do not support the -beta postfix
pyoxidizer build --release msi_installer --var Q_VERSION ${{ needs.version_info.outputs.q_version }}
export Q_MSI=./build/x86_64-pc-windows-msvc/release/msi_installer/q-text-as-data-3.1.6.msi
export Q_MSI=./build/x86_64-pc-windows-msvc/release/msi_installer/q-text-as-data-${{ needs.version_info.outputs.q_version }}.msi
chmod 755 $Q_MSI
mkdir -p packages/windows/
cp $Q_MSI packages/windows/q-text-as-data-3.1.6.msi
cp $Q_MSI packages/windows/q-text-as-data-${{ needs.version_info.outputs.q_version }}.msi
- name: Upload Windows MSI
uses: actions/[email protected]
with:
name: q-text-as-data-3.1.6.msi
path: packages/windows/q-text-as-data-3.1.6.msi
name: q-text-as-data-${{ needs.version_info.outputs.q_version }}.msi
path: packages/windows/q-text-as-data-${{ needs.version_info.outputs.q_version }}.msi

test-windows-packaging:
needs: package-windows
needs: [package-windows, version_info]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Windows Package
uses: actions/download-artifact@v2
with:
name: q-text-as-data-3.1.6.msi
name: q-text-as-data-${{ needs.version_info.outputs.q_version }}.msi
- name: Test Install of MSI
continue-on-error: true
shell: powershell
run: |
$process = Start-Process msiexec.exe -ArgumentList "/i q-text-as-data-3.1.6.msi -l* msi-install.log /norestart /quiet" -PassThru -Wait
$process = Start-Process msiexec.exe -ArgumentList "/i q-text-as-data-${{ needs.version_info.outputs.q_version }}.msi -l* msi-install.log /norestart /quiet" -PassThru -Wait
$process.ExitCode
gc msi-install.log
Expand All @@ -441,7 +477,7 @@ jobs:
continue-on-error: true
shell: powershell
run: |
$process = Start-Process msiexec.exe -ArgumentList "/u q-text-as-data-3.1.6.msi /norestart /quiet" -PassThru -Wait
$process = Start-Process msiexec.exe -ArgumentList "/u q-text-as-data-${{ needs.version_info.outputs.q_version }}.msi /norestart /quiet" -PassThru -Wait
$process.ExitCode
exit $process.ExitCode
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/q.rb.brew-formula-template

This file was deleted.

3 changes: 2 additions & 1 deletion pyoxidizer.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# configuration file format.

PYTHON_VERSION = VARS.get("PYTHON_VERSION","3.8")
Q_VERSION = VARS.get("Q_VERSION","0.0.1")

# Configuration files consist of functions which define build "targets."
# This function creates a Python executable and installs it in a destination
Expand Down Expand Up @@ -63,7 +64,7 @@ def make_msi(exe):
# The name of your application.
"q-text-as-data",
# The version of your application.
"3.1.6",
Q_VERSION,
# The author/manufacturer of your application.
"Harel Ben-Attia"
)
Expand Down

0 comments on commit 0162202

Please sign in to comment.