Collect lfs file into .lfs-asset-id file and print

pull/273/head
Frostebite 2021-07-01 22:59:18 +01:00
parent 9fd32a1aa6
commit 3832949643
3 changed files with 63 additions and 49 deletions

55
dist/index.js vendored
View File

@ -2081,47 +2081,54 @@ class RemoteBuilder {
static SetupStep(buildUid, buildParameters, branchName, defaultSecretsArray) { static SetupStep(buildUid, buildParameters, branchName, defaultSecretsArray) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.info('Starting step 1/4 clone and restore cache)'); core.info('Starting step 1/4 clone and restore cache)');
const projectPathFull = `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}`; const repoPathFull = `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}`;
const builderPathFull = `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/builder`;
const steamPathFull = `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/steam`;
const projectPathFull = `${repoPathFull}/${buildParameters.projectPath}`;
const cacheFolderFull = `${buildVolumeFolder}/${cacheFolder}`;
const libraryFolderFull = `${projectPathFull}/Library`;
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'alpine/git', [ yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'alpine/git', [
`apk update; `apk update;
apk add unzip; apk add unzip;
apk add git-lfs; apk add git-lfs;
apk add jq; apk add jq;
# Disable LFS
git config --global filter.lfs.smudge "git-lfs smudge --skip -- %f"
git config --global filter.lfs.process "git-lfs filter-process --skip"
# Get source repo for project to be built and game-ci repo for utilties # Get source repo for project to be built and game-ci repo for utilties
git clone https://${buildParameters.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git ${buildUid}/${repositoryFolder} git clone https://${buildParameters.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git ${buildUid}/${repositoryFolder}
# Enable LFS
git lfs ls-files -l --work-tree=${repoPathFull} | cut -d' ' -f1 | sort > .lfs-assets-id
ls
cat libraryCache.chk
# Get source repo for project to be built and game-ci repo for utilties
git config --global filter.lfs.smudge "git-lfs smudge -- %f"
git config --global filter.lfs.process "git-lfs filter-process"
cd ${buildUid}/${repositoryFolder}/ cd ${buildUid}/${repositoryFolder}/
git lfs ls-files -l | cut -d' ' -f1 | sort > .assets-id git lfs ls-files -l | cut -d' ' -f1 | sort > .assets-id
cd ../../ cd ../../
git clone https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git ${buildUid}/builder git clone https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git ${builderPathFull}
git clone https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git ${buildUid}/steam git clone https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git ${steamPathFull}
cd /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/ git checkout $GITHUB_SHA --work-tree=${repoPathFull}
git checkout $GITHUB_SHA echo 'checking cache'
cd /${buildVolumeFolder}/
# Look for usable cache # Look for usable cache
if [ ! -d ${cacheFolder} ]; then if [ ! -d ${cacheFolderFull} ]; then
mkdir ${cacheFolder} mkdir ${cacheFolderFull}
echo "creating new cache folder"
fi fi
cd ${cacheFolder} if [ ! -d ${cacheFolderFull}/${branchName} ]; then
if [ ! -d "${branchName}" ]; then mkdir ${cacheFolderFull}/${branchName}
mkdir "${branchName}" echo "creating new cache branch folder for: ${branchName}"
fi fi
cd "${branchName}" else
echo "Library cache for branch: ${branchName}"
ls ${cacheFolderFull}/${branchName}
echo '' echo ''
echo "Cached Libraries for ${branchName} from previous builds:" if [ -d ${libraryFolderFull} ]; then
ls rm -r ${libraryFolderFull}
echo ''
ls "${projectPathFull}"
libDir="/${projectPathFull}/Library"
if [ -d "$libDir" ]; then
rm -r "$libDir"
echo "Setup .gitignore to ignore Library folder and remove it from builds" echo "Setup .gitignore to ignore Library folder and remove it from builds"
fi fi
echo 'Checking cache' echo 'Checking cache'
find "${projectPathFull}/Library" -type f -exec md5sum "{}" + > libraryCache.chk
ls
cat libraryCache.chk
# Restore cache # Restore cache
latest=$(ls -t | head -1) latest=$(ls -t | head -1)
if [ ! -z "$latest" ]; then if [ ! -z "$latest" ]; then

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -87,7 +87,12 @@ class RemoteBuilder {
defaultSecretsArray: RemoteBuilderSecret[], defaultSecretsArray: RemoteBuilderSecret[],
) { ) {
core.info('Starting step 1/4 clone and restore cache)'); core.info('Starting step 1/4 clone and restore cache)');
const projectPathFull = `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}`; const repoPathFull = `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}`;
const builderPathFull = `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/builder`;
const steamPathFull = `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/steam`;
const projectPathFull = `${repoPathFull}/${buildParameters.projectPath}`;
const cacheFolderFull = `${buildVolumeFolder}/${cacheFolder}`;
const libraryFolderFull = `${projectPathFull}/Library`;
await this.RemoteBuilderProviderPlatform.runBuildTask( await this.RemoteBuilderProviderPlatform.runBuildTask(
buildUid, buildUid,
'alpine/git', 'alpine/git',
@ -96,43 +101,45 @@ class RemoteBuilder {
apk add unzip; apk add unzip;
apk add git-lfs; apk add git-lfs;
apk add jq; apk add jq;
# Disable LFS
git config --global filter.lfs.smudge "git-lfs smudge --skip -- %f"
git config --global filter.lfs.process "git-lfs filter-process --skip"
# Get source repo for project to be built and game-ci repo for utilties # Get source repo for project to be built and game-ci repo for utilties
git clone https://${buildParameters.githubToken}@github.com/${ git clone https://${buildParameters.githubToken}@github.com/${
process.env.GITHUB_REPOSITORY process.env.GITHUB_REPOSITORY
}.git ${buildUid}/${repositoryFolder} }.git ${buildUid}/${repositoryFolder}
# Enable LFS
git lfs ls-files -l --work-tree=${repoPathFull} | cut -d' ' -f1 | sort > .lfs-assets-id
ls
cat libraryCache.chk
# Get source repo for project to be built and game-ci repo for utilties
git config --global filter.lfs.smudge "git-lfs smudge -- %f"
git config --global filter.lfs.process "git-lfs filter-process"
cd ${buildUid}/${repositoryFolder}/ cd ${buildUid}/${repositoryFolder}/
git lfs ls-files -l | cut -d' ' -f1 | sort > .assets-id git lfs ls-files -l | cut -d' ' -f1 | sort > .assets-id
cd ../../ cd ../../
git clone https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git ${buildUid}/builder git clone https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git ${builderPathFull}
git clone https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git ${buildUid}/steam git clone https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git ${steamPathFull}
cd /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/ git checkout $GITHUB_SHA --work-tree=${repoPathFull}
git checkout $GITHUB_SHA echo 'checking cache'
cd /${buildVolumeFolder}/
# Look for usable cache # Look for usable cache
if [ ! -d ${cacheFolder} ]; then if [ ! -d ${cacheFolderFull} ]; then
mkdir ${cacheFolder} mkdir ${cacheFolderFull}
echo "creating new cache folder"
fi fi
cd ${cacheFolder} if [ ! -d ${cacheFolderFull}/${branchName} ]; then
if [ ! -d "${branchName}" ]; then mkdir ${cacheFolderFull}/${branchName}
mkdir "${branchName}" echo "creating new cache branch folder for: ${branchName}"
fi fi
cd "${branchName}" else
echo "Library cache for branch: ${branchName}"
ls ${cacheFolderFull}/${branchName}
echo '' echo ''
echo "Cached Libraries for ${branchName} from previous builds:" if [ -d ${libraryFolderFull} ]; then
ls rm -r ${libraryFolderFull}
echo ''
ls "${projectPathFull}"
libDir="/${projectPathFull}/Library"
if [ -d "$libDir" ]; then
rm -r "$libDir"
echo "Setup .gitignore to ignore Library folder and remove it from builds" echo "Setup .gitignore to ignore Library folder and remove it from builds"
fi fi
echo 'Checking cache' echo 'Checking cache'
find "${projectPathFull}/Library" -type f -exec md5sum "{}" + > libraryCache.chk
ls
cat libraryCache.chk
# Restore cache # Restore cache
latest=$(ls -t | head -1) latest=$(ls -t | head -1)
if [ ! -z "$latest" ]; then if [ ! -z "$latest" ]; then