diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..14e483d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + time: "08:00" + timezone: "UTC" diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..5e38e44 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,19 @@ +changelog: + exclude: + labels: + - ignore-for-release + authors: + - someuser + categories: + - title: Breaking Changes 🛠 + labels: + - breaking-change + - title: Exciting New Features 🎉 + labels: + - enhancement + - title: Dependencies + labels: + - dependencies + - title: Other Changes + labels: + - "*" \ No newline at end of file diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml new file mode 100644 index 0000000..892b634 --- /dev/null +++ b/.github/workflows/pullrequest.yml @@ -0,0 +1,57 @@ +name: build + +on: + push: + branches: + - master + pull_request: +env: + resourceRunID: ${{ github.run_id }}-${{ github.run_number }} + +jobs: + Build: + name: Test + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ Ubuntu-24.04 ] + prepare: [ sudo apt-get update && sudo apt-get install -y exiftool imagemagick xdg-utils libimage-exiftool-perl zsh jq xorg ] + include: + - os: macos-15 + prepare: export PATH=/opt/homebrew/bin:$PATH && brew install exiftool imagemagick && brew outdated jq || brew install jq + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: false + - name: Prepare ${{ matrix.os }} environment + run: | + ${{ matrix.prepare }} + + - name: Install git-diff-image + if: ${{ always() }} + run: | + ./install.sh + + - name: Compare screenshots + if: ${{ always() }} + run: | + git status + cp ./test/false_StartTest_smokeTestStart.png ./screenshotsToCompare/StartTest_smokeTestStart.png + ./test/testDiffImage.sh + + - name: Archive screenshots diffs + if: ${{ always() }} + uses: actions/upload-artifact@v5 + with: + name: diffs-${{ matrix.os }} + path: | + screenshotDiffs + - name: Show git status + if: ${{ always() }} + run: | + git reset --hard + git add screenshotDiffs + git status diff --git a/screenshotsToCompare/StartTest_smokeTestStart.png b/screenshotsToCompare/StartTest_smokeTestStart.png new file mode 100644 index 0000000..5a5340f Binary files /dev/null and b/screenshotsToCompare/StartTest_smokeTestStart.png differ diff --git a/test/false_StartTest_smokeTestStart.png b/test/false_StartTest_smokeTestStart.png new file mode 100644 index 0000000..e82e893 Binary files /dev/null and b/test/false_StartTest_smokeTestStart.png differ diff --git a/test/lib.sh b/test/lib.sh new file mode 100644 index 0000000..9a24d13 --- /dev/null +++ b/test/lib.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +## This file is intended to be sourced by other scripts + +function err() { + echo >&2 "$@" +} + +function curl_gh() { + if [[ -n "$CLASSIC_TOKEN" ]]; then + curl \ + --silent \ + --header "Authorization: token $CLASSIC_TOKEN" \ + "$@" + else + err "WARNING: No CLASSIC_TOKEN found. Skipping API call" + fi +} diff --git a/test/testDiffImage.sh b/test/testDiffImage.sh new file mode 100755 index 0000000..88316c7 --- /dev/null +++ b/test/testDiffImage.sh @@ -0,0 +1,38 @@ +#!/bin/zsh +set -eo pipefail # automatic. fails on any error + +OS="`uname`" +case $OS in + 'Linux') + echo "Fix display on Linux" + export DISPLAY=:99 + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + ;; + 'FreeBSD') + ;; + 'WindowsNT') + ;; + 'Darwin') + #brew install jq | echo "Nothing to do with brew" + ;; + 'SunOS') + ;; + 'AIX') ;; + *) ;; +esac + +diffFiles=./screenshotDiffs +mkdir $diffFiles +GIT_DIFF_IMAGE_OUTPUT_DIR=$diffFiles git diff-image + +pwd +source $(dirname $0)/lib.sh + +echo "GITHUB_REF_NAME=$GITHUB_REF_NAME" +echo $(echo "$GITHUB_REF_NAME" | sed "s/\// /") +PR=$(echo "$GITHUB_REF_NAME" | sed "s/\// /" | awk '{print $1}') +echo "PR=$PR GITHUB_REF_NAME=$GITHUB_REF_NAME" + +# set error when diffs are there +echo "" +[ "$(ls -A $diffFiles)" ] && echo "==> Diff files exists as expected" && exit 0 || echo "==> Diff files doesn't exist" && exit 1