Remove arch-travis and directly use docker

This commit is contained in:
Filippo Squillace 2022-12-18 20:40:41 +00:00 committed by Filippo Squillace
parent c052e660ee
commit fab5b0df2e
5 changed files with 45 additions and 67 deletions

View file

@ -9,39 +9,6 @@ cache:
services:
- docker
archlinux:
mount:
- ~/.ccache:~/.ccache
- ~/.pkg-cache:/var/cache/pacman/pkg
packages:
# Pacman packages
- ccache
- git
- haveged
before_install:
# 1.Override `package-cleanup.hook` to preserve cache for travis.
# 2.Enable ccache
# 3.Multithreaded build and compress
# 4.Suppress all gcc warnings
- |
sudo mkdir /etc/pacman.d/hooks/
sudo ln -s /dev/null /etc/pacman.d/hooks/package-cleanup.hook
sudo sed -i '/^BUILDENV/s/\!ccache/ccache/' /etc/makepkg.conf
sudo sed -i '/#MAKEFLAGS=/c MAKEFLAGS="-j2"' /etc/makepkg.conf
sudo sed -i '/^COMPRESSXZ/s/\xz/xz -T 2/' /etc/makepkg.conf
sudo sed -i '$a CFLAGS="$CFLAGS -w"' /etc/makepkg.conf
sudo sed -i '$a CXXFLAGS="$CXXFLAGS -w"' /etc/makepkg.conf
sudo pacman -Syy --noconfirm --disable-download-timeout
sudo pacman-key --init
sudo pacman -S --noconfirm --disable-download-timeout archlinux-keyring
sudo pacman-key --populate archlinux
sudo pacman -Su --noconfirm --disable-download-timeout
script:
# Here do not make any validation (-n) because it will be done later on in the Ubuntu host directly
- ./bin/junest build -n
env:
matrix:
- TRAVIS_BASH_VERSION="4.0"
@ -75,7 +42,8 @@ script:
# Build and validation
#######################
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
- "curl -s https://raw.githubusercontent.com/fsquillace/arch-travis/master/arch-travis.sh | bash"
- docker run --rm -v "$(pwd):/build" -v ~/.ccache:/home/travis/.ccache -v ~/.pkg-cache:/var/cache/pacman/pkg --privileged archlinux:latest bash /build/ci/build_image.sh
- "echo pacman pkg cache size: $(du -h ~/.pkg-cache|cut -f1) in $(ls ~/.pkg-cache|wc -l) files"
- ls -l
# Test the newly created JuNest image against Ubuntu host

15
ci/build_image.sh Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -ex
pacman -Sy --noconfirm sudo
# Create a travis user
echo "travis ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/travis
chmod 'u=r,g=r,o=' /etc/sudoers.d/travis
groupadd --gid "2000" "travis"
useradd --create-home --uid "2000" --gid "2000" --shell /usr/bin/false "travis"
# Here do not make any validation (-n) because it will be done later on in the Ubuntu host directly
cd /build
runuser -u travis -- /build/bin/junest build -n

View file

@ -47,26 +47,9 @@ info "Initial JuNest setup..."
# otherwise it is not possible to exit from the session
trap "[[ -e /etc/pacman.d/gnupg/S.gpg-agent ]] && gpg-connect-agent -S /etc/pacman.d/gnupg/S.gpg-agent killagent /bye" QUIT EXIT ABRT TERM INT
prepare_archlinux "$SUDO"
PACMAN_OPTIONS="--noconfirm --disable-download-timeout"
# shellcheck disable=SC2086
$SUDO pacman $PACMAN_OPTIONS -Syy
$SUDO pacman-key --init
if [[ $(uname -m) == *"arm"* ]]
then
# shellcheck disable=SC2086
$SUDO pacman $PACMAN_OPTIONS -S archlinuxarm-keyring
$SUDO pacman-key --populate archlinuxarm
else
# shellcheck disable=SC2086
$SUDO pacman $PACMAN_OPTIONS -S archlinux-keyring
$SUDO pacman-key --populate archlinux
fi
# shellcheck disable=SC2086
$SUDO pacman $PACMAN_OPTIONS -Su
# shellcheck disable=SC2086
$SUDO pacman $PACMAN_OPTIONS -S grep coreutils
# shellcheck disable=SC2086

View file

@ -24,20 +24,8 @@ function _install_pkg(){
function _prepare() {
# ArchLinux System initialization
sudo pacman --noconfirm -Syy
sudo pacman-key --init
if [[ $(uname -m) == *"arm"* ]]
then
sudo pacman -S --noconfirm archlinuxarm-keyring
sudo pacman-key --populate archlinuxarm
else
sudo pacman -S --noconfirm archlinux-keyring
sudo pacman-key --populate archlinux
fi
sudo pacman --noconfirm -Su
sudo pacman -S --noconfirm base-devel
sudo pacman -S --noconfirm git arch-install-scripts
prepare_archlinux
sudo pacman -S --noconfirm git arch-install-scripts haveged
}
function build_image_env(){

View file

@ -308,3 +308,27 @@ function copy_common_files() {
copy_file /etc/resolv.conf
return 0
}
function prepare_archlinux() {
local sudo=${1:-sudo}
local pacman_options="--noconfirm --disable-download-timeout"
# shellcheck disable=SC2086
$sudo pacman $pacman_options -Syy
$sudo pacman-key --init
if [[ $(uname -m) == *"arm"* ]]
then
# shellcheck disable=SC2086
$sudo pacman $pacman_options -S archlinuxarm-keyring
$sudo pacman-key --populate archlinuxarm
else
# shellcheck disable=SC2086
$sudo pacman $pacman_options -S archlinux-keyring
$sudo pacman-key --populate archlinux
fi
# shellcheck disable=SC2086
$sudo pacman $pacman_options -Su
}