From: Ben Beltran Date: Mon, 13 May 2019 21:22:58 +0000 (+0200) Subject: Makes test environment docker-based X-Git-Tag: 1.0.0^2^2~9 X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli/commitdiff_plain/6a628388c496987819ef26bda1a99595bce2b1d5?ds=sidebyside Makes test environment docker-based Provides Dockerfile to build test environment that should be used by CI --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d984cb..ebe400d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: swift:5.0.1 +image: lyriclitest/swift:5.0.1 stages: - lint @@ -11,12 +11,6 @@ cache: paths: - .build/ -before_script: - - apt install -y ruby ruby-dev libsqlite3-dev wget - - gem install jazzy - - "./Scripts/install_sourcekitten.sh" - - "./Scripts/install_swiftlint.sh" - lint: stage: lint script: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..db35f5c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +ARG swift_version=latest +FROM swift:${swift_version} + +RUN apt-get update && apt-get install -y \ + libsqlite3-dev \ + ruby \ + ruby-dev \ + wget \ + && rm -rf /var/lib/apt/lists/* + +RUN gem install --no-ri --no-rdoc jazzy + +# SourceKitten + +RUN git clone https://github.com/jpsim/SourceKitten.git /tmp/SourceKitten \ + && cd /tmp/SourceKitten \ + && make install \ + && rm -rf /tmp/SourceKitten + +# Swiftlint + +RUN git clone https://github.com/realm/SwiftLint.git /tmp/SwiftLint \ + && cd /tmp/SwiftLint \ + && git submodule update --init --recursive \ + && make install \ + && rm -rf /tmp/SwiftLint diff --git a/Makefile b/Makefile index 3066e11..d993480 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ target_binary_name = lrc install_path = /usr/local/bin source_binary_path = $(build_path)/$(configuration)/$(source_binary_name) install_binary_path = $(install_path)/$(target_binary_name) +swift_version = 5.0.1 # Default to release configuration on install install: configuration = release @@ -40,4 +41,10 @@ document: build clean: swift package clean -.PHONY: build install test clean lint +docker-build: + docker build --force-rm --build-arg swift_version=$(swift_version) -t lyriclitest/swift:$(swift_version) . + +docker-push: docker-build + docker push lyriclitest/swift:$(swift_version) + +.PHONY: build install test clean lint docker-build docker-push diff --git a/Scripts/install_sourcekitten.sh b/Scripts/install_sourcekitten.sh deleted file mode 100755 index f94fb53..0000000 --- a/Scripts/install_sourcekitten.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Installs SourceKitten from source (Intended to be used with -# swift docker image) - -set -e - -git clone https://github.com/jpsim/SourceKitten.git /tmp/SourceKitten && -cd /tmp/SourceKitten && -make install diff --git a/Scripts/install_swiftlint.sh b/Scripts/install_swiftlint.sh deleted file mode 100755 index 4b8299d..0000000 --- a/Scripts/install_swiftlint.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Installs SwiftLint from source (Intended to be used with -# swift docker image) - -set -e - -git clone https://github.com/realm/SwiftLint.git /tmp/SwiftLint && -cd /tmp/SwiftLint && -git submodule update --init --recursive && -make install