Skip to content

correctly detecting changed files #29

correctly detecting changed files

correctly detecting changed files #29

Workflow file for this run

name: Build, Test, and Publish
on:
push:
branches:
- main
pull_request:
jobs:
test:
needs: docker-publish
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macos-13]
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Create and activate virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
pip3 install . -v
- name: Test the package
run: |
source venv/bin/activate
#pytest to come
docker-publish:
runs-on: ubuntu-latest # Docker actions are run on Linux
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Check version changes
run: |
echo $(git diff HEAD~1 HEAD -- ./version) >> ./version
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
files: |
./version
- name: Set up Docker Buildx
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.Docker }}
- name: Build and push Docker image
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
uses: ./version
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository }}:latest
- name: Verify the Docker image
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
run: |
docker pull ghcr.io/${{ github.repository }}:latest
docker run ghcr.io/${{ github.repository }}:latest