-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (122 loc) · 4 KB
/
Copy pathci.yaml
File metadata and controls
143 lines (122 loc) · 4 KB
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
142
143
name: ci
permissions: {} # No default permissions.
on:
push:
branches:
- "**" # All branches
tags:
- v[0-9]+.[0-9]+.[0-9]+ # Release tags, e.g. v0.1.2
pull_request:
branches:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: "1" # Make tools pretty.
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup uv
uses: astral-sh/setup-uv@v8.0.0
- name: Run Set-VenvOutsideProject.ps1
shell: pwsh
run: ./scripts/Set-VenvOutsideProject.ps1 -VenvRootFolder /tmp
- name: Run Bootstrap.ps1
shell: pwsh
run: ./scripts/Bootstrap.ps1
- name: Run Update-PreCommitHooks.ps1
shell: pwsh
run: ./scripts/Update-PreCommitHooks.ps1
- name: Run Build-Docs.ps1
shell: pwsh
run: ./scripts/Build-Docs.ps1
- name: Run Build-Docs.ps1 -Offline
shell: pwsh
run: ./scripts/Build-Docs.ps1 -Offline
- name: Run Build-Package.ps1
# This runs because if the build backend is not specified in pyproject.toml,
# it defaults to setuptools.build_meta.
# The resulting sdist and wheel are almost empty.
shell: pwsh
run: ./scripts/Build-Package.ps1
- name: Dry run Release-Project.ps1
# Release-Project fails if not run from the master branch.
if: (github.ref == 'refs/heads/master')
shell: pwsh
# Bootstrap.ps1 could have modified the lockfile, so we -AllowDirty.
run: ./scripts/Release-Project.ps1 -Bump patch -DryRun -AllowDirty
package:
name: Package
needs: test
runs-on: ubuntu-latest
outputs:
package_name: ${{ steps.get-package-name.outputs.package_name }}
steps:
- name: Checkout source code
uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0
- name: Get package name
id: get-package-name
run: |
version=$(git describe --always)
package_name="scripts-$version"
echo "Package name: $package_name"
echo "package_name=$package_name" >> $GITHUB_OUTPUT
- name: Zip and upload the package
uses: actions/upload-artifact@v7
with:
name: ${{ steps.get-package-name.outputs.package_name }}
path: |
scripts
LICENSE
README.md
github-release:
name: GitHub release
if: startsWith(github.ref, 'refs/tags/v')
needs: package
runs-on: ubuntu-latest
permissions:
contents: write
env:
# When triggered by tag push, checkout@v5 fetches the repository in a way that
# confuses `git describe`. We re-compute the package name.
release_package_name: scripts-${{ github.ref_name }}.zip
steps:
- name: Download the package
uses: actions/download-artifact@v8
with:
name: ${{ needs.package.outputs.package_name }}
path: release/
- name: Re-zip for release
# Work around https://github.com/actions/upload-artifact/issues/426
# Use CR/LF line endings for more comfort under Windows.
run: |
pushd release
zip --recurse-paths --to-crlf --verbose ../$release_package_name *
popd
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
${{ github.ref_name }}
--repo ${{ github.repository }}
--notes "[Changelog](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/CHANGELOG.md)"
- name: Upload package to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
${{ github.ref_name }}
$release_package_name
--repo ${{ github.repository }}