Skip to content

Commit

Permalink
chore: Update release related tasks (#1048)
Browse files Browse the repository at this point in the history
* chore: iscc: put file in build/tmp/iscc

Currently iscc script use mktemp -d to make context of container command.
There is a limitation of some container environment such as Rancher Desktop
that only allow run under users home directory, because of
binding user home directory under their environment.

This changes the TMPDIR as $PROJECT_DIR/build/tmp/iscc
It allows nerdctl command with Rancher desktop working.

Signed-off-by: Hiroshi Miura <[email protected]>

* chore: enable gradle scan

- integration test
- azure-pipelines build tasks
- remove gradle-scan.init.gradle that is not necessary for now.

Signed-off-by: Hiroshi Miura <[email protected]>

* chore: bump [email protected]

- Guarantee JVM daemon run on Java 17

Signed-off-by: Hiroshi Miura <[email protected]>

* chore: improve win generation tasks

- explicitly define input and output files in genDist tasks
- add debug log after call iscc
- iscc to skip container build when exists
- change distsTask to be Sync instead of Copy

Signed-off-by: Hiroshi Miura <[email protected]>

* chore: update ci/iscc

- Fix container CLI detection

Signed-off-by: Hiroshi Miura <[email protected]>

---------

Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr committed Jun 2, 2024
1 parent 20e43d1 commit 234d228
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 29 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/gradle-build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v3
name: validate gradle wrapper
- name: Agree gradle-scan terms
run: cat ci/gradle/gradle-scan.init.gradle >> settings.gradle
- uses: gradle/actions/setup-gradle@v3
name: Setup Gradle
id: setup-gradle
Expand Down
24 changes: 17 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ application {
mainClass = 'org.omegat.Main'
}

tasks.named('updateDaemonJvm') {
jvmVersion = JavaVersion.VERSION_17
}

def shortDescription = 'The free translation memory tool'
def distDescription = 'OmegaT is a free and open source multiplatform Computer Assisted Translation tool with' +
' fuzzy matching, translation memory, keyword search, glossaries, and translation leveraging into updated' +
Expand Down Expand Up @@ -1324,20 +1328,26 @@ ext.makeWinTask = { args ->
'InnoSetup or Docker not installed'])
}
dependsOn prepDistsTaskName
outputs.upToDateWhen {
// detect up-to-date when OmegaT.jar exists and newer than libs/OmegaT.jar
def f1 = layout.buildDirectory.file("innosetup/${args.name}/${installerBasename}.exe").get().asFile
def f2 = layout.buildDirectory.file("innosetup/${args.name}/OmegaT.jar").get().asFile
f1.exists() && f2.exists() && f1.lastModified() > f2.lastModified()
}
inputs.files(
layout.buildDirectory.file("innosetup/${args.name}/OmegaT.jar"),
layout.buildDirectory.file("innosetup/${args.name}/OmegaT.iss"),
layout.buildDirectory.file("innosetup/${args.name}/OmegaT.l4j.ini"),
)
// You'd think we could just set the PATH, but there be dragons here
// https://github.com/palantir/gradle-docker/issues/162
def exe = exePresent('iscc') ? 'iscc' : file('ci/iscc')
def iss = layout.buildDirectory.file("innosetup/${args.name}/OmegaT.iss").get().asFile
logging.captureStandardOutput LogLevel.INFO
commandLine exe, '/Qp', iss
outputs.file layout.buildDirectory.file("innosetup/${args.name}/${installerBasename}.exe")
doLast {
println ""
def f3 = layout.buildDirectory.file("innosetup/${args.name}/${installerBasename}.exe").get().asFile
logger.info('Built ' + f3.toString() + "(" + f3.length() + ")")
}
}

