Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate Snap builds - Take 1 #2278

Merged
merged 14 commits into from
May 3, 2024
36 changes: 36 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,42 @@ jobs:
name: wasm-client
path: freeciv21-client.*

snapcraft:
name: "Snap Package"
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
cmake \
ninja-build \
gettext \
qtbase5-dev \
libqt5svg5-dev \
libkf5archive-dev \
liblua5.3-dev \
libsqlite3-dev \
libsdl2-mixer-dev
- name: Configure
run: |
mkdir -p build/snap/local
cmake . -B build -G Ninja
cp data/icons/128x128/freeciv21-client.png build/snap/local
- uses: snapcore/action-build@v1
id: snapcraft
with:
path: build
- name: Upload a build
uses: actions/upload-artifact@v4
with:
name: snap
path: ${{ steps.snapcraft.outputs.snap }}

clang-format:
name: clang-format Code Formatter
runs-on: ubuntu-latest
Expand Down
41 changes: 37 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ name: Release
on:
release:
types: [published]
schedule:
- cron: "0 5 * * MON"
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch: {}

jobs:
update-autorevision:
name: "Update AutoRevision"
runs-on: ubuntu-22.04
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -42,10 +39,10 @@ jobs:
This PR updates `${{ steps.branch.outputs.branch }}`.
Close and reopen this pull request to start the CI.
delete-branch: true

update-archive:
name: "Update Source Archive"
runs-on: ubuntu-22.04
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -72,3 +69,39 @@ jobs:
Freeciv21-${{github.ref_name}}.tar.gz.sha256
Freeciv21-${{github.ref_name}}.zip
Freeciv21-${{github.ref_name}}.zip.sha256

snapcraft:
name: "Snap Package"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
cmake \
ninja-build \
gettext \
qtbase5-dev \
libqt5svg5-dev \
libkf5archive-dev \
liblua5.3-dev \
libsqlite3-dev \
libsdl2-mixer-dev
- name: Configure
run: |
mkdir -p build/snap/local
cmake . -B build -G Ninja
cp data/icons/128x128/freeciv21-client.png build/snap/local
- uses: snapcore/action-build@v1
id: snapcraft
with:
path: build
- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{ steps.snapcraft.outputs.snap }}
release: beta
jwrober marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ file(COPY_FILE "${CMAKE_BINARY_DIR}/utility/fc_version.h.new"
"${CMAKE_BINARY_DIR}/utility/fc_version.h"
ONLY_IF_DIFFERENT)

configure_file("dist/snapcraft.yaml.in" snap/snapcraft.yaml
@ONLY NEWLINE_STYLE UNIX)

# Include Installation Commands
include(FreecivInstall)

Expand Down
10 changes: 5 additions & 5 deletions dist/snapcraft.yaml → dist/snapcraft.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ description: |
Freeciv21 takes its roots in the well-known FOSS game Freeciv and extends it for more fun, with a revived focus on competitive multiplayer environments. Players can choose from over 500 nations and can play against the computer or other people in an active online community.
The code is maintained by the team over at Longturn.net and is based on the QT framework. The game supports both hex and square tiles and is easily modified to create custom rules.

# TODO: At some point, will want to integrate into cmake process and configure_file()
version: '3.1-beta.1'
version: '@FC21_MAJOR_VERSION@.@FC21_MINOR_VERSION@-@FC21_VERSION_LABEL@.@FC21_PATCH_VERSION@'
grade: devel

license: GPL-3.0-or-later
Expand All @@ -44,14 +43,15 @@ base: core22
# and the file was copied from <source_dir>/data/icons/128x128
icon: snap/local/freeciv21-client.png

architectures:
- build-on: amd64

parts:
freeciv21:
plugin: cmake
source: https://github.com/longturn/freeciv21.git
source-type: git
# TODO: integrate into cmake process and configure_file()
#source-branch: master
source-commit: baf62126f40b5b19115bba122189ca05ff46ef25
source-branch: master
cmake-generator: Ninja
cmake-parameters:
- "-DCMAKE_INSTALL_PREFIX=/usr"
Expand Down
9 changes: 7 additions & 2 deletions docs/Contributing/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ These are the general steps to prepare and finalize a release:
build file (:file:`.github/workflows/build.yaml`). Grab the Commit ID of the most recent release from
https://github.com/microsoft/vcpkg/releases. Commit and push a PR. Ensure all of the CI/CD Action runners
complete successfully.
#. If the new release is a change from ``alpha`` to ``beta`` or ``release candidate`` series, the
:file:`dist/snapcraft.yaml.in` file needs an update. Change the ``channel`` flag -- ``edge`` for Alpha,
``beta`` for Beta and ``candidate`` for the RC's
#. When it is time, the release manager will finalize the release notes and ask for an editorial review in the
``#releases-project`` channel. Updates are made as per review.
#. If the release will be the :strong:`first release candidate` towards a stable release, the release manager
Expand All @@ -40,10 +43,11 @@ These are the general steps to prepare and finalize a release:
#. Delete the existing ``stable`` branch on Github's
`branches page <https://github.com/longturn/freeciv21/branches>`_.
#. From the same page, create a new ``stable`` branch from ``master``.
#. Update ``cmake/AutoRevision.txt`` with the hash of the last commit in ``master`` and
#. Update :file:`cmake/AutoRevision.txt` with the hash of the last commit in ``master`` and
``v[major version].[minor version]-dev.0`` with the version of the :strong:`next stable release`, then
open a PR for this change to ``master``. This way, development builds from ``master`` will immediately
use the version number of the next stable.
#. Update :file:`dist/snapcraft.yaml.in` to change the ``channel`` tag to ``stable``.

#. If the release is a :strong:`release candidate` for a :strong:`stable release`, the release manager will
make sure that the :guilabel:`Target` branch in the release draft is set to ``stable``.
Expand All @@ -58,7 +62,8 @@ These are the general steps to prepare and finalize a release:
created PR's.
#. While inside the ``Release Update of AutoRevision.txt`` PR, the release manager will enable an automatic
rebase and merge.
#. The release manager will open an issue titled ``Review workarounds after <version> release`` with the following text:
#. The release manager will open an issue titled ``Review workarounds after <version> release`` with the
following text:

We should review the workarounds in the source code and check that they are still needed. Some
workarounds are documented here: :doc:`workarounds`.
Expand Down
Loading