-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (137 loc) · 5.34 KB
/
test-actions.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
name: Test repository Actions
on:
push:
branches: [main]
pull_request:
branches: [main]
# Cancel running jobs for the same workflow and branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
# IMPORTANT: Any new jobs need to be added to the check-tests-passed job to ensure they correctly gate code changes
jobs:
test-create_unique_testpypi_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/create_unique_testpypi_version
id: create-version
with:
package-name: example-package # this is an example package that is never updated
- name: Verify the new version number
run: |
if [ "${{ steps.create-version.outputs.new-version }}" != "0.0.1.post1" ]; then
echo "The new version number doesn't match the expected version number."
echo "Expected: 0.0.1.post1"
echo "Actual: ${{ steps.create-version.outputs.new-version }}"
exit 1
fi
test-find_unreleased_changelog_items:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Overwrite CHANGELOG.md with dummy data
run: |
cat <<EOF > temp_changelog.md
# Changelog
---
## Unreleased
Things to be included in the next release go here.
### Added
- Something will be added
---
## v0.0.1
### Added
- Something was done here in the past
EOF
cp temp_changelog.md CHANGELOG.md
- uses: ./actions/find_unreleased_changelog_items
with:
release-level: patch
previous-changelog-filename: .testing_previous_changelog_for_template.md
previous-release-notes-filename: .testing_previous_release_notes_for_template.md
- name: Get Job Summary
uses: austenstone/[email protected]
id: job-summary
with:
name: temp_job_summary
create-pdf: false
create-pdf-artifact: false
create-md: true
create-md-artifact: false
- name: Compare CHANGELOG.md with the created copy
run: |
FILE1="./temp_changelog.md"
FILE2="./python_semantic_release_templates/.testing_previous_changelog_for_template.md"
if diff "$FILE1" "$FILE2" > /dev/null; then
echo "The changelog files are identical."
else
echo "The changelog files are different. Here is the diff:"
diff "$FILE1" "$FILE2"
exit 1
fi
- name: Verify created Release Notes
run: |
FILE_PATH="./python_semantic_release_templates/.testing_previous_release_notes_for_template.md"
# Define the multiline string using a heredoc
MULTILINE_STRING=$(cat <<'EOF'
## Unreleased
Things to be included in the next release go here.
### Added
- Something will be added
EOF
)
# Compare the file contents to the multiline string
if diff <(echo "$MULTILINE_STRING") "$FILE_PATH" > /dev/null; then
echo "The Release Notes contents are correct."
else
echo "The Release Notes contents are not correct. Here is the diff:"
diff <(echo "$MULTILINE_STRING") "$FILE_PATH"
exit 1
fi
- name: Verify the Job Summary
run: |
FILE_PATH="./temp_job_summary.md"
# Define the multiline string using a heredoc
MULTILINE_STRING=$(cat <<'EOF'
## Workflow Inputs
- release-level: patch
## Incoming Changes
Things to be included in the next release go here.
### Added
- Something will be added
EOF
)
# Compare the file contents to the multiline string
if diff <(echo "$MULTILINE_STRING") "$FILE_PATH" > /dev/null; then
echo "The Job Summary contents are correct."
else
echo "The Job Summary contents are not correct. Here is the diff:"
diff <(echo "$MULTILINE_STRING") "$FILE_PATH"
exit 1
fi
test-update_development_dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/update_development_dependencies
with:
update-pre-commit: true
run-pre-commit: true
dependency-dict: '{"dev": ["pyright"]}'
pre-commit-hook-skip-list: remove-tabs,forbid-tabs,check-readthedocs,check-dependabot,check-github-actions,check-github-workflows,commitizen,blacken-docs,yamlfix,hadolint,mdformat,markdown-link-check,check-poetry,toml-sort-fix,pyright,poetry-audit,ruff,ruff-format,docformatter
export-dependency-groups: udd:actions/update_development_dependencies,cutv:actions/create_unique_testpypi_version,fci:actions/find_unreleased_changelog_items
# Check that all jobs passed
check-action-tests-passed:
if: ${{ !cancelled() }}
needs:
- test-create_unique_testpypi_version
- test-find_unreleased_changelog_items
- test-update_development_dependencies
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}