Pre-fill known_hosts, as it doesn't already know github on Travis with macos

This commit is contained in:
Georges Dupéron 2018-07-19 23:10:17 +02:00
parent 3a29713f9d
commit 54363287d1
3 changed files with 43 additions and 28 deletions

View File

@ -103,21 +103,22 @@ matrix:
# TODO: test in SH mode
before_install:
- brew install cdrtools || true
- brew install mtools || true
- brew cask install gdisk || true
- brew install imagemagick --with-x11 || true
- make --version || true
- nasm -v || true
- mtools --version || true
- mtools || true
- mkisofs --version || true
- zip --help || true
- unzip --version || true
- gdisk --version || true
- fdisk --version || true
- import --version || true
- Xvfb -h || true
- brew install cdrtools || true
- brew install mtools || true
- brew cask install gdisk || true
- brew install imagemagick || true # --with-x11
- make --version || true
- nasm -v || true
- mtools --version || true
- mtools || true
- mkisofs --version || true
- zip --help || true
- unzip --version || true
- gdisk --version || true
- fdisk --version || true
- import --version || true
- Xvfb -h || true
- ssh -V || true
- ./utils/install-sikulix.sh
- export PATH="$HOME/sikulix/:$PATH"
- if test "$MODE" = virtualbox -o "$MODE" = self-test; then ./utils/install-virtualbox.sh; fi

View File

@ -391,18 +391,24 @@ build/test_pass/sudo_iso_mount: ${os_filename} build/check_makefile | build/mnt_
touch $@
.PHONY: test/macos
test/macos: all test/noemu test/macos-sh
test/macos: all test/noemu test/macos-sh test/macos-sh-x11
.PHONY: test/macos-sh-x11
test/macos-sh-x11:
sudo mkdir -p /tmp/.X11-unix
sudo chmod a+rwxt /tmp/.X11-unix
xvfb :42 & \
sleep 5; \
DISPLAY=:42 xterm -e ./os.bat & \
sleep 5; \
# DISPLAY=:42 import -window root deploy-screenshots/macos-sh-x11.png
screencapture deploy-screenshots/macos-sh-x11-screencapture.png
.PHONY: test/macos-sh
test/macos-sh: build/check_makefile | deploy-screenshots
sudo mkdir /tmp/.X11-unix
sudo chmod a+rwxt /tmp/.X11-unix
xvfb :42 & \
sleep 10; \
DISPLAY=:42 xterm -e 'sh -c "echo hello; sleep 30"' & \
sleep 5; \
DISPLAY=:42 import -window root deploy-screenshots/macos.png
ls -l deploy-screenshots/
identify deploy-screenshots/* || true
osascript -e 'tell app "Terminal" to activate'
osascript -e 'tell app "Terminal" to do script "'"$$PWD"'/os.bat"'
sleep 5
screencapture deploy-screenshots/screencapture-os-bat.png
# See https://wiki.osdev.org/EFI#Emulation to emulate an UEFI system with qemu, to test the EFI boot from hdd / cd / fd (?).

View File

@ -63,14 +63,22 @@ else
chmod 600 ~/.ssh/travis-deploy-key-id_rsa
eval `ssh-agent -s`
ssh-add ~/.ssh/travis-deploy-key-id_rsa
# TODO: all the config should be in a separate folder, instead of using ~/.ssh for the id_rsa.
known_hosts_d="$(UMASK=077 mktemp -d)"
touch ${known_hosts_d}/known_hosts
chmod 600 ${known_hosts_d}/known_hosts
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> "${known_hosts_d}/known_hosts"
TRAVIS_AUTO_PUSH_REPO_DIR="$HOME/travis-temp-auto-push-$(date +%s)"
if test -e "$TRAVIS_AUTO_PUSH_REPO_DIR"; then rm -rf "$TRAVIS_AUTO_PUSH_REPO_DIR"; fi
git clone -b "$deploy_base_commit" --depth 1 --shallow-submodules "$deploy_repo" "$TRAVIS_AUTO_PUSH_REPO_DIR"
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=${known_hosts_d}/known_hosts" git clone -b "$deploy_base_commit" --depth 1 --shallow-submodules "$deploy_repo" "$TRAVIS_AUTO_PUSH_REPO_DIR"
(cd "$TRAVIS_AUTO_PUSH_REPO_DIR" && git checkout -b "$deploy_branch")
rsync -a "${deploy_directory}/" "${TRAVIS_AUTO_PUSH_REPO_DIR}/"
(cd "$TRAVIS_AUTO_PUSH_REPO_DIR" && git add -A . && git commit --allow-empty -m "Auto-publish to $deploy_branch") > commit.log || (cat commit.log && exit 1)
(cd "$TRAVIS_AUTO_PUSH_REPO_DIR" && git log --oneline --decorate --graph -10)
echo '(cd '"$TRAVIS_AUTO_PUSH_REPO_DIR"' && git push --force --quiet "'"$deploy_repo"'" "'"$deploy_branch"'")'
(cd "$TRAVIS_AUTO_PUSH_REPO_DIR" && git push --force --quiet "$deploy_repo" "$deploy_branch" >/dev/null 2>&1) >/dev/null 2>&1 # redirect to /dev/null to avoid showing credentials.
(cd "$TRAVIS_AUTO_PUSH_REPO_DIR" && GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=${known_hosts_d}/known_hosts" git push --force --quiet "$deploy_repo" "$deploy_branch" >/dev/null 2>&1) >/dev/null 2>&1 # redirect to /dev/null to avoid showing credentials.
# Cleanup:
rm "${known_hosts_d}/known_hosts"
fi