Skip to content

Snapshot Build

Snapshot Build #4814

name: Snapshot Build
on:
push:
tags:
- 'r[0-9]+' # any tag name that looks like an svn commit
workflow_dispatch:
concurrency:
group: Snapshot Build
cancel-in-progress: true
jobs:
cleanup_previous_builds: # Delete unfinished draft prereleases, and prereleases older than 30 days (but keep at least 10)
name: Cleanup Previous Builds
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
retries: 3
script: |
// Get a list of all releases, sorted newest first
let releases =
(await github.paginate(
github.rest.repos.listReleases,
{
owner: context.repo.owner,
repo: context.repo.repo
}))
.sort((a,b) => b.created_at.localeCompare(a.created_at));
let releaseCount = 0;
let releasesToDelete = [];
// Initiate deletion of draft prereleases
for (const release of releases)
{
// Only cleanup prereleases
if (!release.prerelease)
continue;
// Failed builds leave drafts - delete them
if (release.draft)
{
console.log("Will delete draft prerelease: " + release.tag_name);
releasesToDelete.push(release.id);
continue;
}
// Keep at least 10, no matter how old
if (++releaseCount <= 10)
continue;
// We have more than 10 releases - delete those more than 30 days old
let daysAgo = Math.floor((new Date() - Date.parse(release.created_at)) / 1000 / 60 / 60 / 24);
if (daysAgo <= 30)
continue;
console.log("Will delete old prerelease: " + release.tag_name);
releasesToDelete.push(release.id);
}
if (releasesToDelete.length)
{
let promises = [];
for (const id of releasesToDelete)
{
promises.push(
github.rest.repos.deleteRelease(
{
owner: context.repo.owner,
repo: context.repo.repo,
release_id: id
}));
}
console.log("Waiting for deletions to complete");
await Promise.all(promises);
}
console.log("Done.");
create_release:
name: Create Draft Release
needs: cleanup_previous_builds
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.release_id }}
steps:
- uses: actions/github-script@v7
id: create_release
env:
TAG_NAME: ${{ github.ref }}
RELEASE_NAME: ${{ github.ref }} snapshot
with:
github-token: ${{secrets.GITHUB_TOKEN}}
retries: 3
script: |
const { TAG_NAME, RELEASE_NAME } = process.env;
const createReleaseResponse = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: TAG_NAME.replace('refs/tags/', ''),
name: RELEASE_NAME.replace('refs/tags/', ''),
draft: true,
prerelease: true,
target_commitish: context.sha
});
core.setOutput('release_id', createReleaseResponse.data.id);
core.setOutput('upload_url', createReleaseResponse.data.upload_url);
build_doc:
name: Style check, Test Headless, Build Documentation
needs: create_release
runs-on: ubuntu-latest
steps:
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
uses: actions/checkout@v4
- name: Install Dependencies
shell: bash
run: |
sudo apt update
sudo apt-get -y install autoconf \
automake \
build-essential \
byacc \
dos2unix \
flex \
libcurl4-openssl-dev \
libpcap-dev \
texinfo \
texlive-fonts-recommended \
texlive-latex-extra \
xa65
- name: Build
id: build
shell: bash
run: |
cd vice
./src/buildtools/genvicedate_h.sh
./autogen.sh
./configure --enable-option-checking=fatal \
--enable-headlessui \
--enable-html-docs \
--enable-pdf-docs \
--without-alsa \
--without-png \
--without-pulse
make stylecheck
make
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: vice-pdf
path: vice/doc/vice.pdf
retention-days: 1
- name: Upload Release Asset
uses: actions/github-script@v7
env:
UPLOAD_URL: ${{ needs.create_release.outputs.upload_url }}
ASSET_PATH: vice/doc/vice.pdf
ASSET_NAME: vice.pdf
ASSET_CONTENT_TYPE: application/pdf
with:
github-token: ${{secrets.GITHUB_TOKEN}}
retries: 3
script: |
const fs = require('fs');
const { UPLOAD_URL, ASSET_PATH, ASSET_NAME, ASSET_CONTENT_TYPE } = process.env;
const uploadAssetResponse = await github.rest.repos.uploadReleaseAsset({
url: UPLOAD_URL,
headers: {
'content-type': ASSET_CONTENT_TYPE,
'content-length': fs.statSync(ASSET_PATH).size
},
name: ASSET_NAME,
data: fs.readFileSync(ASSET_PATH)
});
build:
name: Build
needs: [create_release, build_doc]
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch:
- { msystem: MINGW64, arch: x86_64, prefix: mingw64 }
#- { msystem: MINGW32, arch: i686, prefix: mingw32 }
ui: [ GTK3, SDL2, SDL1 ]
steps:
- run: git config --global core.autocrlf input
shell: bash
- name: Checkout Source
uses: actions/checkout@v4
- name: Download Documentation
uses: actions/download-artifact@v4
with:
name: vice-pdf
path: vice/doc/
- name: Install GTK3 Dependencies if Applicable
if: ${{ matrix.ui == 'GTK3' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.arch.msystem }}
update: true
install: >-
autotools
base-devel
git
mingw-w64-${{ matrix.arch.arch }}-curl
mingw-w64-${{ matrix.arch.arch }}-docbook-xml
mingw-w64-${{ matrix.arch.arch }}-docbook-xsl
mingw-w64-${{ matrix.arch.arch }}-flac
mingw-w64-${{ matrix.arch.arch }}-giflib
mingw-w64-${{ matrix.arch.arch }}-glew
mingw-w64-${{ matrix.arch.arch }}-gtk3
mingw-w64-${{ matrix.arch.arch }}-icoutils
mingw-w64-${{ matrix.arch.arch }}-lame
mingw-w64-${{ matrix.arch.arch }}-libpcap
mingw-w64-${{ matrix.arch.arch }}-libvorbis
mingw-w64-${{ matrix.arch.arch }}-mpg123
mingw-w64-${{ matrix.arch.arch }}-ntldd
mingw-w64-${{ matrix.arch.arch }}-pkg-config
mingw-w64-${{ matrix.arch.arch }}-portaudio
mingw-w64-${{ matrix.arch.arch }}-toolchain
mingw-w64-${{ matrix.arch.arch }}-xa65
p7zip
subversion
unzip
xmlto
zip
- name: Install SDL2 Dependencies if Applicable
if: ${{ matrix.ui == 'SDL2' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.arch.msystem }}
update: true
install: >-
autotools
base-devel
git
mingw-w64-${{ matrix.arch.arch }}-SDL2
mingw-w64-${{ matrix.arch.arch }}-SDL2_image
mingw-w64-${{ matrix.arch.arch }}-curl
mingw-w64-${{ matrix.arch.arch }}-docbook-xml
mingw-w64-${{ matrix.arch.arch }}-docbook-xsl
mingw-w64-${{ matrix.arch.arch }}-flac
mingw-w64-${{ matrix.arch.arch }}-giflib
mingw-w64-${{ matrix.arch.arch }}-glew
mingw-w64-${{ matrix.arch.arch }}-icoutils
mingw-w64-${{ matrix.arch.arch }}-lame
mingw-w64-${{ matrix.arch.arch }}-libpcap
mingw-w64-${{ matrix.arch.arch }}-libvorbis
mingw-w64-${{ matrix.arch.arch }}-mpg123
mingw-w64-${{ matrix.arch.arch }}-ntldd
mingw-w64-${{ matrix.arch.arch }}-pkg-config
mingw-w64-${{ matrix.arch.arch }}-portaudio
mingw-w64-${{ matrix.arch.arch }}-toolchain
mingw-w64-${{ matrix.arch.arch }}-xa65
p7zip
subversion
unzip
xmlto
zip
- name: Install SDL1 Dependencies if Applicable
if: ${{ matrix.ui == 'SDL1' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.arch.msystem }}
update: true
install: >-
autotools
base-devel
git
mingw-w64-${{ matrix.arch.arch }}-SDL
mingw-w64-${{ matrix.arch.arch }}-SDL_image
mingw-w64-${{ matrix.arch.arch }}-curl
mingw-w64-${{ matrix.arch.arch }}-docbook-xml
mingw-w64-${{ matrix.arch.arch }}-docbook-xsl
mingw-w64-${{ matrix.arch.arch }}-flac
mingw-w64-${{ matrix.arch.arch }}-giflib
mingw-w64-${{ matrix.arch.arch }}-glew
mingw-w64-${{ matrix.arch.arch }}-icoutils
mingw-w64-${{ matrix.arch.arch }}-lame
mingw-w64-${{ matrix.arch.arch }}-libpcap
mingw-w64-${{ matrix.arch.arch }}-libvorbis
mingw-w64-${{ matrix.arch.arch }}-mpg123
mingw-w64-${{ matrix.arch.arch }}-ntldd
mingw-w64-${{ matrix.arch.arch }}-pkg-config
mingw-w64-${{ matrix.arch.arch }}-portaudio
mingw-w64-${{ matrix.arch.arch }}-toolchain
mingw-w64-${{ matrix.arch.arch }}-xa65
p7zip
subversion
unzip
xmlto
zip
- name: Build and install libieee1284
id: build_libieee1284
shell: msys2 {0}
run: |
OLDDIR=$(pwd)
mkdir ~/work/
cd ~/work
git clone https://github.com/twaugh/libieee1284
cd libieee1284
export XML_CATALOG_FILES="/${{ matrix.arch.prefix }}/etc/xml/catalog"
./bootstrap
./configure --without-python
make CFLAGS="-Wno-incompatible-pointer-types"
make install
cd "$OLDDIR"
- name: Build
id: build
shell: msys2 {0}
run: |
MINGW_INSTALLS=${{ matrix.arch.msystem }} ./vice/build/github-actions/build-msys2.sh ${{ matrix.ui }} "$(echo "${{ github.ref }}" | sed 's,.*/,,')"
echo "zip_path=$(cygpath -w -a vice/*.zip)" >> $GITHUB_OUTPUT
echo "zip_name=$(basename vice/*.zip)" >> $GITHUB_OUTPUT
echo "seven_zip_path=$(cygpath -w -a vice/*.7z)" >> $GITHUB_OUTPUT
echo "seven_zip_name=$(basename vice/*.7z)" >> $GITHUB_OUTPUT
- name: Upload Zip
id: upload-zip
uses: actions/github-script@v7
env:
UPLOAD_URL: ${{ needs.create_release.outputs.upload_url }}
ASSET_PATH: ${{ steps.build.outputs.zip_path }}
ASSET_NAME: ${{ steps.build.outputs.zip_name }}
ASSET_CONTENT_TYPE: application/zip
with:
github-token: ${{secrets.GITHUB_TOKEN}}
retries: 3
script: |
const fs = require('fs');
const { UPLOAD_URL, ASSET_PATH, ASSET_NAME, ASSET_CONTENT_TYPE } = process.env;
const uploadAssetResponse = await github.rest.repos.uploadReleaseAsset({
url: UPLOAD_URL,
headers: {
'content-type': ASSET_CONTENT_TYPE,
'content-length': fs.statSync(ASSET_PATH).size
},
name: ASSET_NAME,
data: fs.readFileSync(ASSET_PATH)
});
- name: Upload 7Zip
id: upload-7zip
uses: actions/github-script@v7
env:
UPLOAD_URL: ${{ needs.create_release.outputs.upload_url }}
ASSET_PATH: ${{ steps.build.outputs.seven_zip_path }}
ASSET_NAME: ${{ steps.build.outputs.seven_zip_name }}
ASSET_CONTENT_TYPE: application/x-7z-compressed
with:
github-token: ${{secrets.GITHUB_TOKEN}}
retries: 3
script: |
const fs = require('fs');
const { UPLOAD_URL, ASSET_PATH, ASSET_NAME, ASSET_CONTENT_TYPE } = process.env;
const uploadAssetResponse = await github.rest.repos.uploadReleaseAsset({
url: UPLOAD_URL,
headers: {
'content-type': ASSET_CONTENT_TYPE,
'content-length': fs.statSync(ASSET_PATH).size
},
name: ASSET_NAME,
data: fs.readFileSync(ASSET_PATH)
});
build_deb:
name: Build Debian Package
needs: [create_release, build_doc]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ui: [ { name: 'GTK3',
conf: '--enable-gtk3ui --with-pulse',
deps: 'libevdev-dev libglew-dev libgtk-3-dev libpulse-dev' },
{ name: 'SDL2',
conf: '--enable-sdl2ui --with-sdlsound --without-pulse',
deps: 'libsdl2-dev libsdl2-image-dev' },
{ name: 'SDL1',
conf: '--enable-sdl1ui --with-sdlsound --without-pulse',
deps: 'libsdl1.2-dev libsdl-image1.2-dev' },
{ name: 'Headless',
conf: '--enable-headlessui --with-pulse',
deps: 'libpulse-dev' } ]
steps:
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
uses: actions/checkout@v4
- name: Download Documentation
uses: actions/download-artifact@v4
with:
name: vice-pdf
path: vice/doc/
- name: Install Dependencies
shell: bash
run: |
sudo apt update
sudo apt install -y autoconf \
automake \
build-essential \
byacc \
devscripts \
dos2unix \
fakeroot \
flex \
libasound-dev \
libcap-dev \
libcurl4-openssl-dev \
libflac-dev \
libgif-dev \
libieee1284-3-dev \
libmp3lame-dev \
libmpg123-dev \
libpcap-dev \
libpng-dev \
libvorbis-dev \
portaudio19-dev \
texinfo \
texlive-fonts-recommended \
texlive-latex-extra \
xa65
sudo apt install -y ${{ matrix.ui.deps }}
- name: Build
shell: bash
run: |
mkdir -p build/usr
cd vice
./src/buildtools/genvicedate_h.sh
./autogen.sh
# ALSA is required for SDL2 as well for midi support
./configure --enable-option-checking=fatal \
--prefix=/usr \
${{ matrix.ui.conf }} \
--disable-arch \
--disable-html-docs \
--enable-catweasel \
--enable-cpuhistory \
--enable-ethernet \
--enable-midi \
--enable-parsid \
--enable-pdf-docs \
--with-alsa \
--with-fastsid \
--with-flac \
--with-gif \
--with-lame \
--with-libcurl \
--with-libieee1284 \
--with-mpg123 \
--with-png \
--with-portaudio \
--with-resid \
--with-vorbis
make -j2 -s --no-print-directory SVN_REVISION_OVERRIDE=$(echo "${{ github.ref }}" | sed 's/^.*r//')
# Don't use install-strip, we want symbols intact for backtraces
make DESTDIR=$HOME/build install
- name: Make Deb
id: make_deb
shell: bash
run: ./vice/build/github-actions/build-deb.sh ${{ matrix.ui.name }}
- name: Upload Deb
id: upload_deb
uses: actions/github-script@v7
env:
UPLOAD_URL: ${{ needs.create_release.outputs.upload_url }}
ASSET_PATH: ${{ steps.make_deb.outputs.deb_path }}
ASSET_NAME: ${{ steps.make_deb.outputs.deb_name }}
ASSET_CONTENT_TYPE: application/vnd.debian.binary-package
with:
github-token: ${{secrets.GITHUB_TOKEN}}
retries: 3
script: |
const fs = require('fs');
const { UPLOAD_URL, ASSET_PATH, ASSET_NAME, ASSET_CONTENT_TYPE } = process.env;
const uploadAssetResponse = await github.rest.repos.uploadReleaseAsset({
url: UPLOAD_URL,
headers: {
'content-type': ASSET_CONTENT_TYPE,
'content-length': fs.statSync(ASSET_PATH).size
},
name: ASSET_NAME,
data: fs.readFileSync(ASSET_PATH)
});
publish_release:
name: Publish Release
needs: [create_release, build, build_deb]
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
retries: 3
script: |
await github.rest.repos.updateRelease(
{
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ needs.create_release.outputs.release_id }},
draft: false
});
build_error_notify:
name: IRC Notification of Build Errors
needs: [cleanup_previous_builds, create_release, build_doc, build, build_deb, publish_release]
runs-on: ubuntu-latest
if: ${{ failure() }}
steps:
- shell: bash
run: git config --global core.autocrlf input
- name: Checkout Source
uses: actions/checkout@v4
- name: Notify IRC of Build Failure
env:
IRC_PASS: ${{ secrets.IRC_PASS }}
shell: bash
run: |
./vice/build/github-actions/irc-message.sh "tried to build $(echo "${{ github.ref }}" | sed 's,.*/,,') but it failed :( $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"