Excluded Contribute.md from triggering build #82
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: Unit Tests & Dev Deployment | |
on: | |
push: | |
branches: [ "dev" ] | |
paths: | |
- '**/*' | |
- '!README.md' | |
- '!CONTRIBUTE.md' | |
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@v1 | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v1 | |
- 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 build \ | |
--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 \ | |
-f docker/Dockerfile \ | |
--push . | |
# - name: "Build, Tag, and push the Docker image" | |
# env: | |
# IMAGE_NAME: ghcr.io/manimatter/decluttarr | |
# IMAGE_TAG: dev | |
# run: | | |
# docker buildx build \ <<<<<<<<<<<<<<<<<<<<< creates manifest issues... don't know how to solve that | |
# --platform linux/amd64,linux/arm64 \ <<<<<<<<<<<<<<<<<<<<< creates manifest issues... don't know how to solve that | |
# --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 \ | |
# -f docker/Dockerfile \ | |
# --push . | |
- name: "Delete untagged versions" | |
uses: actions/delete-package-versions@v4 | |
with: | |
package-name: 'decluttarr' | |
package-type: 'container' | |
delete-only-untagged-versions: 'true' |