ci(bryant-finney/pyspry#49): Implement testing jobs #4
Workflow file for this run
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
# Summary: define a CI/CD pipelines to run on PRs | |
name: ⬅️ PR Checks | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/docker-build.yml | |
- Dockerfile | |
- docker-compose.yml | |
- platforms.yml | |
- poetry.lock | |
jobs: | |
changes: | |
# identify types of files that have changed in this PR | |
name: 🔎 Check for changes | |
env: | |
# these types of files should all impact image builds | |
DOCKER_FILES: |- | |
.github/workflows/docker-build.yml | |
Dockerfile | |
docker-compose.yml | |
platforms.yml | |
poetry.lock | |
TYPES_DIR: /tmp/types | |
outputs: | |
docker: ${{ steps.compare.outputs.docker }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📂 Checkout | |
uses: actions/checkout@v2 | |
- name: 📐 Setup | |
run: | | |
mkdir -p $TYPES_DIR | |
printf "%s\n" "${{ env.DOCKER_FILES }}" | sort >$TYPES_DIR/docker-files.txt | |
- name: 📝 List changes | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: gh pr diff --name-only ${{ github.event.number }} | sort >/tmp/changes.txt | |
- name: ❔ Compare | |
id: compare | |
run: | | |
for type_path in $TYPES_DIR/*.txt; do | |
type_name="$(basename "$type_path" | rev | cut -d- -f2- | rev)" | |
comm -12 $type_path /tmp/changes.txt | xargs -I{} test -z "{}" || | |
echo "${type_name}=true" >>"$GITHUB_OUTPUT" | |
done | |
call-docker-build: | |
if: needs.changes.outputs.docker == 'true' | |
needs: changes | |
permissions: | |
packages: write | |
uses: ./.github/workflows/docker-build.yml |