Skip to content

Commit

Permalink
Add docker files for CI (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
FranzBusch authored Jun 23, 2023
1 parent a42b72a commit 2ace701
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 0 deletions.
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

0 comments on commit 2ace701

Please sign in to comment.