tasks.register(distsTaskName, Copy) {
tasks.register(distsTaskName, Sync) {
description = "Create a Windows installer for ${args.name} distro. " +
'Requires Inno Setup (http://www.jrsoftware.org/isinfo.php).'
onlyIf {
Expand Down
2 changes: 1 addition & 1 deletion ci/azure-pipelines/build_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ steps:
- task: Gradle@3
inputs:
tasks: 'clean sourceDistZip distZip mac linux win'
options: '--build-cache -PenvIsCi -PassetDir=$(System.ArtifactsDirectory)/asset'
options: '--build-cache -PenvIsCi --scan -PassetDir=$(System.ArtifactsDirectory)/asset'
jdkVersionOption: '1.17'
displayName: 'Build distribution packages and docs'
- script: echo "##vso[task.setvariable variable=result;]false"
Expand Down
2 changes: 1 addition & 1 deletion ci/azure-pipelines/check_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ steps:
displayName: Check
inputs:
tasks: check
options: '-PenvIsCi --no-daemon'
options: '-PenvIsCi --no-daemon --scan'
jdkVersionOption: '1.17'
6 changes: 0 additions & 6 deletions ci/gradle/gradle-scan.init.gradle

This file was deleted.

22 changes: 15 additions & 7 deletions ci/iscc
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ bindpaths() {
done
}

# set TMPDIR for context creation
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
TMPDIR=$( dirname ${SCRIPT_DIR} )/build/tmp

# workaround for build failure on CI env.
# see https://sourceforge.net/p/omegat/bugs/1228/
PUID=`id -u`
PGID=`id -g`
IMAGE=omegatorg/innosetup:innosetup6
CONTEXT=`mktemp -d`
CONTEXT=${TMPDIR}/iscc
mkdir -p $CONTEXT

cat << __EOF__ > $CONTEXT/Dockerfile
FROM docker.io/amake/innosetup:innosetup6-buster
Expand All @@ -32,13 +37,16 @@ WORKDIR /work
ENTRYPOINT ["iscc"]
__EOF__

CMD="$(type -p docker)" || [[ -e $CMD ]] && $CMD info >/dev/null 2>1 || CMD="$(type -p nerdctl)"
echo select container CLI: $CMD
$CMD info || false
CMD="$(type -p docker)" && $CMD info >/dev/null 2>&1 || CMD="$(type -p nerdctl)" && $CMD info > /dev/null || false
echo Select container CLI: $CMD

if ! $CMD build -t $IMAGE $CONTEXT ; then
echo Container build error for ISCC, abort...
exit 1
IMAGEID=$($CMD images -q $IMAGE)
if [[ -z "$IMAGEID" ]]; then
echo Now build custom image
if ! $CMD build -t $IMAGE $CONTEXT ; then
echo Container build error for ISCC, abort...
exit 1
fi
fi
exec $CMD run -i --rm \
-u `id -u`:`id -g` \
Expand Down
5 changes: 2 additions & 3 deletions ci/osslsigncode
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ bindpaths() {
done
}

CMD="$(type -p docker)" || [[ -e $CMD ]] && $CMD info >/dev/null 2>1 || CMD="$(type -p nerdctl)"
echo select container CLI: $CMD
$CMD info || false
CMD="$(type -p docker)" && $CMD info >/dev/null 2>1 || CMD="$(type -p nerdctl)" && $CMD info >/dev/null || false
echo Select container CLI: $CMD

# build container image
CTX=$(mktemp -d)
Expand Down
2 changes: 2 additions & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#This file is generated by updateDaemonJvm
toolchainVersion=17
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion test-integration/docker/client/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ chmod 600 /home/omegat/.ssh/id_rsa
ssh-keyscan -H server > /home/omegat/.ssh/known_hosts

cd /workdir
exec /opt/gradle/bin/gradle testIntegration \
exec /opt/gradle/bin/gradle testIntegration --scan \
-Djava.util.logging.config.file=/workdir/test-integration/logger.properties \
-Domegat.test.duration=${DURATION} -Domegat.test.repo=${REPO} \
-Domegat.test.repo.alt=${REPO2} -Domegat.test.map.repo=http://server/ -Domegat.test.map.file=README

0 comments on commit 234d228

Please sign in to comment.