diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9c16f0c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +env: + LOG_DIR: ${{github.workspace}}/log + BIN_DIR: ${{github.workspace}}/bin + COMPOSE_LOG: ${{github.workspace}}/log/docker-compose.log + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Cache project dependencies + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-clojure-${{ hashFiles('**/project.clj') }} + restore-keys: | + ${{ runner.os }}-clojure + - name: Prepare java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + # ES5 needs this + - run: sudo sysctl -w vm.max_map_count=262144 + # create log & bin dir if missing + - run: mkdir -p $LOG_DIR + - run: mkdir -p $BIN_DIR + - run: docker compose -f containers/dev/docker-compose.yml up -d > $COMPOSE_LOG + # Wait ES 5 + - run: until curl http://127.0.0.1:9205/; do sleep 1; done + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@12.5 + with: + lein: latest + - run: sudo sh ./script/install-phantom-js-ubuntu.sh + - run: lein do clean, compile :all, test :all, doo phantom test once diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 34dc24e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -language: clojure -lein: 2.9.1 -dist: trusty -script: lein do clean, compile :all, test :all, doo phantom test once - - -# Cache our Maven deps to be kind to clojars, github, docker images -cache: - directories: - - $HOME/bin - - $HOME/.m2 -jdk: - - oraclejdk8 - - openjdk11 - -before_install: - # ES5 needs this - - sudo sysctl -w vm.max_map_count=262144 - # create log & bin dir if missing - - mkdir -p $LOG_DIR - - mkdir -p $BIN_DIR - - #https://github.com/travis-ci/travis-ci/issues/5227 - - echo "127.0.0.1 "`hostname` | sudo tee /etc/hosts - - # install docker-compose if not in cache - - if [ ! -f $COMPOSE_BIN ]; then curl -L {$COMPOSE_URI}/docker-compose-`uname -s`-`uname -m` -o $COMPOSE_BIN; fi - - chmod +x $COMPOSE_BIN - -before_script: - - $COMPOSE_BIN -f containers/dev/docker-compose.yml up -d > $COMPOSE_LOG - # Wait ES - - until curl http://127.0.0.1:9205/; do sleep 1; done - -services: - - docker - -env: - global: - - LOG_DIR=$HOME/log - - BIN_DIR=$HOME/bin - - COMPOSE_URI=https://github.com/docker/compose/releases/download/v2.17.2 - - COMPOSE_BIN=$HOME/bin/docker-compose-2-17-2 - - COMPOSE_LOG=$HOME/log/docker-compose.log diff --git a/script/install-phantom-js-ubuntu.sh b/script/install-phantom-js-ubuntu.sh new file mode 100755 index 0000000..479eeda --- /dev/null +++ b/script/install-phantom-js-ubuntu.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# This script install PhantomJS in your Debian/Ubuntu System +# +# This script must be run as root: +# sudo sh install_phantomjs.sh +# +# https://gist.github.com/julionc/7476620 + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +PHANTOM_VERSION="phantomjs-2.1.1" +ARCH=$(uname -m) + +if ! [ $ARCH = "x86_64" ]; then + $ARCH="i686" +fi + +PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH" + +sudo apt-get update +sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y +sudo apt-get install libfreetype6 libfreetype6-dev -y +sudo apt-get install libfontconfig1 libfontconfig1-dev -y + +cd ~ +wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 +sudo tar xvjf $PHANTOM_JS.tar.bz2 + +sudo mv $PHANTOM_JS /usr/local/share +sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin