Small optimization for the CI pipeline. (#15088)
* azure-pipelines: cache csources to speed up build Building csources takes about 2-4 mins, and since it hasn't changed for a long time, employ some caching to cut the time spent. * azure-pipelines: remove ppa avoidance configs Testing shows that there aren't any difference between having this and not having it, so removing this to simplify the code.
This commit is contained in:
parent
a62bc55955
commit
c292c57e48
1 changed files with 25 additions and 15 deletions
|
|
@ -53,9 +53,10 @@ jobs:
|
||||||
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
||||||
|
|
||||||
- checkout: self
|
- checkout: self
|
||||||
|
fetchDepth: 1
|
||||||
|
|
||||||
- bash: git clone --depth 1 https://github.com/nim-lang/csources.git
|
- bash: git clone --depth 1 https://github.com/nim-lang/csources
|
||||||
displayName: 'Checkout csources'
|
displayName: 'Checkout Nim csources'
|
||||||
|
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
inputs:
|
inputs:
|
||||||
|
|
@ -73,19 +74,12 @@ jobs:
|
||||||
- bash: |
|
- bash: |
|
||||||
sudo dpkg --add-architecture i386
|
sudo dpkg --add-architecture i386
|
||||||
|
|
||||||
# Downgrade llvm, libgcc and libstdc++:
|
# Downgrade llvm:
|
||||||
# - llvm has to be downgraded to have 32bit version installed for sfml.
|
# - llvm has to be downgraded to have 32bit version installed for sfml.
|
||||||
# - libgcc and libstdc++ have to be downgraded as an optimization to
|
|
||||||
# prevent the use of the toolchain ppa, which has a terrible download
|
|
||||||
# speed.
|
|
||||||
cat << EOF | sudo tee /etc/apt/preferences.d/pin-to-rel
|
cat << EOF | sudo tee /etc/apt/preferences.d/pin-to-rel
|
||||||
Package: libllvm6.0 libgcc1 libstdc++6
|
Package: libllvm6.0
|
||||||
Pin: origin "azure.archive.ubuntu.com"
|
Pin: origin "azure.archive.ubuntu.com"
|
||||||
Pin-Priority: 1001
|
Pin-Priority: 1001
|
||||||
|
|
||||||
Package: *
|
|
||||||
Pin: release o=LP-PPA-ubuntu-toolchain-r-test
|
|
||||||
Pin-Priority: 100
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sudo apt-fast update -qq
|
sudo apt-fast update -qq
|
||||||
|
|
@ -141,8 +135,18 @@ jobs:
|
||||||
make -v
|
make -v
|
||||||
displayName: 'System information'
|
displayName: 'System information'
|
||||||
|
|
||||||
|
- bash: echo '##vso[task.setvariable variable=csources_version]'"$(git -C csources rev-parse HEAD)"
|
||||||
|
displayName: 'Get csources version'
|
||||||
|
|
||||||
|
- task: Cache@2
|
||||||
|
inputs:
|
||||||
|
key: 'csources | "$(Agent.OS)" | $(CPU) | $(csources_version)'
|
||||||
|
path: csources/bin
|
||||||
|
displayName: 'Restore built csources'
|
||||||
|
|
||||||
- bash: |
|
- bash: |
|
||||||
ncpu=
|
ncpu=
|
||||||
|
ext=
|
||||||
case '$(Agent.OS)' in
|
case '$(Agent.OS)' in
|
||||||
'Linux')
|
'Linux')
|
||||||
ncpu=$(nproc)
|
ncpu=$(nproc)
|
||||||
|
|
@ -152,19 +156,25 @@ jobs:
|
||||||
;;
|
;;
|
||||||
'Windows_NT')
|
'Windows_NT')
|
||||||
ncpu=$NUMBER_OF_PROCESSORS
|
ncpu=$NUMBER_OF_PROCESSORS
|
||||||
|
ext=.exe
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
|
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
|
||||||
|
|
||||||
make -C csources -j $ncpu CC=gcc ucpu=$(CPU)
|
if [[ -x csources/bin/nim$ext ]]; then
|
||||||
displayName: 'Build csources'
|
echo "Found cached compiler, skipping build"
|
||||||
|
else
|
||||||
|
make -C csources -j $ncpu CC=gcc ucpu=$(CPU) koch=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp csources/bin/nim$ext bin
|
||||||
|
displayName: 'Build 1-stage compiler from csources'
|
||||||
|
|
||||||
- bash: nim c koch
|
- bash: nim c koch
|
||||||
displayName: 'Build koch'
|
displayName: 'Build koch'
|
||||||
|
|
||||||
# set result to omit the "bash exited with error code '1'" message
|
# set result to omit the "bash exited with error code '1'" message
|
||||||
- bash: |
|
- bash: ./koch runCI || echo '##vso[task.complete result=Failed]'
|
||||||
./koch runCI || echo '##vso[task.complete result=Failed]'
|
|
||||||
displayName: 'Run CI'
|
displayName: 'Run CI'
|
||||||
env:
|
env:
|
||||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue