Kaynağa Gözat

Enable testing in ci builds

Jguer 5 yıl önce
ebeveyn
işleme
d50ca0430b
3 değiştirilmiş dosya ile 64 ekleme ve 11 silme
  1. 10 8
      Dockerfile
  2. 0 3
      config_test.go
  3. 54 0
      testdata/ci/pacman.conf

+ 10 - 8
Dockerfile

@@ -5,15 +5,17 @@ LABEL maintainer="Jguer,joaogg3 at google mail"
 ENV GO111MODULE=on
 WORKDIR /app
 
+ADD ./testdata/ci/pacman.conf /etc/pacman.conf
+
 RUN pacman -Syu --overwrite=* --needed --noconfirm \
-    gcc gnupg libldap go git tar make awk linux-api-headers pacman-contrib && paccache -rfk0
+    gcc gnupg libldap go git tar make awk linux-api-headers pacman pacman-contrib && paccache -rfk0
 
 # Dependency for linting
-RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /bin v1.20.0
+RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /bin v1.20.0
 RUN go get golang.org/x/lint/golint && mv /root/go/bin/golint /bin/
 
 ENV ARCH=$BUILD_ARCH
-ADD . .
+COPY . .
 
 FROM builder_env AS builder
 
@@ -26,15 +28,15 @@ RUN pacman -Syu --overwrite=* --needed --noconfirm \
     git base-devel awk pacman-contrib && paccache -rfk0
 
 # Gracefully removed from https://github.com/Cognexa/dockerfiles/blob/master/dockerfiles/archlinux
-RUN useradd -m -s /bin/bash aur \
-    && passwd -d aur \
-    && echo 'aur ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/aur \
-    && echo 'Defaults env_keep += "EDITOR"' >> /etc/sudoers.d/aur
+RUN useradd -m -s /bin/bash aur && \
+    passwd -d aur && \
+    echo 'aur ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/aur && \
+    echo 'Defaults env_keep += "EDITOR"' >>/etc/sudoers.d/aur
 
 ENV EDITOR vim
 
 # set UTF-8 locale
-RUN echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && locale-gen
+RUN echo 'en_US.UTF-8 UTF-8' >/etc/locale.gen && locale-gen
 ENV LANG en_US.UTF-8
 
 WORKDIR /work/

+ 0 - 3
config_test.go

@@ -39,9 +39,6 @@ func TestConfig(t *testing.T) {
 	hook, err := h.HookDirs()
 	expect(t, "HookDir", []string{"/usr/share/libalpm/hooks/", "/hookdir/"}, hook.Slice(), err)
 
-	delta, err := h.DeltaRatio()
-	expect(t, "UseDelta", 0.5, delta, err)
-
 	arch, err := h.Arch()
 	expect(t, "Architecture", "8086", arch, err)
 

+ 54 - 0
testdata/ci/pacman.conf

@@ -0,0 +1,54 @@
+#
+# /etc/pacman.conf
+#
+# See the pacman.conf(5) manpage for option and repository directives
+
+#
+# GENERAL OPTIONS
+#
+[options]
+# The following paths are commented out with their default values listed.
+# If you wish to use different paths, uncomment and update the paths.
+#RootDir     = /
+#DBPath      = /var/lib/pacman/
+#CacheDir    = /var/cache/pacman/pkg/
+#LogFile     = /var/log/pacman.log
+#GPGDir      = /etc/pacman.d/gnupg/
+#HookDir     = /etc/pacman.d/hooks/
+HoldPkg     = pacman glibc
+#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
+#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
+#CleanMethod = KeepInstalled
+Architecture = auto
+
+# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
+#IgnorePkg   =
+#IgnoreGroup =
+
+#NoUpgrade   =
+#NoExtract   =
+
+# Misc options
+#UseSyslog
+#Color
+#TotalDownload
+CheckSpace
+#VerbosePkgLists
+
+SigLevel = Never
+LocalFileSigLevel = Optional
+
+[testing]
+Include = /etc/pacman.d/mirrorlist
+
+[core]
+Include = /etc/pacman.d/mirrorlist
+
+[extra]
+Include = /etc/pacman.d/mirrorlist
+
+[community-testing]
+Include = /etc/pacman.d/mirrorlist
+
+[community]
+Include = /etc/pacman.d/mirrorlist