Skip to content

Commit

Permalink
Merge pull request #47 from artivis/fix/docker-ci
Browse files Browse the repository at this point in the history
fix docker ci
  • Loading branch information
Linbreux committed Jun 9, 2022
2 parents b652617 + 688c5de commit d2fede8
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
build:
runs-on: ubuntu-latest
outputs:
wikmd_tag: ${{ steps.meta.outputs.tags }}
wikmd_tags: ${{ steps.meta.outputs.tags }}
json: ${{ steps.meta.outputs.json }}
strategy:
matrix:
architecture:
Expand All @@ -28,16 +29,14 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: |
linbreux/wikmd
images: linbreux/wikmd
tags: |
type=ref,event=pr
type=ref,event=tag
type=edge,branch=$repo.default_branch
type=edge
- name: Check docker image tag
run: |
echo "Creating Docker image ${{ steps.meta.outputs.tags }}"
run: echo "Creating Docker image ${{ steps.meta.outputs.tags }}"

- name: Build & export
uses: docker/build-push-action@v3
Expand All @@ -56,6 +55,11 @@ jobs:
test:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
tag: ${{ fromJSON(needs.build.outputs.json).tags }}
name: "test-${{ matrix.tag }}"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -71,29 +75,30 @@ jobs:
docker load --input /tmp/wikmd.tar
docker image ls -a
# Start a default Wikmd container
# Start a default wikmd container
- name: Start wikmd
run: docker run -d --name wikmd -p 5000:5000 ${{ needs.build.outputs.wikmd_tag }}
run: docker run -d --name wikmd -p 5000:5000 ${{ matrix.tag }}

# Wait for wikmd to be up and running
- name: Sleep
uses: jakejarvis/wait-action@master
with:
time: '20s'

# Print some debugging
- name: Check running containers
run: docker ps -a

- name: Check docker logs
run: docker logs wikmd

# Check that Wikmd is up and running
# Check that wikmd is up and running
- name: Assert wikmd status
run: curl -I localhost:5000 2>&1 | awk '/HTTP\// {print $2}' | grep -w "200\|301"

publish:
# Publish if official repo and push to 'main' or new tag
if: |
true &&
github.repository == 'Linbreux/wikmd' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
runs-on: ubuntu-latest
Expand All @@ -113,4 +118,4 @@ jobs:
with:
file: docker/Dockerfile
push: true
tags: ${{ needs.build.outputs.wikmd_tag }}
tags: ${{ needs.build.outputs.wikmd_tags }}

0 comments on commit d2fede8

Please sign in to comment.