Skip to content

Commit 2ace701

Browse files
authored
Add docker files for CI (apple#270)
1 parent a42b72a commit 2ace701

6 files changed

+152
-0
lines changed

.swiftformat

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# file options
2+
3+
--swiftversion 5.7
4+
--exclude .build
5+
6+
# format options
7+
8+
--self insert
9+
--patternlet inline
10+
--ranges nospace
11+
--stripunusedargs unnamed-only
12+
--ifdef no-indent
13+
--extensionacl on-declarations
14+
--disable typeSugar # https://github.com/nicklockwood/SwiftFormat/issues/636
15+
--disable andOperator
16+
--disable wrapMultilineStatementBraces
17+
--disable enumNamespaces
18+
--disable redundantExtensionACL
19+
--disable redundantReturn
20+
--disable preferKeyPath
21+
--disable sortedSwitchCases
22+
--disable hoistAwait
23+
--disable hoistTry
24+
25+
# rules

docker/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG swift_version=5.7
2+
ARG ubuntu_version=focal
3+
ARG base_image=swift:$swift_version-$ubuntu_version
4+
FROM $base_image
5+
# needed to do again after FROM due to docker limitation
6+
ARG swift_version
7+
ARG ubuntu_version
8+
9+
# set as UTF-8
10+
RUN apt-get update && apt-get install -y locales locales-all
11+
ENV LC_ALL en_US.UTF-8
12+
ENV LANG en_US.UTF-8
13+
ENV LANGUAGE en_US.UTF-8
14+
15+
# tools
16+
RUN mkdir -p $HOME/.tools
17+
RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile
18+
19+
# swiftformat (until part of the toolchain)
20+
21+
ARG swiftformat_version=0.51.12
22+
RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format
23+
RUN cd $HOME/.tools/swift-format && swift build -c release
24+
RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat

docker/docker-compose.2004.57.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: "3"
2+
3+
services:
4+
5+
runtime-setup:
6+
image: swift-async-algorithms:20.04-5.7
7+
build:
8+
args:
9+
ubuntu_version: "focal"
10+
swift_version: "5.7"
11+
12+
build:
13+
image: swift-async-algorithms:20.04-5.7
14+
15+
test:
16+
image: swift-async-algorithms:20.04-5.7
17+
environment: []
18+
#- SANITIZER_ARG: "--sanitize=thread"
19+
#- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt"
20+
21+
shell:
22+
image: swift-async-algorithms:20.04-5.7

docker/docker-compose.2004.58.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: "3"
2+
3+
services:
4+
5+
runtime-setup:
6+
image: swift-async-algorithms:20.04-5.8
7+
build:
8+
args:
9+
base_image: "swiftlang/swift:nightly-5.8-focal"
10+
11+
build:
12+
image: swift-async-algorithms:20.04-5.8
13+
14+
test:
15+
image: swift-async-algorithms:20.04-5.8
16+
environment: []
17+
#- SANITIZER_ARG: "--sanitize=thread"
18+
#- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt"
19+
20+
shell:
21+
image: swift-async-algorithms:20.04-5.8

docker/docker-compose.2204.main.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: "3"
2+
3+
services:
4+
5+
runtime-setup:
6+
image: swift-async-algorithms:22.04-main
7+
build:
8+
args:
9+
base_image: "swiftlang/swift:nightly-main-jammy"
10+
11+
build:
12+
image: swift-async-algorithms:22.04-main
13+
14+
test:
15+
image: swift-async-algorithms:22.04-main
16+
environment: []
17+
#- SANITIZER_ARG: "--sanitize=thread"
18+
#- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt"
19+
20+
shell:
21+
image: swift-async-algorithms:22.04-main

docker/docker-compose.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# this file is not designed to be run directly
2+
# instead, use the docker-compose.<os>.<swift> files
3+
# eg docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.2004.56.yaml run test
4+
version: "3"
5+
6+
services:
7+
runtime-setup:
8+
image: swift-async-algorithms:default
9+
build:
10+
context: .
11+
dockerfile: Dockerfile
12+
13+
common: &common
14+
image: swift-async-algorithms:default
15+
depends_on: [runtime-setup]
16+
volumes:
17+
- ~/.ssh:/root/.ssh
18+
- ..:/code:z
19+
working_dir: /code
20+
21+
soundness:
22+
<<: *common
23+
command: /bin/bash -xcl "swift -version && uname -a && ./scripts/soundness.sh"
24+
25+
build:
26+
<<: *common
27+
environment: []
28+
command: /bin/bash -cl "swift build"
29+
30+
test:
31+
<<: *common
32+
depends_on: [runtime-setup]
33+
command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"
34+
35+
# util
36+
37+
shell:
38+
<<: *common
39+
entrypoint: /bin/bash

0 commit comments

Comments
 (0)