55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
name: Build and Test Docker
|
|
on: [push, pull_request]
|
|
env:
|
|
CI_IMAGE: gollum-ci-img
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check Out Repo
|
|
uses: actions/checkout@v2
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Cache docker layers
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-
|
|
- name: Build
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: ./
|
|
file: ./Dockerfile
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
push: false
|
|
tags: ${{ env.CI_IMAGE }}
|
|
outputs: type=docker
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
- name: docker state
|
|
run: docker image ls
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: 3.0.0
|
|
bundler-cache: true
|
|
- name: Install Chromedriver
|
|
uses: nanasess/setup-chromedriver@v1
|
|
- run: |
|
|
export DISPLAY=:99
|
|
chromedriver --url-base=/wd/hub &
|
|
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
|
|
- name: Run gollum from Docker
|
|
run: |
|
|
git clone test/examples/lotr.git lotr.git
|
|
RUNNER_TRACKING_ID="" docker run --rm -p 4567:4567 -v lotr.git:/wiki -e CI=true ${{ env.CI_IMAGE }} &
|
|
sleep 10
|
|
netstat -lt
|
|
- name: Run capybara tests against Dockerized instance
|
|
run: "GOLLUM_CAPYBARA_URL=http://127.0.0.1:4567 bundle exec rake test:capybara" |