-
Notifications
You must be signed in to change notification settings - Fork 91
54 lines (54 loc) · 2.05 KB
/
push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 run 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