Merge branch 'develop'
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kieron Morris 2025-03-09 22:41:40 +00:00
commit 7bf53181e2
4 changed files with 71 additions and 88 deletions

52
.drone.yml Normal file
View File

@ -0,0 +1,52 @@
kind: pipeline
type: docker
name: build
steps:
- name: build-image
image: plugins/docker
settings:
repo: t3hn3rd/asuro-build
tags: latest
dockerfile: Dockerfile
registry: docker.io
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: compile
image: t3hn3rd/asuro-build:latest
depends_on:
- build-image
commands:
- git fetch --tags
- find . -type f -print0 | xargs -0 dos2unix
- chmod +x /drone/src/*.sh
- /drone/src/compile.sh
- name: upload-iso-artifact
image: alpine/git
depends_on:
- compile
when:
branch:
- master
environment:
GITEA_TOKEN:
from_secret: gitea_token
commands:
- apk add --no-cache curl
- chmod +w Asuro.iso
- cp Asuro.iso "Asuro-$(git rev-parse --short HEAD).iso"
- echo "Uploading Asuro-$(git rev-parse --short HEAD).iso to Gitea Packages..."
- |
curl -X PUT "https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/$(git rev-parse --short HEAD)/Asuro.iso" \
-H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso"
- echo "Updating latest ISO reference..."
- |
curl -X DELETE https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso \
-H "Authorization: token $GITEA_TOKEN" || echo "No previous latest version found."
- |
curl -X PUT https://gitea.spexeah.com/api/packages/Spexeah/generic/asuro-iso/latest/Asuro.iso \
-H "Authorization: token $GITEA_TOKEN" --upload-file "Asuro-$(git rev-parse --short HEAD).iso"

View File

@ -1,73 +0,0 @@
stages:
- Compile Versions
- Compile Sources
- Link
- Generate Documentation
- Deploy
cache:
- key: ${CI_COMMIT_REF_SLUG}
paths:
- lib/*.o
- bin/kernel.bin
- doc
before_script:
- chmod +x *.sh
versions:
stage: Compile Versions
script:
- ./compile_vergen.sh
artifacts:
paths:
- release/*.svg
- src/include/asuro.pas
compile_sources:
stage: Compile Sources
script:
- rm -f lib/*.so
- ./compile_sources.sh
needs:
- versions
link:
stage: Link
script:
- ./compile_stub.sh
- ./compile_link.sh
needs:
- versions
- compile_sources
isogen:
stage: Deploy
script:
- ./compile_isogen.sh
- ./compile_sumgen.sh
artifacts:
paths:
- ./Asuro.iso
- ./release/checksum.svg
needs:
- link
docgen:
stage: Generate Documentation
only:
- master
- develop
script:
- ./compile_sourcelist.sh
- ./compile_docs.sh
# Remove comments when we want to use gitlab pages.
#- cp doc public
allow_failure: true
artifacts:
paths:
- doc
#- public/*
#- ./sources.list
needs:
- versions

View File

@ -16,7 +16,7 @@ RUN curl -sL https://sourceforge.net/projects/freepascal/files/Linux/$FPC_VERSIO
COPY compile.sh /compile.sh
ADD https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver /usr/bin/semver
RUN mkdir /code && chmod +x /usr/bin/semver
RUN chmod +x /usr/bin/semver
WORKDIR /code
RUN find . -type f -print0 | xargs -0 dos2unix
ENTRYPOINT ["/bin/bash", "-c"]

View File

@ -20,26 +20,30 @@ runOrFail() {
fi
}
runOrFail $(pwd)/compile_stub.sh "Failed to compile stub!"
declare -a run_steps=(
"compile_stub.sh" "Failed to compile stub!"
"compile_vergen.sh" "Versions failed to compile"
"compile_sources.sh" "Failed to compile FPC Sources!"
"compile_link.sh" "Failed linking!"
"compile_isogen.sh" "Failed to create ISO!"
)
#Generate .pas with versioning headers.
runOrFail $(pwd)/compile_vergen.sh "Versions failed to compile"
#Compile all .pas sources
runOrFail $(pwd)/compile_sources.sh "Failed to compile FPC Sources!"
#Link into a binary.
runOrFail $(pwd)/compile_link.sh "Failed linking!"
#Generate an ISO with GRUB as the Bootloader.
runOrFail ./compile_isogen.sh "Failed to create ISO!"
for ((i=0; i<${#run_steps[@]}; i+=2))
do
if [ "$ERRCOUNT" -eq "0" ]
then
script=$(pwd)/"${run_steps[$i]}"
message="${run_steps[$i+1]}"
runOrFail "$script" "$message"
fi
done
#Call generate final artifacts based on failure or success of the above.
if [ "$ERRCOUNT" -ne "0" ]
then
./compile_finish.sh "failed"
. ./compile_finish.sh "failed"
else
./compile_finish.sh "success"
. ./compile_finish.sh "success"
fi
cd ..