Skip to content

Add docker files for CI #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# file options

--swiftversion 5.7
--exclude .build

# format options

--self insert
--patternlet inline
--ranges nospace
--stripunusedargs unnamed-only
--ifdef no-indent
--extensionacl on-declarations
--disable typeSugar # https://github.com/nicklockwood/SwiftFormat/issues/636
--disable andOperator
--disable wrapMultilineStatementBraces
--disable enumNamespaces
--disable redundantExtensionACL
--disable redundantReturn
--disable preferKeyPath
--disable sortedSwitchCases
--disable hoistAwait
--disable hoistTry

# rules
24 changes: 24 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG swift_version=5.7
ARG ubuntu_version=focal
ARG base_image=swift:$swift_version-$ubuntu_version
FROM $base_image
# needed to do again after FROM due to docker limitation
ARG swift_version
ARG ubuntu_version

# set as UTF-8
RUN apt-get update && apt-get install -y locales locales-all
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# tools
RUN mkdir -p $HOME/.tools
RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile

# swiftformat (until part of the toolchain)

ARG swiftformat_version=0.51.12
RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format
RUN cd $HOME/.tools/swift-format && swift build -c release
RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat
22 changes: 22 additions & 0 deletions docker/docker-compose.2004.57.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3"

services:

runtime-setup:
image: swift-async-algorithms:20.04-5.7
build:
args:
ubuntu_version: "focal"
swift_version: "5.7"

build:
image: swift-async-algorithms:20.04-5.7

test:
image: swift-async-algorithms:20.04-5.7
environment: []
#- SANITIZER_ARG: "--sanitize=thread"
#- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt"

shell:
image: swift-async-algorithms:20.04-5.7
21 changes: 21 additions & 0 deletions docker/docker-compose.2004.58.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3"

services:

runtime-setup:
image: swift-async-algorithms:20.04-5.8
build:
args:
base_image: "swiftlang/swift:nightly-5.8-focal"

build:
image: swift-async-algorithms:20.04-5.8

test:
image: swift-async-algorithms:20.04-5.8
environment: []
#- SANITIZER_ARG: "--sanitize=thread"
#- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt"

shell:
image: swift-async-algorithms:20.04-5.8
21 changes: 21 additions & 0 deletions docker/docker-compose.2204.main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3"

services:

runtime-setup:
image: swift-async-algorithms:22.04-main
build:
args:
base_image: "swiftlang/swift:nightly-main-jammy"

build:
image: swift-async-algorithms:22.04-main

test:
image: swift-async-algorithms:22.04-main
environment: []
#- SANITIZER_ARG: "--sanitize=thread"
#- TSAN_OPTIONS: "no_huge_pages_for_shadow=0 suppressions=/code/tsan_suppressions.txt"

shell:
image: swift-async-algorithms:22.04-main
39 changes: 39 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# this file is not designed to be run directly
# instead, use the docker-compose.<os>.<swift> files
# eg docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.2004.56.yaml run test
version: "3"

services:
runtime-setup:
image: swift-async-algorithms:default
build:
context: .
dockerfile: Dockerfile

common: &common
image: swift-async-algorithms:default
depends_on: [runtime-setup]
volumes:
- ~/.ssh:/root/.ssh
- ..:/code:z
working_dir: /code

soundness:
<<: *common
command: /bin/bash -xcl "swift -version && uname -a && ./scripts/soundness.sh"

build:
<<: *common
environment: []
command: /bin/bash -cl "swift build"

test:
<<: *common
depends_on: [runtime-setup]
command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"

# util

shell:
<<: *common
entrypoint: /bin/bash