Skip to content

release

release #2028

Workflow file for this run

name: release
on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
inputs:
windows:
description: Build on Windows
type: boolean
default: true
macOS:
description: Build on macOS
type: boolean
default: true
linux:
description: Build on Linux
type: boolean
default: true
bsd:
description: Build on BSD
type: boolean
default: true
nightly:
description: Nightly build
type: boolean
default: false
debug:
description: Debug symbols
type: boolean
default: false
no_tests:
description: Do not run unit tests
type: boolean
default: false
no_coverage:
description: Do not run coverage job
type: boolean
default: false
tag:
description: Optional release tag (normally auto-detected)
jobs:
check-for-changes:
runs-on: ubuntu-latest
outputs:
new-commits: ${{ steps.check.outputs.new-commits }}
steps:
- name: Check repositories for changes
id: check
run: |
new_commits=false
repos='
textadept
scintillua
scinterm
textadept-debugger
textadept-export
textadept-file-diff
textadept-format
textadept-lsp
textadept-lua-repl
textadept-open-file-mode
textadept-scratch
textadept-spellcheck
textadept-update-notifier
'
for repo in $(echo $repos); do
git clone --depth 1 https://github.com/orbitalquark/$repo
pushd $repo
last_date=$(git log -1 --format=%as) # YYYY-MM-DD
today=$(date +%F)
yesterday=$(date -d yesterday +%F)
if [[ $last_date = $yesterday || $last_date = $today ]]; then
new_commits=true
break
fi
popd
done
if [[ ${{ github.event_name }} = workflow_dispatch ]]; then new_commits=true; fi
echo "new-commits=$new_commits" >> "$GITHUB_OUTPUT"
get-version:
runs-on: ubuntu-latest
needs: check-for-changes
if: needs.check-for-changes.outputs.new-commits == 'true'
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: get-version
run: |
if [[ ${{ github.event_name }} = schedule ]]; then
version=nightly
elif [[ "${{ github.event.inputs.nightly }}" = true ]]; then
version=nightly
else
version=$(grep -m1 _RELEASE core/init.lua | grep -o "[0-9.]\+[^']*" | tr ' ' '_')
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
build:
needs: check-for-changes
if: needs.check-for-changes.outputs.new-commits == 'true'
strategy:
matrix:
include:
- os: ubuntu-22.04
if: ${{ inputs.linux || github.event_name == 'schedule' }}
- os: ubuntu-22.04-arm
if: ${{ inputs.linux || github.event_name == 'schedule' }}
- os: windows-2022
if: ${{ inputs.windows || github.event_name == 'schedule' }}
qt: '6.9'
- os: macOS-13
if: ${{ inputs.macOS || github.event_name == 'schedule' }}
qt: '6.9'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
if: matrix.if
uses: actions/checkout@v4
- name: Checkout textadept-build dependencies
if: matrix.if
uses: actions/checkout@v4
with:
repository: orbitalquark/textadept-build
path: textadept-build
- name: Install Qt (Windows, macOS)
if: matrix.if && (runner.os == 'Windows' || runner.os == 'macOS')
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt }}
modules: 'qt5compat'
- name: Install Qt and GTK (Linux)
if: matrix.if && runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev libgtk-3-dev --no-install-recommends -y
- name: Build
if: matrix.if
shell: bash
run: |
# Move cached dependencies into build/_deps.
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build
# Build.
type="Release"
if [[ ${{ github.event_name }} != schedule ]]; then
if [[ "${{ github.event.inputs.nightly }}" = true ]]; then nightly="-D NIGHTLY=1"; fi
if [[ "${{ github.event.inputs.debug }}" = true ]]; then type="Debug"; fi
else
nightly="-D NIGHTLY=1"
fi
cmake -S . -B build ${nightly} -D CMAKE_INSTALL_PREFIX=build/install
cmake --build build --config ${type} -j
cmake --install build --config ${type}
cmake --build build --target archive
env:
VCINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC
- name: Upload artifacts
if: matrix.if
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.os }}
path: |
build/*.tgz
build/*.zip
modules:
runs-on: ubuntu-latest
needs: get-version
steps:
- name: Package modules
run: |
mkdir textadept-modules
modules="debugger export file_diff format lsp lua_repl open_file_mode scratch spellcheck
update_notifier"
for module in $(echo $modules); do
gh_name="$(echo -n $module | sed -e 's/_/-/g;')"
gh_prefix="https://github.com/orbitalquark/textadept-$gh_name"
wget $gh_prefix/releases/download/latest/$module.zip
unzip -d textadept-modules $module.zip
done
zip -r textadept_${{ needs.get-version.outputs.version }}.modules.zip textadept-modules
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-modules
path: '*.zip'
docs:
runs-on: ubuntu-latest
needs: check-for-changes
if: needs.check-for-changes.outputs.new-commits == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout textadept-build dependencies
uses: actions/checkout@v4
with:
repository: orbitalquark/textadept-build
path: textadept-build
- name: Install Lua
run: |
sudo apt-get update
sudo apt-get install lua5.3 --no-install-recommends -y
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
working-directory: docs
- name: Build
shell: bash
run: |
# Note: this job tests the html CMake target, so CMake configure needs to succeed.
# Move cached dependencies into build/_deps.
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build
# Build.
if [[ ${{ github.event_name }} != schedule ]]; then
if [[ "${{ github.event.inputs.nightly }}" = true ]]; then nightly="-D NIGHTLY=1"; fi
else
nightly="-D NIGHTLY=1"
fi
cmake -S . -B build ${nightly} -D GENERATE_HTML=1
cmake --build build --target html
tar czf docs.tgz docs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-docs
path: docs.tgz
release:
runs-on: ubuntu-latest
needs: [get-version, build, modules, docs]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Add HTML documentation
run: |
# Extract HTML documentation.
tar xzf docs.tgz --wildcards 'docs/*.html'
tar xzf docs.tgz 'docs/assets/css/style.css'
version=${{ needs.get-version.outputs.version }}
# Insert it into Linux archives.
for tgz in $(ls textadept_$version.linux*.tgz); do
tar xzf $tgz && cp -r docs textadept && tar czf $tgz textadept && rm -r textadept
done
# Insert it into Windows archive.
if [[ -f textadept_$version.win.zip ]]; then
mkdir textadept && cp -r docs textadept
zip -r textadept_$version.win.zip textadept/docs
rm -r textadept
fi
# Install it into macOS archive.
if [[ -f textadept_$version.macOS.zip ]]; then
bundle_res="Textadept.app/Contents/Resources"
mkdir -p $bundle_res
cp -r docs $bundle_res
zip -r textadept_$version.macOS.zip $bundle_res
fi
- name: Tag
if: github.ref_name == github.event.repository.default_branch
run: |
git tag textadept_${{ needs.get-version.outputs.version }}
git push -f origin textadept_${{ needs.get-version.outputs.version }}
- name: Create release log
run: |
echo -n "Textadept " > log.md
echo -n "${{ needs.get-version.outputs.version }} " | tr '_' ' ' >> log.md
echo \($(date +"%d %b %Y")\) >> log.md
if [[ ${{ needs.get-version.outputs.version }} = nightly ]]; then exit 0; fi
prefix="https://orbitalquark.github.io/textadept"
echoing=0
while read line; do
if [[ $line = \#\#* ]]; then
if [[ $echoing -eq 0 ]]; then
echoing=1
else
exit 0
fi
elif [[ $echoing -eq 1 ]]; then
echo "$line" | sed "s,\(manual\|api\)\.html,$prefix/\0,;"
fi
done < docs/changelog.md >> log.md
- name: Upload release log
uses: actions/upload-artifact@v4
with:
name: artifacts-release-log
path: log.md
- name: Create release
if: github.ref_name == github.event.repository.default_branch
uses: ncipollo/release-action@v1
with:
name: ${{ needs.get-version.outputs.version }}
tag: textadept_${{ needs.get-version.outputs.version }}
prerelease: |
${{ needs.get-version.outputs.version == 'nightly' ||
contains(needs.get-version.outputs.version, 'alpha') ||
contains(needs.get-version.outputs.version, 'beta') }}
allowUpdates: true
bodyFile: log.md
artifacts: textadept_*
token: ${{ secrets.GITHUB_TOKEN }}
test:
if: ${{ ! inputs.no_tests }}
needs: [build, modules]
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest]
exe: [textadept/textadept, textadept/textadept-gtk, textadept/textadept-curses]
exclude:
- os: windows-latest
exe: textadept/textadept-gtk
include:
- os: macOS-latest
exe: Textadept.app/Contents/MacOS/textadept_osx
#- os: macOS-latest
# exe: Textadept.app/Contents/MacOS/textadept-curses
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install Qt, Gtk, xterm, matchbox-window-manager, and module dependencies (Linux)
if: runner.os == 'Linux' && (inputs.linux || github.event_name == 'schedule')
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev libgtk-3-dev xterm matchbox-window-manager \
xsel gdb lua5.4 lua-socket clang-format clangd hunspell-en-us --no-install-recommends -y
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Unpack Textadept (Windows)
if: runner.os == 'Windows' && (inputs.windows || github.event_name == 'schedule')
shell: bash
run: unzip textadept_*.win.zip
- name: Unpack Textadept (macOS)
if: runner.os == 'macOS' && (inputs.macOS || github.event_name == 'schedule')
run: unzip textadept_*.macOS.zip
- name: Unpack Textadept (Linux)
if: runner.os == 'Linux' && !contains(matrix.os, 'arm') &&
(inputs.linux || github.event_name == 'schedule')
run: tar xzf textadept_*.linux.tgz
- name: Unpack Textadept (Linux ARM)
if: runner.os == 'Linux' && contains(matrix.os, 'arm') &&
(inputs.linux || github.event_name == 'schedule')
run: tar xzf textadept_*.linux.arm.tgz
- name: Unpack modules (Windows, Linux)
if: runner.os != 'macOS' &&
(inputs.windows || inputs.linux || github.event_name == 'schedule')
shell: bash
run: |
unzip textadept_*.modules.zip
if [[ ! -d textadept ]]; then exit 0; fi
mv textadept-modules/* textadept/modules
- name: Unpack modules (macOS)
if: runner.os == 'macOS' && (inputs.macOS || github.event_name == 'schedule')
run: |
unzip textadept_*modules.zip
mv textadept-modules/* Textadept.app/Contents/Resources/modules
- name: Run unit tests (Windows)
if: runner.os == 'Windows' && (inputs.windows || github.event_name == 'schedule')
shell: cmd
run: start "" /d ${{ github.workspace }} /wait ${{ matrix.exe }}.exe -t
timeout-minutes: 2
- name: Run unit tests (macOS)
if: runner.os == 'macOS' && (inputs.macOS || github.event_name == 'schedule')
run: ${{ matrix.exe }} -t
#run: |
# echo "cd ${{ github.workspace }}" > run.sh
# echo "${{ matrix.exe }} -t" >> run.sh
# open -W -a Terminal run.sh # TODO: never exits since Terminal.app does not quit
timeout-minutes: 2
- name: Run unit tests (Linux)
if: runner.os == 'Linux' && (inputs.linux || github.event_name == 'schedule')
run: xvfb-run -a xterm -e ${{ matrix.exe }} -t
env:
LANG: en_US.UTF-8
timeout-minutes: 2
- name: Read test output
if: success() || failure()
shell: bash
run: |
if [[ ! -f test.log ]]; then exit 0; fi
cat test.log
grep -q '^0 failed' test.log
smoke-test-gtk2:
needs: check-for-changes
if: needs.check-for-changes.outputs.new-commits == 'true' && ! inputs.no_tests &&
(inputs.linux || github.event_name == 'schedule')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout textadept-build dependencies
uses: actions/checkout@v4
with:
repository: orbitalquark/textadept-build
path: textadept-build
- name: Install build and test dependencies
run: |
sudo apt-get update
sudo apt-get install libgtk2.0-dev matchbox-window-manager
- name: Build
run: |
# Move cached dependencies into build/_deps.
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build
# Build.
cmake -S . -B build -D NIGHTLY=1
cmake --build build
# Copy lexers.
cp -r build/_deps/scintillua-src/lexers .
- name: Test
run: xvfb-run -a build/textadept-gtk -t
env:
TEXTADEPT_HOME: ${{ github.workspace }}
timeout-minutes: 1
- name: Read test output
if: success() || failure()
run: |
cat test.log
grep -q '^0 failed' test.log
smoke-test-bsd:
needs: check-for-changes
if: needs.check-for-changes.outputs.new-commits == 'true' && ! inputs.no_tests &&
(inputs.bsd || github.event_name == 'schedule')
runs-on: ubuntu-latest
env:
TEXTADEPT_HOME: ${{ github.workspace }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout textadept-build dependencies
uses: actions/checkout@v4
with:
repository: orbitalquark/textadept-build
path: textadept-build
- name: Install dependencies
uses: cross-platform-actions/[email protected]
with:
operating_system: freebsd
version: '14.1'
shell: bash
environment_variables: TEXTADEPT_HOME
sync_files: false
shutdown_vm: false
run: sudo pkg install -y cmake ninja qt5 ncurses
- name: Build
uses: cross-platform-actions/[email protected]
with:
operating_system: freebsd
version: '14.1'
shell: bash
environment_variables: TEXTADEPT_HOME
sync_files: runner-to-vm
shutdown_vm: false
run: |
# Move cached dependencies into build/_deps.
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build
# Build.
cmake -S . -B build -D NIGHTLY=1 -G Ninja
cmake --build build
# Copy lexers.
cp -r build/_deps/scintillua-src/lexers .
- name: Test
uses: cross-platform-actions/[email protected]
with:
operating_system: freebsd
version: '14.1'
shell: bash
environment_variables: TEXTADEPT_HOME
sync_files: false
shutdown_vm: false
run: build/textadept-curses -t
timeout-minutes: 1
- name: Read test output
if: success() || failure()
uses: cross-platform-actions/[email protected]
with:
operating_system: freebsd
version: '14.1'
shell: bash
environment_variables: TEXTADEPT_HOME
sync_files: false
run: |
cat test.log
grep -q '^0 failed' test.log
coverage:
if: ${{ ! inputs.no_coverage }}
needs: modules
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout textadept-build dependencies
uses: actions/checkout@v4
with:
repository: orbitalquark/textadept-build
path: textadept-build
- name: Checkout LuaCov
uses: actions/checkout@v4
with:
repository: lunarmodules/luacov
path: luacov
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev libgtk-3-dev xterm matchbox-window-manager lua5.4 gcovr \
xsel gdb lua-socket clang-format clangd hunspell-en-us --no-install-recommends -y
patch -d luacov -p1 < src/luacov.patch
sudo mkdir -p /usr/share/lua/5.4
sudo cp -r luacov/src/luacov* /usr/share/lua/5.4
sudo cp luacov/src/bin/luacov /usr/bin
rm -r luacov
- name: Build for coverage
run: |
# Move cached dependencies into build/_deps.
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build
# Build.
cmake -S . -B build -D NIGHTLY=1 -D PROFILE=1
cmake --build build --config Debug -j
# Copy lexers.
cp -r build/_deps/scintillua-src/lexers .
- name: Download modules
uses: actions/download-artifact@v4
with:
name: artifacts-modules
- name: Unpack modules
run: |
unzip textadept_*.modules.zip
mv textadept-modules/* modules
- name: Run tests
run: |
xvfb-run -a build/textadept -t -T || true
xvfb-run -a build/textadept-gtk -f -t -T || true
xvfb-run -a xterm -e build/textadept-curses -t -T
env:
TEXTADEPT_HOME: ${{ github.workspace }}
LANG: en_US.UTF-8
timeout-minutes: 6
- name: Read test output
if: success() || failure()
run: cat test.log
- name: Process coverage reports
run: lua scripts/gen_cov.lua github . > coverage.md
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: artifacts-coverage
path: coverage.md
update-release-log:
if: ${{ ! inputs.no_coverage }}
needs: [release, coverage]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Append coverage table
run: cat coverage.md >> log.md
- name: Update release log with coverage info
if: github.ref_name == github.event.repository.default_branch
uses: ncipollo/release-action@v1
with:
name: nightly
tag: textadept_nightly
prerelease: true
allowUpdates: true
bodyFile: log.md
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload updated release log
uses: actions/upload-artifact@v4
with:
name: artifacts-update-release-log
path: log.md
luacheck:
needs: check-for-changes
if: needs.check-for-changes.outputs.new-commits == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout modules
run: |
cd modules
modules="debugger export file-diff format lsp lua-repl open-file-mode scratch spellcheck
update-notifier"
for module in $(echo $modules); do
name="$(echo -n $module | sed -e 's/-/_/g;')"
git clone --depth 1 https://github.com/orbitalquark/textadept-$module $name
done
- name: Install luacheck
run: |
sudo apt-get update
sudo apt-get install lua-check --no-install-recommends -y
- name: Run luacheck
run: luacheck .