Skip to content

Commit

Permalink
test: Add Dockerfile test
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Dec 1, 2023
1 parent 8f8c885 commit f73ae8e
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ build --enable_platform_specific_config
build --watchfs
build --local_cpu_resources=HOST_CPUS
build --features=layering_check
build --features=treat_warnings_as_errors

# Fully dynamic build.
build:dynamic --dynamic_mode=fully
Expand Down Expand Up @@ -218,11 +219,13 @@ build:msan --test_env=MSAN_OPTIONS=color=always:external_symbolizer_path=/nix/st
build:msan --per_file_copt='//toxic[:/]@-UAUDIO,-UVIDEO,-UPYTHON'

build:tsan --config=sanitizer
build:tsan --features=tsan
build:tsan --copt='-fsanitize=thread'
build:tsan --linkopt='-fsanitize=thread'
build:tsan --test_env=TSAN_OPTIONS=color=always,history_size=7,force_seq_cst_atomics=1:external_symbolizer_path=/nix/store/643f0y8q5yfzrqq4kn56dc13xvz90srv-llvm-16.0.1/bin/llvm-symbolizer

build:ubsan --config=sanitizer
build:ubsan --features=ubsan
build:ubsan --copt='-fno-sanitize-recover=all'
build:ubsan --copt='-fsanitize=nullability,undefined'
#build:ubsan --per_file_copt='//c-toxcore[:/]@-fsanitize=integer'
Expand Down Expand Up @@ -326,7 +329,6 @@ build:gnulike --conlyopt='-std=gnu17'
build:gnulike --per_file_copt='\\.c$@-std=c17'

build:gnulike --copt='-Wall'
build:gnulike --copt='-Werror'
build:gnulike --copt='-Wformat'
build:gnulike --copt='-Wformat-security'

Expand Down
2 changes: 2 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ haskell_register_ghc_nixpkgs(
"-fdiagnostics-color=always",
# TODO(iphydf): Move to hs-cimple.
"-Wno-redundant-constraints",
"-optc=-Wno-unused-command-line-argument",
"-optl=-Wl,--no-fatal-warnings",
],
#fully_static_link = True,
nix_file = "//:ghc.nix",
Expand Down
2 changes: 1 addition & 1 deletion hs-tokstyle
3 changes: 2 additions & 1 deletion tools/built/src/home/.config/home-manager/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
map Q gqap
au BufEnter BUILD.* set ft=bzl
au FileType bzl,haskell,lhaskell set ts=4 sw=4
au FileType c,cpp,bzl,haskell,lhaskell set ts=4 sw=4
au FileType sh set ts=2 sw=2
au FileType go set noexpandtab
" .lhs files need a long distance sync for highlighting
au FileType lhaskell :au BufEnter * :syntax sync fromstart
Expand Down
7 changes: 4 additions & 3 deletions tools/project/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ exports_files(srcs = [
"cabal_test",
"diff_test.sh",
"haskell/cirrus.yml.in",
"haskell/github/checks.yml",
"haskell/github/ci.yml",
"haskell/github/publish.yml",
"haskell/github/docker/Dockerfile.in",
"haskell/github/workflows/checks.yml",
"haskell/github/workflows/ci.yml",
"haskell/github/workflows/publish.yml",
"readme_test.sh",
"settings_test.sh",
"yamllint.rc",
Expand Down
27 changes: 24 additions & 3 deletions tools/project/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ _haskell_ci = rule(

def _haskell_ci_tests(haskell_package, custom_cirrus, custom_github):
if not custom_github and native.glob([".github/workflows/ci.yml"], allow_empty = True):
for workflow in ["checks", "ci", "publish"]:
yml_cur = ".github/workflows/%s.yml" % workflow
yml_ref = "//tools/project:haskell/github/%s.yml" % workflow
for workflow in ["workflows/checks.yml", "workflows/ci.yml", "workflows/publish.yml"]:
yml_cur = ".github/%s" % workflow
yml_ref = "//tools/project:haskell/github/%s" % workflow
native.sh_test(
name = "github_%s_test" % workflow,
size = "small",
Expand All @@ -48,6 +48,27 @@ def _haskell_ci_tests(haskell_package, custom_cirrus, custom_github):
],
)

_haskell_ci(
name = "dockerfile",
package = haskell_package,
template = "//tools/project:haskell/github/docker/Dockerfile.in",
)

native.sh_test(
name = "dockerfile_test",
size = "small",
srcs = ["@diffutils//:diff"],
args = [
"-u",
"$(location .github/docker/Dockerfile)",
"$(location :dockerfile)",
],
data = [
".github/docker/Dockerfile",
":dockerfile",
],
)

if not custom_cirrus:
_haskell_ci(
name = "cirrus_ci",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tools/project/update_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eux

for i in hs-*/.github/workflows/ci.yml; do
for wf in tools/project/haskell/github/*.yml; do
for wf in tools/project/haskell/github/workflows/*.yml; do
cp "$wf" "$(dirname "$i")/$(basename "$wf")"
done
done
Expand All @@ -14,5 +14,5 @@ for i in hs-*/; do
if ! grep custom_cirrus "$i"BUILD.bazel; then
sed -e "s/{PACKAGE}/$PKG/g" tools/project/haskell/cirrus.yml.in >"$i".cirrus.yml
fi
sed -e "s/{PACKAGE}/$PKG/g" tools/project/haskell/github/Dockerfile >"$i".github/docker/Dockerfile
sed -e "s/{PACKAGE}/$PKG/g" tools/project/haskell/github/docker/Dockerfile.in >"$i".github/docker/Dockerfile
done

0 comments on commit f73ae8e

Please sign in to comment.