-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (100 loc) · 3.37 KB
/
build-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# SPDX-FileCopyrightText: 2023 Ross Patterson <me@rpatterson.net>
#
# SPDX-License-Identifier: MIT
name: "Build and Test"
env:
PUID: "1001"
PGID: "1001"
# Project specific values:
PROJECT_NAMESPACE: "rpatterson"
# TEMPLATE: Cleanup once fixed entrypoint has been merged from the project template:
# fix(docker): Entrypoint user should not change
PROJECT_NAME: "prunerr"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
GPG_SIGNING_PRIVATE_KEY: "${{ secrets.GPG_SIGNING_PRIVATE_KEY }}"
DOCKER_PASS: "${{ secrets.DOCKER_PASS }}"
# Enable the GitHub command-line:
PROJECT_GITHUB_PAT: "${{ secrets.PROJECT_GITHUB_PAT }}"
# Tell the `./Makefile` about GitHub specific environment details:
CI_IS_FORK: >-
${{
(
(
(github.repository_owner != '${PROJECT_NAMESPACE}')
|| (github.event.pull_request.head.repo.owner.login != '${PROJECT_NAMESPACE}')
) && 'true'
) || 'false'
}}
# Uncomment for debugging output:
DEBUG: "true"
on:
# Run only 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:
CHECKOUT_DIR: "${{ github.workspace }}"
permissions:
packages: "write"
checks: "write"
strategy:
matrix:
PYTHON_MINORS:
- "3.11"
- "3.12"
- "3.10"
- "3.9"
- "3.8"
name: "build-test (python${{ matrix.PYTHON_MINORS }})"
steps:
# Shared or common set up:
- name: "Checkout source from VCS"
uses: "actions/checkout@master"
# TODO: Debug stale venv issues and restore cache after fixing.
# Delegate steps agnostic of the CI/CD platform to the `./Makefile`:
- name: "Build image and run tests and checks in a container"
run: >-
git config --global --add safe.directory
/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
&&
init-job.sh entrypoint.sh make -e PYTHON_MINORS=${{ matrix.PYTHON_MINORS }}
test-push test-lint 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, coverage, and lint reports"
uses: "actions/upload-artifact@master"
with:
name: "test-coverage-lint-reports-python${{ matrix.PYTHON_MINORS }}"
path: |
./build/reports/
- name: "Publish test suite report"
uses: "dorny/test-reporter@main"
# run this step even if preceding step failed
if: >-
(success() || failure())
&& (
(! github.event.pull_request)
|| ! (
(github.repository_owner == '${PROJECT_NAMESPACE}')
&& (
github.event.pull_request.head.repo.owner.login
!= '${PROJECT_NAMESPACE}'
)
)
)
with:
name: "Test Suite Reports (python${{ matrix.PYTHON_MINORS }})"
path: >-
./build/reports/*/*unit.xml
reporter: "java-junit"