]> git.r.bdr.sh - rbdr/lyricli/commitdiff
Makes test environment docker-based
authorBen Beltran <redacted>
Mon, 13 May 2019 21:22:58 +0000 (23:22 +0200)
committerBen Beltran <redacted>
Mon, 13 May 2019 21:22:58 +0000 (23:22 +0200)
Provides Dockerfile to build test environment that should be used
by CI

.gitlab-ci.yml
Dockerfile [new file with mode: 0644]
Makefile
Scripts/install_sourcekitten.sh [deleted file]
Scripts/install_swiftlint.sh [deleted file]

index 4d984cb3e35e0482d2c7dc14f3e99325e218130a..ebe400d5e949e3b5af7313c048d2e3cc06de7164 100644 (file)
@@ -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 (file)
index 0000000..db35f5c
--- /dev/null
@@ -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
index 3066e117f8c07449ee80dc09644d43320c9fa956..d993480f3ef8e5e58ef591af05fbc452a36c1ebb 100644 (file)
--- 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 (executable)
index f94fb53..0000000
+++ /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 (executable)
index 4b8299d..0000000
+++ /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