Skip to content

Commit

Permalink
[FIXUP] try to fix Git LFS installation
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Jan 3, 2024
1 parent 7ebf16a commit a863170
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
- name: checkout swt
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: 'eclipse.platform.swt' #TODO: is this still necessary?
fetch-depth: 0 # required for jgit timestamp provider to work
lfs: true
- name: Install Linux requirements
Expand All @@ -58,15 +57,13 @@ jobs:
with:
run: >-
mvn --batch-mode -V -U
-DforceContextQualifier=zzz
-DforkCount=1
-Dcompare-version-with-baselines.skip=false
-Dmaven.compiler.failOnWarning=true
--fail-at-end
-DskipNativeTests=false
-DfailIfNoTests=false
clean install
working-directory: eclipse.platform.swt
- name: Performance tests
if: contains(github.event.pull_request.labels.*.name, 'performance')
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 # v1.0.1
Expand All @@ -81,7 +78,6 @@ jobs:
-DfailIfNoTests=true
-Dtest=PerformanceTests
integration-test
working-directory: eclipse.platform.swt/tests/org.eclipse.swt.tests
- name: Upload Test Results for ${{ matrix.config.name }} / Java-${{ matrix.java }}
if: always()
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
Expand Down
45 changes: 37 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ pipeline {
}
stages {
stage('Checkout swt git repos') {
environment {
PATH = "${WORKSPACE}/tools/git-lfs:${env.PATH}" // Add git-lfs (installed subsequently) to PATH explicitly until it is available by default
}
steps {
dir('tools') { // download git-lfs until it is available by default
sh '''
curl -L https://github.com/git-lfs/git-lfs/releases/download/v3.4.1/git-lfs-linux-amd64-v3.4.1.tar.gz | tar -xzf -
mv git-lfs-* git-lfs
'''
}
withEnv(["PATH=${WORKSPACE}/tools/git-lfs:" + env.PATH]) {
dir('eclipse.platform.swt') {
checkout scm
script {
Expand All @@ -93,20 +95,42 @@ pipeline {
error('Abort build only triggered by automated SWT-natives update.')
}
}
// Temporarily install hooks manually
writeFile(file:'.git/hooks/pre-push', text:'''
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs pre-push "$@"
''')
writeFile(file:'.git/hooks/post-checkout', text:'''
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-checkout "$@"
''')
writeFile(file:'.git/hooks/post-commit', text:'''
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-commit "$@"
''')
writeFile(file:'.git/hooks/post-merge', text:'''
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-merge "$@"
''')
sh '''
echo $PATH
git version
git lfs version
git lfs install --local # install Git LFS only locally for the repository
git lfs install --local --skip-repo # install Git LFS only locally for the repository but skip the hooks that have been added manually above
git lfs pull
git fetch --all --tags --quiet
git remote set-url --push origin git@github.com:eclipse-platform/eclipse.platform.swt.git
'''
}
}
}
}
stage('Check if SWT-binaries build is needed') {
environment {
PATH = "${WORKSPACE}/tools/git-lfs:${env.PATH}" // Add git-lfs (installed subsequently) to PATH explicitly until it is available by default
}
steps {
withAnt(installation: 'apache-ant-latest', jdk: 'openjdk-jdk11-latest') { // nashorn javascript-engine required in ant-scripts
sh'''
Expand Down Expand Up @@ -183,8 +207,9 @@ pipeline {
ls -1R libs
'''
} else {
withEnv(['PATH=C:\\tools\\cygwin\\bin;' + env.PATH]) {
withEnv(['PATH=C:\\tools\\cygwin\\bin;' + env.PATH.replace(':',';')]) {
bat '''
echo %PATH%
unzip org.eclipse.swt.%PLATFORM%.master.zip
rm org.eclipse.swt.%PLATFORM%.master.zip
mkdir libs
Expand Down Expand Up @@ -260,6 +285,9 @@ pipeline {
}
}
stage('Commit SWT-native binaries, if build') {
environment {
PATH = "${WORKSPACE}/tools/git-lfs:${env.PATH}" // Add git-lfs (installed subsequently) to PATH explicitly until it is available by default
}
when {
expression { return params.forceNativeBuilds || fileExists ('tmp/build_changed.txt') }
}
Expand Down Expand Up @@ -297,7 +325,7 @@ pipeline {
sh '''
mvn clean verify \
--batch-mode -DforkCount=0 \
-DforceContextQualifier=zzz
-DforceContextQualifier=zzz \
-Dcompare-version-with-baselines.skip=false -Dmaven.compiler.failOnWarning=true \
-Dmaven.test.failure.ignore=true -Dmaven.test.error.ignore=true
'''
Expand All @@ -314,6 +342,9 @@ pipeline {
}
}
stage('Push SWT-native binaries, if build') {
environment {
PATH = "${WORKSPACE}/tools/git-lfs:${env.PATH}" // Add git-lfs (installed subsequently) to PATH explicitly until it is available by default
}
when {
expression { return params.forceNativeBuilds || fileExists ('tmp/build_changed.txt') }
}
Expand All @@ -325,7 +356,6 @@ pipeline {
newSWTNativesTag = sh(script: 'git describe --abbrev=0 --tags --match v[0-9][0-9][0-9][0-9]*', returnStdout: true).strip()
}
echo "newSWTNativesTag: ${newSWTNativesTag}"
withEnv(["PATH=${WORKSPACE}/tools/git-lfs:" + env.PATH]) { //TODO: remove this once GIT-LFS is installed by default
sh """
# Check for the master-branch as late as possible to have as much of the same behaviour as possible
if [[ '${BRANCH_NAME}' == master ]] || [[ '${BRANCH_NAME}' =~ R[0-9]+_[0-9]+(_[0-9]+)?_maintenance ]]; then
Expand All @@ -350,7 +380,6 @@ pipeline {
git log -n 2
popd
"""
}
}
}
}
Expand Down

0 comments on commit a863170

Please sign in to comment.