Merge branch 'github-actions-cache-df' into develop

develop
lethosor 2020-06-29 23:03:34 -04:00
commit a0ad60f3f9
2 changed files with 39 additions and 9 deletions

@ -6,6 +6,10 @@ jobs:
build:
runs-on: ubuntu-18.04
steps:
- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: 3
- name: Install dependencies
run: |
sudo apt-get update
@ -18,18 +22,26 @@ jobs:
lua5.3 \
ninja-build \
zlib1g-dev
sudo pip3 install --system sphinx
pip install sphinx
- name: Clone DFHack
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
fetch-depth: 0 # unlimited - we need past tags
submodules: true
- name: Set up environment
id: env_setup
run: |
echo export DF_VERSION="$(sh travis/get-df-version.sh)" >> "$HOME/.df-env"
echo export DF_FOLDER="$HOME/DF/$DF_VERSION/df_linux" >> "$HOME/.df-env"
DF_VERSION="$(sh travis/get-df-version.sh)"
echo "::set-env name=DF_VERSION::${DF_VERSION}"
echo "::set-output name=df_version::${DF_VERSION}"
echo "::set-env name=DF_FOLDER::${HOME}/DF/${DF_VERSION}/df_linux"
- name: Fetch DF cache
uses: actions/cache@v2
with:
path: ~/DF
key: ${{ steps.env_setup.outputs.df_version }}
- name: Download DF
run: |
source "$HOME/.df-env"
sh travis/download-df.sh
- name: Build docs
run: |
@ -41,7 +53,6 @@ jobs:
path: docs/html
- name: Build DFHack
run: |
source "$HOME/.df-env"
cmake \
-S . \
-B build-ci \
@ -53,7 +64,6 @@ jobs:
ninja -C build-ci install
- name: Run tests
run: |
source "$HOME/.df-env"
export TERM=dumb
mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init
script -qe -c "python travis/run-tests.py --headless --keep-status \"$DF_FOLDER\""
@ -66,6 +76,12 @@ jobs:
with:
name: test-artifacts
path: artifacts
- name: Clean up DF folder
# to prevent DFHack-generated files from ending up in the cache
# (download-df.sh also removes them, this is just to save cache space)
if: success() || failure()
run: |
rm -rf "$DF_FOLDER"
lint:
runs-on: ubuntu-18.04
steps:

@ -1,8 +1,9 @@
#!/bin/sh
set -e
tardest="df.tar.bz2"
which md5sum && alias md5=md5sum
selfmd5=$(openssl md5 < "$0")
echo $selfmd5
@ -28,7 +29,20 @@ if [ ! -f receipt ]; then
patch=$(echo "$DF_VERSION" | cut -d. -f3)
url="http://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2"
echo Downloading
wget "$url" -O "$tardest"
while read url; do
echo "Attempting download: ${url}"
if wget -v "$url" -O "$tardest"; then
break
fi
done <<URLS
https://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2
https://files.dfhack.org/DF/0.${minor}.${patch}/df_${minor}_${patch}_linux.tar.bz2
URLS
echo $tardest
if ! test -f "$tardest"; then
echo "DF failed to download: $tardest not found"
exit 1
fi
fi
rm -rf df_linux