-
Notifications
You must be signed in to change notification settings - Fork 23
82 lines (73 loc) · 2.22 KB
/
dev.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Unit Tests & Dev Deployment
on:
push:
branches: [ "dev" ]
paths:
- '**/*'
- '!README.md'
- '!CONTRIBUTE.md'
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: '.'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.13'
- name: Install pip and pytest
run: |
python -m pip install --upgrade pip
pip install -r docker/requirements.txt
- name: Test with pytest
run: |
python3 -m pytest --import-mode=append tests/
build-dev:
needs: unit-tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: '.'
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Store short Commit ID in env variable
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "SHORT_COMMIT_ID=$calculatedSha" >> $GITHUB_ENV
- name: "Build, Tag, and push the Docker image"
env:
IMAGE_NAME: ghcr.io/manimatter/decluttarr
IMAGE_TAG: dev
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 -f docker/Dockerfile . \
--progress plain \
-t $IMAGE_NAME:$IMAGE_TAG \
--label com.decluttarr.version=$IMAGE_TAG \
--label com.decluttarr.commit=$SHORT_COMMIT_ID \
--build-arg IMAGE_TAG=$IMAGE_TAG \
--build-arg SHORT_COMMIT_ID=$SHORT_COMMIT_ID \
--push \
# - name: "Clean up docker images"
# uses: dataaxiom/ghcr-cleanup-action@main
# with:
# keep-n-tagged: 10
# exclude-tags: dev
# dry-run: true
# token: ${{secrets.GITHUB_TOKEN}}