Skip to content

fix(docker): Dirty git status inside container #49

fix(docker): Dirty git status inside container

fix(docker): Dirty git status inside container #49

Workflow file for this run

# SPDX-FileCopyrightText: 2023 Ross Patterson <me@rpatterson.net>
#
# SPDX-License-Identifier: MIT
name: "Build and Test"
on:
# Only run on branches, not tags:
# https://github.com/orgs/community/discussions/25615#discussioncomment-3397691
push:
branches:
- "**"
tags:
- "!**"
# Also run for open pull requests, including when pushed to:
pull_request: {}
jobs:
build-test:
runs-on: "ubuntu-latest"
container:
image: "ghcr.io/rpatterson/prunerr:build-host"
env:
PUID: "1001"
PGID: "123"
CHECKOUT_DIR: "${{ github.workspace }}"
# Requires the secrets to be added to GitHub either through the web UI or the
# GitHub CLI tool:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
GPG_SIGNING_PRIVATE_KEY: "${{ secrets.GPG_SIGNING_PRIVATE_KEY }}"
DOCKER_PASS: "${{ secrets.DOCKER_PASS }}"
# Enable the GitHub CLI
PROJECT_GITHUB_PAT: "${{ secrets.PROJECT_GITHUB_PAT }}"
# Tell the `./Makefile` about GitHub specific environment details:
CI_IS_FORK: >-
${{
(
(
(github.repository_owner != 'rpatterson')
|| (github.event.pull_request.head.repo.owner.login != 'rpatterson')
) && 'true'
) || 'false'
}}
permissions:
packages: "write"
checks: "write"
strategy:
matrix:
PYTHON_MINORS:
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- "3.7"
name: "build-test (python${{ matrix.PYTHON_MINORS }})"
steps:
# Shared/common set up:
- name: "Checkout source from VCS"
uses: "actions/checkout@master"
# TODO: Debug stale venv issues and restore cache once fixed
- name: "Change checkout owner"
# https://stackoverflow.com/a/58474340/624787
run: >-
chown -R ${PUID}:${PGID} ./ &&
git config --global --add safe.directory
/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
# Delegate steps agnostic of the CI/CD platform to the `./Makefile`:
- name: "Build image and run tests and checks in a container"
run: >-
entrypoint make -e PYTHON_MINORS=${{ matrix.PYTHON_MINORS }}
test-push build-docker-${{ matrix.PYTHON_MINORS }}
test-docker-${{ matrix.PYTHON_MINORS }} test-clean
# Upload build artifacts:
# https://github.com/actions/upload-artifact#usage
- name: "Archive test suite reports"
uses: "actions/upload-artifact@master"
with:
name: "test-suite-reports"
path: |
./build/*test*
# https://github.com/marketplace/actions/test-reporter#example
- name: "Publish test suite report"
uses: "dorny/test-reporter@main"
# run this step even if previous step failed
if: >-
(success() || failure())
&& (
(! github.event.pull_request)
|| ! (
(github.repository_owner == 'rpatterson')
&& (github.event.pull_request.head.repo.owner.login != 'rpatterson')
)
)
with:
name: "Test Suite Reports"
path: >-
./build/*/*test-junit.xml,
./build/*/prospector-xunit.xml
reporter: "java-junit"
- name: "Archive code coverage reports"
uses: "actions/upload-artifact@master"
with:
name: "code-coverage-reports"
path: |
./build/*/.coverage*
./build/*/coverage*
./build/*/htmlcov*
- name: "Archive linter reports"
uses: "actions/upload-artifact@master"
with:
name: "linter-reports"
path: |
./build/*/*lint*
./build/*/prospector*