mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 06:45:27 +00:00
refactor common code in CI pipelines (#18035)
* refactor CI with nimInternalInstallDepsWindows * refactor CI with nimInternalBuildKochAndRunCI * fixup
This commit is contained in:
@@ -22,15 +22,11 @@ tasks:
|
||||
set -e
|
||||
cd Nim
|
||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||
- test: |
|
||||
set -e
|
||||
cd Nim
|
||||
if ! ./koch runCI; then
|
||||
nim r tools/ci_testresults.nim
|
||||
exit 1
|
||||
fi
|
||||
. ci/funs.sh && nimInternalBuildKochAndRunCI
|
||||
triggers:
|
||||
- action: email
|
||||
condition: failure
|
||||
|
||||
@@ -22,15 +22,11 @@ tasks:
|
||||
set -e
|
||||
cd Nim
|
||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||
- test: |
|
||||
set -e
|
||||
cd Nim
|
||||
if ! ./koch runCI; then
|
||||
nim r tools/ci_testresults.nim
|
||||
exit 1
|
||||
fi
|
||||
. ci/funs.sh && nimInternalBuildKochAndRunCI
|
||||
triggers:
|
||||
- action: email
|
||||
condition: failure
|
||||
|
||||
@@ -22,15 +22,11 @@ tasks:
|
||||
set -e
|
||||
cd Nim
|
||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||
- test: |
|
||||
set -e
|
||||
cd Nim
|
||||
if ! ./koch runCI; then
|
||||
nim r tools/ci_testresults.nim
|
||||
exit 1
|
||||
fi
|
||||
. ci/funs.sh && nimInternalBuildKochAndRunCI
|
||||
triggers:
|
||||
- action: email
|
||||
condition: failure
|
||||
|
||||
8
.github/workflows/ci_docs.yml
vendored
8
.github/workflows/ci_docs.yml
vendored
@@ -59,11 +59,9 @@ jobs:
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir dist
|
||||
curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
|
||||
curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
|
||||
7z x dist/mingw64.7z -odist
|
||||
7z x dist/dlls.zip -obin
|
||||
set -e
|
||||
. ci/funs.sh
|
||||
nimInternalInstallDepsWindows
|
||||
echo "${{ github.workspace }}/dist/mingw64/bin" >> "${GITHUB_PATH}"
|
||||
|
||||
- name: 'Add build binaries to PATH'
|
||||
|
||||
22
.github/workflows/ci_packages.yml
vendored
22
.github/workflows/ci_packages.yml
vendored
@@ -40,12 +40,10 @@ jobs:
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir dist
|
||||
curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
|
||||
curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
|
||||
7z x dist/mingw64.7z -odist
|
||||
7z x dist/dlls.zip -obin
|
||||
echo "${{ github.workspace }}/dist/mingw64/bin" >> "${GITHUB_PATH}"
|
||||
set -e
|
||||
. ci/funs.sh
|
||||
nimInternalInstallDepsWindows
|
||||
echo_run echo "${{ github.workspace }}/dist/mingw64/bin" >> "${GITHUB_PATH}"
|
||||
|
||||
- name: 'Add build binaries to PATH'
|
||||
shell: bash
|
||||
@@ -59,14 +57,6 @@ jobs:
|
||||
shell: bash
|
||||
run: . ci/funs.sh && nimBuildCsourcesIfNeeded CC=gcc ucpu='${{ matrix.cpu }}'
|
||||
|
||||
- name: 'Build koch'
|
||||
- name: 'koch, Run CI'
|
||||
shell: bash
|
||||
run: nim c koch
|
||||
- name: 'Run CI'
|
||||
shell: bash
|
||||
run: ./koch runCI
|
||||
|
||||
- name: 'Show failed tests'
|
||||
if: failure()
|
||||
shell: bash
|
||||
run: nim c -r tools/ci_testresults.nim
|
||||
run: . ci/funs.sh && nimInternalBuildKochAndRunCI
|
||||
|
||||
@@ -133,11 +133,7 @@ jobs:
|
||||
- bash: |
|
||||
set -e
|
||||
. ci/funs.sh
|
||||
echo_run mkdir dist
|
||||
echo_run curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
|
||||
echo_run curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
|
||||
echo_run 7z x dist/mingw64.7z -odist
|
||||
echo_run 7z x dist/dlls.zip -obin
|
||||
nimInternalInstallDepsWindows
|
||||
echo_run echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/dist/mingw64/bin'
|
||||
|
||||
displayName: 'Install dependencies (Windows)'
|
||||
@@ -163,13 +159,9 @@ jobs:
|
||||
# condition: and(succeeded(), eq(variables['skipci'], 'false'))
|
||||
# displayName: 'Restore built csourcesAny'
|
||||
|
||||
- bash: nim c koch
|
||||
- bash: . ci/funs.sh && nimInternalBuildKochAndRunCI
|
||||
# would could also show on failure: echo '##vso[task.complete result=Failed]'
|
||||
condition: and(succeeded(), eq(variables['skipci'], 'false'))
|
||||
displayName: 'Build koch'
|
||||
|
||||
# set result to omit the "bash exited with error code '1'" message
|
||||
- bash: ./koch runCI || echo '##vso[task.complete result=Failed]'
|
||||
condition: and(succeeded(), eq(variables['skipci'], 'false'))
|
||||
displayName: 'Run CI'
|
||||
displayName: 'koch, Run CI'
|
||||
env:
|
||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||
|
||||
17
ci/funs.sh
17
ci/funs.sh
@@ -31,6 +31,23 @@ nimIsCiSkip(){
|
||||
fi
|
||||
}
|
||||
|
||||
nimInternalInstallDepsWindows(){
|
||||
echo_run mkdir dist
|
||||
echo_run curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
|
||||
echo_run curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
|
||||
echo_run 7z x dist/mingw64.7z -odist
|
||||
echo_run 7z x dist/dlls.zip -obin
|
||||
}
|
||||
|
||||
nimInternalBuildKochAndRunCI(){
|
||||
echo_run nim c koch
|
||||
if ! echo_run ./koch runCI; then
|
||||
echo_run echo "runCI failed"
|
||||
echo_run nim r -tools/ci_testresults.nim
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
nimDefineVars(){
|
||||
. config/build_config.txt
|
||||
nim_csources=bin/nim_csources_$nim_csourcesHash
|
||||
|
||||
@@ -29,15 +29,11 @@ tasks:
|
||||
set -e
|
||||
cd Nim
|
||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||
- test: |
|
||||
set -e
|
||||
cd Nim
|
||||
if ! ./koch runCI; then
|
||||
nim r tools/ci_testresults.nim
|
||||
exit 1
|
||||
fi
|
||||
. ci/funs.sh && nimInternalBuildKochAndRunCI
|
||||
triggers:
|
||||
- action: email
|
||||
condition: failure
|
||||
|
||||
Reference in New Issue
Block a user