Skip to content

Commit

Permalink
Build with GitHub Actions and update snapshot release, remove Jenkins…
Browse files Browse the repository at this point in the history
…file and related scripts
  • Loading branch information
michaliskambi authored Jun 13, 2024
1 parent 79163ee commit 076c2f1
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 85 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: [castle-engine, michaliskambi] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: castleengine # Replace with a single Patreon username
open_collective: castle-engine # Replace with a single Open Collective username
# ko_fi: # Replace with a single Ko-fi username
# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
# liberapay: # Replace with a single Liberapay username
# issuehunt: # Replace with a single IssueHunt username
# otechie: # Replace with a single Otechie username
# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Check that GitHub Actions use latest versions of plugins.
# See https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot .

version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
158 changes: 158 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# ----------------------------------------------------------------------------
# GitHub Actions workflow to build this application.
# Using latest Castle Game Engine ( https://castle-engine.io/ ) snapshot.
# For multiple platforms (Linux, Windows, macOS).

# ( Not Android, for now -- through glplotter would work on Android,
# it requires to rearrange the code to follow latest CGE best practices
# for cross-platform projects, instead of doing everything from main LPR file.
# See https://castle-engine.io/manual_cross_platform.php . )
#
# This uses GitHub-hosted runners, that is: you don't need to set up any server
# infrastructure, GitHub provides it all for free for open-source projects.
#
# See docs:
# - https://castle-engine.io/github_actions
# - https://docs.github.com/en/actions
# ----------------------------------------------------------------------------

name: Build
on: [push, pull_request]

jobs:
# Build for platforms supported by
# CGE Docker image https://hub.docker.com/r/kambi/castle-engine-cloud-builds-tools/ .
#
# Since setting up Docker image takes majority of time (5-6 mins)
# compared to actually getting and compiling CGE (1 min)
# and building application (~1 min for each platform),
# we build all platforms possible within one job.
build-using-docker:
name: Build Using Docker
runs-on: ubuntu-latest
container: kambi/castle-engine-cloud-builds-tools:cge-none
steps:
- uses: actions/checkout@v4
# Set env CASTLE_ENGINE_PATH following
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
# https://brandur.org/fragments/github-actions-env-vars-in-env-vars
- name: Castle Game Engine - Env CASTLE_ENGINE_PATH
run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV
- name: Castle Game Engine - Env PATH (non-Windows)
run: echo "PATH=$PATH:$CASTLE_ENGINE_PATH/tools/build-tool/" >> $GITHUB_ENV
- name: Castle Game Engine - Clone snapshot
run: git clone --depth 1 --single-branch --branch snapshot https://github.com/castle-engine/castle-engine/
- name: Castle Game Engine - Build
run: cd $CASTLE_ENGINE_PATH/tools/build-tool/ && ./castle-engine_compile.sh

# We clean and build gen_function separately, then we add it to glplotter
# because "gen_function" and "gen_function.exe"
# are listed in CastleEngineManifest.xml .
- name: Build gen_function for Windows
run: |
rm -f gen_function gen_function.exe
castle-engine clean --verbose
castle-engine simple-compile gen_function.lpr --os=win64 --cpu=x86_64 --verbose
- name: Package Windows
run: castle-engine package --os=win64 --cpu=x86_64 --verbose
- name: Archive Artifacts
# See https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
with:
name: windows-build
# Note: Keep paths that start with asterisk in double qoutes, to avoid misinterpreting as YAML reference.
# See https://stackoverflow.com/questions/19109912/yaml-do-i-need-quotes-for-strings-in-yaml
# https://yamlchecker.com/
path: "*-win64-x86_64.zip"
if-no-files-found: error

# We clean and build gen_function separately, then we add it to glplotter
# because "gen_function" and "gen_function.exe"
# are listed in CastleEngineManifest.xml .
- name: Build gen_function for Linux
run: |
rm -f gen_function gen_function.exe
castle-engine clean --verbose
castle-engine simple-compile gen_function.lpr --os=linux --cpu=x86_64 --verbose
- name: Package Linux
run: castle-engine package --os=linux --cpu=x86_64 --verbose
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: linux-build
path: "*-linux-x86_64.tar.gz"
if-no-files-found: error

