...
 
Commits (988)

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
Subproject commit 957f9e4e8eb422dcb72f02f07767a1ed5969baab
#!/usr/bin/env python3
# A linter to warn when binary files are added to the repository
import sys
import os
import json
path = sys.argv[1]
warnings = []
if os.path.isfile(path):
with open(path, 'rb') as f:
if b'\0' in f.read(8000):
warning = {
'severity': 'warning',
'message': 'This file appears to be a binary file; does it really belong in the repository?'
}
warnings.append(warning)
print(json.dumps(warnings))
#!/usr/bin/env python3
# A linter to warn for ASSERT macros which are separated from their argument
# list by a space, which Clang's CPP barfs on
import sys
import logging
import os
import re
import json
def setup_logging(logger):
"""
``arc lint`` makes it quite tricky to catch debug output from linters.
Log to a file to work around this.
"""
hdlr = logging.FileHandler('linter.log', 'w')
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)
return logger
logger = logging.getLogger()
#setup_logging(logger)
logger.debug(sys.argv)
def add_warning(severity, message, line):
entry = {
'severity': severity,
'message': message,
'line': line
}
warnings.append(entry)
class Linter(object):
def __init__(self):
self.warnings = []
def add_warning(self, **entry):
self.warnings.append(entry)
def lint(self, path):
pass
class LineLinter(Linter):
def lint(self, path):
if os.path.isfile(path):
with open(path, 'rb') as f:
for lineno, line in enumerate(f):
self.lint_line(lineno+1, line)
def lint_line(self, lineno, line):
pass
class RegexpLinter(LineLinter):
def __init__(self, regex, **warning):
LineLinter.__init__(self)
self.re = re.compile(regex)
self.warning = warning
def lint_line(self, lineno, line):
if self.re.search(line):
warning = {
'line': lineno,
}
warning.update(self.warning)
self.add_warning(**warning)
linters = [
RegexpLinter(br'ASSERT\s+\(',
message='CPP macros should not have a space between the macro name and their argument list'),
RegexpLinter(br'#ifdef\s+',
message='`#if defined(x)` is preferred to `#ifdef x`',
severity='warning'),
RegexpLinter(br'#if\s+defined\s+',
message='`#if defined(x)` is preferred to `#if defined x`',
severity='warning'),
RegexpLinter(br'#ifndef\s+',
message='`#if !defined(x)` is preferred to `#ifndef x`',
severity='warning'),
]
if __name__ == '__main__':
path = sys.argv[1]
for linter in linters:
linter.lint(path)
warnings = [warning
for linter in linters
for warning in linter.warnings]
logger.debug(warnings)
print(json.dumps(warnings))
#!/usr/bin/env python3
# Warn for use of `--interactive` inside Makefiles (#11468).
#
# Encourage the use of `$(TEST_HC_OPTS_INTERACTIVE)` instead of
# `$(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0`. It's too easy to
# forget one of those flags when adding a new test.
import sys
import os
import json
import re
path = sys.argv[1]
warnings = []
if os.path.isfile(path):
with open(path) as f:
for lineno, line in enumerate(f):
if '--interactive' in line:
warning = {
'severity': 'warning',
'message': 'Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`',
'line': lineno+1,
}
warnings.append(warning)
print(json.dumps(warnings))
{
"project.name" : "ghc",
"repository.callsign" : "GHC",
"phabricator.uri" : "https://phabricator.haskell.org",
"base" : "git:merge-base(origin/master), arc:prompt",
"load": [
".arc-linters/arcanist-external-json-linter"
]
}
{
"linters": {
"filename": {
"type": "filename"
},
"generated": {
"type": "generated"
},
"merge-conflict": {
"type": "merge-conflict",
"exclude": "(\\.rst$)"
},
"nolint": {
"type": "nolint"
},
"haskell": {
"type": "text",
"include": ["(\\.(l?hs(-boot)?|x|y\\.pp)(\\.in)?$)"],
"severity": {
"5": "disabled",
"2": "warning"
}
},
"c": {
"type": "text",
"include": ["(\\.(c|h)(\\.in)?$)"],
"severity": {
"2": "warning"
}
},
"text-xml": {
"type": "text",
"include": "(\\.xml$)",
"severity": {
"5": "disabled",
"3": "disabled",
"2": "warning"
}
},
"shell": {
"type": "text",
"include": [ "(\\.sh$)" ],
"text.max-line-length": 200,
"severity": {
"2": "warning"
}
},
"makefiles": {
"type": "text",
"include": [ "(Makefile$)", "(\\.mk$)" ],
"text.max-line-length": 400,
"severity": {
"2": "disabled"
}
},
"cabal": {
"type": "text",
"include": ["(\\.cabal(\\.in)?$)"],
"severity": {
"5": "disabled",
"2": "warning"
}
},
"other-text": {
"type": "text",
"include": ["(.travis.yml?)", "(.md$)", "(.txt$)"],
"severity": {
"5": "disabled",
"2": "warning"
}
},
"check-binaries": {
"type": "external-json",
"external-json.script": "python3 .arc-linters/check-binaries.py"
},
"check-makefiles": {
"type": "external-json",
"include": ["(Makefile$)"],
"external-json.script": "python3 .arc-linters/check-makefiles.py"
},
"bad-assert-clang-cpp": {
"type": "external-json",
"include": ["(\\.(l?hs|x|y\\.pp)(\\.in)?$)", "(\\.(c|h)$)"],
"external-json.script": "python3 .arc-linters/check-cpp.py"
}
},
"exclude":
[ "(^libffi-tarballs)",
"(^libraries/binary)",
"(^libraries/bytestring)",
"(^libraries/Cabal)",
"(^libraries/containers)",
"(^libraries/haskeline)",
"(^libraries/pretty)",
"(^libraries/terminfo)",
"(^libraries/transformers)",
"(^libraries/xhtml)",
"(^libraries/Win32)",
"(^libraries/primitive)",
"(^libraries/vector)",
"(^libraries/time)",
"(^libraries/random)",
"(^libraries/array)",
"(^libraries/deepseq)",
"(^libraries/directory)",
"(^libraries/filepath)",
"(^libraries/haskell98)",
"(^libraries/haskell2010)",
"(^libraries/hoopl)",
"(^libraries/hpc)",
"(^libraries/old-locale)",
"(^libraries/old-time)",
"(^libraries/process)",
"(^libraries/unix)",
"(^libraries/parallel)",
"(^libraries/stm)",
"(^libraries/dph)",
"(^utils/haddock)",
"(^nofib)",
"(^utils/hsc2hs)",
"(^libffi-tarballs)",
"(^ghc-tarballs)"
]
}
# Questions about this file?
# See https://ghc.haskell.org/trac/ghc/wiki/ContinuousIntegration/Usage.
version: 2
aliases:
- &defaults
working_directory: ~/ghc
- &prepare
run:
name: prepare-system
command: .circleci/prepare-system.sh
- &submodules
run:
name: submodules
command: .circleci/fetch-submodules.sh
- &buildenv
# ideally we would simply set THREADS here instead of re-detecting it every
# time we need it below. Unfortunately, there is no way to set an environment
# variable with the result of a shell script.
SKIP_PERF_TESTS: NO
VERBOSE: 2
- &boot
run:
name: Boot
command: |
./boot
- &set_git_identity
run:
name: Set Git Identity
command: |
git config user.email "ghc-circleci@haskell.org"
git config user.name "GHC CircleCI"
- &configure_unix
run:
name: Configure
command: ./configure
- &configure_unix_32
run:
name: Configure
command: |
setarch i386 ./configure --with-ghc=/opt/ghc-i386/8.4.2/bin/ghc
- &configure_bsd
run:
name: Configure
command: ./configure --target=x86_64-unknown-freebsd10
- &configure_unreg
run:
name: Configure
command: ./configure --enable-unregisterised
- &make
run:
name: Build
command: "make -j`mk/detect-cpu-count.sh` V=0"
- &build_hadrian
run:
name: Build GHC using Hadrian
command: |
cabal update
hadrian/build.sh -j`mk/detect-cpu-count.sh`
- &test
run:
name: Test
command: |
mkdir -p test-results
METRICS_FILE=$(mktemp)
echo "export METRICS_FILE=$METRICS_FILE" >> $BASH_ENV
make test THREADS=`mk/detect-cpu-count.sh` SKIP_PERF_TESTS=$SKIP_PERF_TESTS TEST_ENV=$TEST_ENV JUNIT_FILE=../../test-results/junit.xml METRICS_FILE=$METRICS_FILE
- &store_test_results
store_test_results:
path: test-results
- &push_perf_note
run:
name: Push Performance Git Notes
command: .circleci/push-test-metrics.sh
- &store_test_artifacts
store_artifacts:
# we might want to add the whole output of the test phase
# too at some point
path: test-results/junit.xml
- &slowtest
run:
name: Full Test
command: |
mkdir -p test-results
make slowtest SKIP_PERF_TESTS=YES THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../test-results/junit.xml
- &bindist
run:
name: Create bindist
# Reduce compression effort to 3
command: make binary-dist TAR_COMP_OPTS="-2" && mv ghc*.tar.xz ghc.tar.xz
# Building bindist takes ~15 minutes without output, account for
# that.
no_output_timeout: "30m"
- &store_bindist
store_artifacts:
path: ghc.tar.xz
- &only_release_tags
tags:
only: /^ghc-.*/
- &ignore_gitlab_branches
branches:
ignore: /^gitlab\/.*/
jobs:
"validate-x86_64-freebsd":
docker:
- image: ghcci/x86_64-freebsd
environment:
TARGET: FreeBSD
<<: *buildenv
GHC_COLLECTOR_FLAVOR: x86_64-freebsd
TEST_ENV: x86_64-freebsd
steps:
- checkout
- *set_git_identity
- *prepare
- *submodules
- *boot
- *configure_bsd
- *make
- *bindist
- *store_bindist
- *test
- *store_test_results
- *store_test_artifacts
- *push_perf_note
"validate-x86_64-darwin":
macos:
xcode: "9.0"
environment:
# Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
BUILD_SPHINX_PDF: "NO"
MACOSX_DEPLOYMENT_TARGET: "10.7"
# Only Sierra and onwards supports clock_gettime. See #12858
ac_cv_func_clock_gettime: "no"
GHC_COLLECTOR_FLAVOR: x86_64-darwin
<<: *buildenv
TEST_ENV: x86_64-darwin
steps:
- checkout
- *set_git_identity
- *prepare
- *submodules
- *boot
- *configure_unix
- *make
- *bindist
- *store_bindist
- *test
- *store_test_results
- *store_test_artifacts
- *push_perf_note
"validate-x86_64-linux-deb8":
docker:
- image: ghcci/x86_64-linux-deb8:0.1
environment:
<<: *buildenv
GHC_COLLECTOR_FLAVOR: x86_64-linux
TEST_ENV: x86_64-linux-deb8
steps:
- checkout
- *set_git_identity
- *prepare
- *submodules
- *boot
- *configure_unix
- *make
- *bindist
- *store_bindist
- *test
- *store_test_results
- *store_test_artifacts
- *push_perf_note
"validate-x86_64-linux-deb9-integer-simple":
docker:
- image: ghcci/x86_64-linux-deb9:0.2
environment:
<<: *buildenv
INTEGER_LIBRARY: integer-simple
GHC_COLLECTOR_FLAVOR: x86_64-linux-deb9
steps:
- checkout
- *set_git_identity
- *prepare
- *submodules
- *boot
- *configure_unix
- *make
- *bindist
- *store_bindist
- *test
- *store_test_results
- *store_test_artifacts
- *push_perf_note
"validate-x86_64-linux-deb9":
docker:
- image: ghcci/x86_64-linux-deb9:0.1
environment:
<<: *buildenv
GHC_COLLECTOR_FLAVOR: x86_64-linux-deb9
TEST_ENV: x86_64-linux-deb9
steps:
- checkout
- *set_git_identity
- *prepare
- *submodules
- *boot
- *configure_unix