followup #17561, skipping ci now implies green (#17813)

* followup #17561, skip ci now implies green; [skip ci]
* fixup [skip ci]
* fixup test without skip ci
* fixup [skip ci]
* fixup2 [skip ci]
* github actions now automatically supports [skip ci]
This commit is contained in:
Timothee Cour
2021-04-23 01:05:23 -07:00
committed by GitHub
parent e4a3feeb92
commit dbb053492a
4 changed files with 44 additions and 33 deletions

View File

@@ -30,9 +30,6 @@ on:
jobs:
build:
# see D20210329T004830
if: |
!contains(format('{0}', github.event.pull_request.title), '[skip ci]')
strategy:
fail-fast: false
matrix:
@@ -54,14 +51,6 @@ jobs:
with:
fetch-depth: 2
- name: 'Check whether to skip CI'
shell: bash
run: |
# see D20210329T004830
commitMsg=$(git log --no-merges -1 --pretty=format:"%s")
echo commitMsg: $commitMsg
echo $commitMsg | grep -v '\[skip ci\]'
- name: 'Install build dependencies (macOS)'
if: runner.os == 'macOS'
run: brew install make

View File

@@ -3,9 +3,6 @@ on: [push, pull_request]
jobs:
build:
# see D20210329T004830
if: |
!contains(format('{0}', github.event.pull_request.title), '[skip ci]')
strategy:
fail-fast: false
matrix:
@@ -23,14 +20,6 @@ jobs:
with:
fetch-depth: 2
- name: 'Check whether to skip CI'
shell: bash
run: |
# see D20210329T004830
commitMsg=$(git log --no-merges -1 --pretty=format:"%s")
echo commitMsg: $commitMsg
echo $commitMsg | grep -v '\[skip ci\]'
- name: 'Checkout csources'
uses: actions/checkout@v2
with:

View File

@@ -7,6 +7,10 @@ pr:
include:
- '*'
variables:
- name: skipci
value: false
jobs:
- job: packages
@@ -58,22 +62,22 @@ jobs:
fetchDepth: 2 # see D20210329T004830
- bash: |
# D20210329T004830:here refs https://github.com/microsoft/azure-pipelines-agent/issues/2944
# `--no-merges` is needed to avoid merge commits which occur for PR's.
# $(Build.SourceVersionMessage) is not helpful
# nor is `github.event.head_commit.message` for github actions.
commitMsg=$(git log --no-merges -1 --pretty=format:"%s")
echo commitMsg: $commitMsg
echo $commitMsg | grep -v '\[skip ci\]' # fails if [skip ci] not in commit msg
set -e
. ci/funs.sh
if nimIsCiSkip; then
echo '##vso[task.setvariable variable=skipci]true'
fi
displayName: 'Check whether to skip CI'
- bash: git clone --depth 1 https://github.com/nim-lang/csources_v1 csources
displayName: 'Checkout Nim csources'
condition: and(succeeded(), eq(variables['skipci'], 'false'))
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install node.js 12.x'
condition: and(succeeded(), eq(variables['skipci'], 'false'))
- bash: |
set -e
@@ -83,7 +87,7 @@ jobs:
echo_run sudo apt-fast install --no-install-recommends -yq \
libcurl4-openssl-dev libgc-dev libsdl1.2-dev libsfml-dev valgrind libc6-dbg
displayName: 'Install dependencies (amd64 Linux)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'amd64'))
condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'amd64'))
- bash: |
set -e
@@ -123,11 +127,11 @@ jobs:
echo_run chmod 755 bin/g++
displayName: 'Install dependencies (i386 Linux)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'i386'))
condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'i386'))
- bash: brew install boehmgc make sfml
displayName: 'Install dependencies (OSX)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Darwin'))
- bash: |
set -e
@@ -140,9 +144,10 @@ jobs:
echo_run echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/dist/mingw64/bin'
displayName: 'Install dependencies (Windows)'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Windows_NT'))
- bash: echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/bin'
condition: and(succeeded(), eq(variables['skipci'], 'false'))
displayName: 'Add build binaries to PATH'
- bash: |
@@ -155,15 +160,18 @@ jobs:
echo_run node -v
echo_run echo '##[section]make version'
echo_run make -v
condition: and(succeeded(), eq(variables['skipci'], 'false'))
displayName: 'System information'
- bash: echo '##vso[task.setvariable variable=csources_version]'"$(git -C csources rev-parse HEAD)"
condition: and(succeeded(), eq(variables['skipci'], 'false'))
displayName: 'Get csources version'
- task: Cache@2
inputs:
key: 'csources | "$(Agent.OS)" | $(CPU) | $(csources_version)'
path: csources/bin
condition: and(succeeded(), eq(variables['skipci'], 'false'))
displayName: 'Restore built csources'
- bash: |
@@ -192,13 +200,16 @@ jobs:
fi
echo_run cp csources/bin/nim$ext bin
condition: and(succeeded(), eq(variables['skipci'], 'false'))
displayName: 'Build 1-stage compiler from csources'
- bash: nim c koch
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'
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)

View File

@@ -1,4 +1,5 @@
# utilities used in CI pipelines to avoid duplication.
# Avoid top-level statements.
echo_run () {
# echo's a command before running it, which helps understanding logs
@@ -6,3 +7,24 @@ echo_run () {
echo "$@"
"$@"
}
nimGetLastCommit() {
git log --no-merges -1 --pretty=format:"%s"
}
nimIsCiSkip(){
# D20210329T004830:here refs https://github.com/microsoft/azure-pipelines-agent/issues/2944
# `--no-merges` is needed to avoid merge commits which occur for PR's.
# $(Build.SourceVersionMessage) is not helpful
# nor is `github.event.head_commit.message` for github actions.
# Note: `[skip ci]` is now handled automatically for github actions, see https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
commitMsg=$(nimGetLastCommit)
echo commitMsg: "$commitMsg"
if [[ $commitMsg == *"[skip ci]"* ]]; then
echo "skipci: true"
return 0
else
echo "skipci: false"
return 1
fi
}