update github action versions #257
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
name: docker-compose-based-ci | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set ENV variables | |
run: | | |
cat .env >> $GITHUB_ENV | |
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@v3 | |
with: | |
install: true | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{runner.os}}-buildx-${{github.sha}} | |
restore-keys: ${{runner.os}}-buildx- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{env.REGISTRY}} | |
username: ${{env.REPO_OWNER}} | |
password: ${{secrets.CR_PAT}} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
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: Docker-compose pull | |
run: docker-compose pull | |
- name: Docker-compose up | |
run: | | |
docker-compose -f docker-compose.yaml up -d | |
- name: Execute tests | |
run: | | |
docker-compose exec -T paper_trail mix test test/paper_trail | |
docker-compose run paper_trail mix test test/version | |
docker-compose run paper_trail mix test test/uuid | |
STRING_TEST=true docker-compose run paper_trail mix test test/uuid | |
- name: Check Formatted | |
run: docker-compose run paper_trail mix format --check-formatted |