Skip to content

Commit

Permalink
Merge pull request #2 from theavege/add/github-actions
Browse files Browse the repository at this point in the history
Add/GitHub actions
  • Loading branch information
wp-xyz authored Nov 3, 2024
2 parents 4f0fd8b + d6ac8d8 commit 85ced84
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
33 changes: 33 additions & 0 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Make

on:
push:
branches:
- "**"
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os:
- ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Build on Linux
if: runner.os == 'Linux'
shell: bash
run: bash -x make.sh build
69 changes: 69 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash

function priv_clippit
(
cat <<EOF
Usage: bash ${0} [OPTIONS]
Options:
build Build program
EOF
)

function priv_pkgsearch
(
if ((${#})); then
for REPLY in "${@}"; do
lazbuild --verbose-pkgsearch "${REPLY}" || lazbuild --add-package "${REPLY}"
done
fi
)

function priv_packages
(
if [[ -d 'use' ]]; then
git submodule update --init --recursive
else
mkdir 'use'
fi
if ((${#})); then
for REPLY in "${@}"; do
declare -A VAR=(
[url]="https://packages.lazarus-ide.org/${REPLY}.zip"
[out]=$(mktemp)
[dir]=${REPLY##/*}
)
wget --output-document "${VAR[out]}" "${VAR[url]}"
unzip -o "${VAR[out]}" -d "use/${VAR[dir]}"
rm --verbose "${VAR[out]}"
done
fi
find 'use' -type 'f' -name '*.lpk' -exec lazbuild --add-package-link {} +
)

function priv_main
(
set -euo pipefail
if ! (which lazbuild); then
source '/etc/os-release'
case ${ID:?} in
debian | ubuntu)
sudo apt-get update
sudo apt-get install -y lazarus
;;
esac
fi
if ((${#})); then
case ${1} in
build)
priv_pkgsearch
priv_packages 'FPSpreadsheet' 'Synapse40.1'
find 'source' -type 'f' -name '*.lpi' \
-exec lazbuild --no-write-project --recursive --no-write-project {} 1>&2 +
;;
esac
else
priv_clippit
fi
)

priv_main "${@}" >/dev/null

0 comments on commit 85ced84

Please sign in to comment.