-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# implement caching from latest(so no building redundant steps) | ||
# use local cache on tests(so no pulling) | ||
name: docker-compose-actions-workflow | ||
on: push | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set ENV variables | ||
run: | | ||
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | ||
cat .env >> $GITHUB_ENV | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: | | ||
network=host | ||
cache-from: type=registry,ref=${{ secrets.HUB_USERNAME }}/paper_trail:${{ env.BRANCH_NAME }} | ||
cache-to: type=inline | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.HUB_USERNAME }} | ||
password: ${{ secrets.HUB_KEY }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ secrets.HUB_USERNAME }}/paper_trail:${{ env.BRANCH_NAME }} | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: docker up | ||
run: | | ||
sed -i $(echo "s/\$DOCKER_TAG/paper_trail:$BRANCH_NAME/g") .env | ||
docker-compose run paper_trail mix test test/paper_trail | ||
- name: docker ps | ||
run: | | ||
docker ps | ||
env: | ||
DOCKER_TAG: paper_trail:${{ env.BRANCH_NAME }} |