# Build for platforms supported from macOS.
# This means to build for macOS and (maybe in the future) iOS.
build-macos:
name: Build Using macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install FPC+Lazarus
uses: gcarreno/[email protected]
with:
lazarus-version: stable
- name: Castle Game Engine - Env CASTLE_ENGINE_PATH
run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV
- name: Castle Game Engine - Env PATH (non-Windows)
run: echo "PATH=$PATH:$CASTLE_ENGINE_PATH/tools/build-tool/" >> $GITHUB_ENV
- name: Castle Game Engine - Clone snapshot
run: git clone --depth 1 --single-branch --branch snapshot https://github.com/castle-engine/castle-engine/
- name: Castle Game Engine - Build
run: cd $CASTLE_ENGINE_PATH/tools/build-tool/ && ./castle-engine_compile.sh

# We clean and build gen_function separately, then we add it to glplotter
# because "gen_function" and "gen_function.exe"
# are listed in CastleEngineManifest.xml .
- name: Build gen_function for macOS
run: |
rm -f gen_function gen_function.exe
castle-engine clean --verbose
castle-engine simple-compile gen_function.lpr --os=darwin --cpu=x86_64 --verbose
- name: Package macOS
run: castle-engine package --os=darwin --cpu=x86_64 --verbose
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: macos-build
path: "*-darwin-x86_64.zip"
if-no-files-found: error

release:
name: Release
runs-on: ubuntu-latest
# Only upload release if all builds, on all runners, succeeded.
needs: [build-using-docker, build-macos]
steps:
- name: Download packaged releases
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: List downloaded files
run: ls -R
- name: GH CLI status
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh auth status
# Releases files in the "snapshot" release.
- name: Release Artifacts
if: ${{ github.ref == 'refs/heads/master' }}
run: gh release --repo ${{ github.repository }} upload snapshot --clobber *.zip *.tar.gz
env:
GH_TOKEN: ${{ github.token }}

update-release-tag:
name: Update Release Tag (make snapshot tag point to the build commit on master branch)
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: actions/checkout@v4
- name: Update Release Tag
if: ${{ github.ref == 'refs/heads/master' }}
run: |
# --force allows to overwrite previous tag
git tag --force snapshot
# --force allows to push with overwritten tag
git push --force origin snapshot
2 changes: 1 addition & 1 deletion CastleEngineManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
author="Michalis Kamburelis"
qualified_name="io.castleengine.glplotter"
>
<version value="2.0.0" code="2" />
<version value="2.1.0" code="3" />
<data exists="false" />
<package>
<include path="COPYING.GPL2.txt" />
Expand Down
44 changes: 0 additions & 44 deletions Jenkinsfile

This file was deleted.

11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ glplotter draws graphs. It can generate graphs of various functions (you can spe

This repository also includes `gen_function`, a command-line program that generates graph file from given function expression.

Complete documentation on https://castle-engine.io/glplotter_and_gen_function.php .
Complete documentation on https://castle-engine.io/glplotter.php .

Using Castle Game Engine, see https://castle-engine.io/ .

Expand Down
5 changes: 0 additions & 5 deletions compile.sh

This file was deleted.

5 changes: 2 additions & 3 deletions gen_function.lpr
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{ -*- compile-command: "castle-engine simple-compile gen_function.lpr" -*- }
{
Copyright 2001-2021 Michalis Kamburelis.
Copyright 2001-2024 Michalis Kamburelis.
This file is part of "gen_function".
Expand Down Expand Up @@ -44,7 +43,7 @@
CastleFilesUtils, CastleTimeUtils, CastleApplicationProperties;

const
Version = '2.0.0';
Version = '2.1.0';

var
expr: TCasScriptExpression;
Expand Down
4 changes: 2 additions & 2 deletions glplotter.lpr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
Copyright 2001-2023 Michalis Kamburelis.
Copyright 2001-2024 Michalis Kamburelis.
This file is part of "glplotter".
Expand Down Expand Up @@ -37,7 +37,7 @@
CastleDownload, CastleRenderContext, CastleApplicationProperties;

const
Version = '2.0.0';
Version = '2.1.0';

{ colors -------------------------------------------------------------------- }

Expand Down
18 changes: 0 additions & 18 deletions pack.sh

This file was deleted.

0 comments on commit 076c2f1

Please sign in to comment.