Skip to content

Commit

Permalink
github action added
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Dec 7, 2020
1 parent d9d0f68 commit 245b46f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: docker-based-ci
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set ENV variables
run: |
echo "REGISTRY=ghcr.io" >> $GITHUB_ENV
echo "REPO_OWNER=$(echo ${GITHUB_REPOSITORY%/*})" >> $GITHUB_ENV
echo "REPO_NAME=$(echo ${GITHUB_REPOSITORY#*/})" >> $GITHUB_ENV
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
echo "DOCKER_TAG=$(echo ${GITHUB_REPOSITORY#*/}):$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Set up Docker 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: Login to GitHub Container Registry
uses: docker/#-action@v1
with:
registry: ${{env.REGISTRY}}
username: ${{env.REPO_OWNER}}
password: ${{secrets.CR_PAT}}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{env.REGISTRY}}/${{env.REPO_OWNER}}/${{env.DOCKER_TAG}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Execute tests
run: docker run -t --entrypoint="mix" ${REGISTRY}/${REPO_OWNER}/${DOCKER_TAG} test --seed 0 --trace
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM "elixir:1.10.1-slim"
FROM "elixir:1.10.4-slim"

ARG MIX_ENV=dev
ENV MIX_ENV=$MIX_ENV
Expand Down

0 comments on commit 245b46f

Please # to comment.