Skip to content

Commit ca189bb

Browse files
authored
Update Workflows (#11)
1 parent f8d2a33 commit ca189bb

File tree

13 files changed

+211
-206
lines changed

13 files changed

+211
-206
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
docs/** linguist-documentation
2-
docs.ps1 linguist-vendored
3-
build.ps1 linguist-vendored
2+
*.ps1 linguist-vendored

.github/workflows/build.yaml

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,25 @@ name: "Build Package"
22

33
on:
44
workflow_call:
5-
inputs:
5+
inputs: &inputs
6+
version:
7+
description: "Build Version"
8+
type: string
9+
required: true
10+
#version-file:
11+
# description: "Version File"
12+
# type: string
13+
# default: "src/*/_version.py"
614
name:
715
description: "Artifact Name"
816
type: string
9-
required: true
17+
default: "dist"
1018
path:
1119
description: "Build Path"
1220
type: string
13-
default: dist
21+
default: "dist"
22+
workflow_dispatch:
23+
inputs: *inputs
1424

1525
jobs:
1626
build:
@@ -19,7 +29,7 @@ jobs:
1929
timeout-minutes: 5
2030

2131
permissions:
22-
contents: read
32+
contents: write
2333

2434
steps:
2535
- name: "Checkout"
@@ -28,16 +38,14 @@ jobs:
2838
- name: "Debug event.json"
2939
continue-on-error: true
3040
run: cat "${GITHUB_EVENT_PATH}"
31-
3241
- name: "Debug CTX github"
3342
continue-on-error: true
3443
env:
3544
GITHUB_CTX: ${{ toJSON(github) }}
3645
run: echo "$GITHUB_CTX"
37-
38-
#- name: "Debug Environment"
39-
# continue-on-error: true
40-
# run: env
46+
- name: "Debug Environment"
47+
continue-on-error: true
48+
run: env
4149

4250
- name: "Setup Python 3.13"
4351
uses: actions/setup-python@v6
@@ -50,29 +58,51 @@ jobs:
5058
python -m pip install -U pip
5159
python -m pip install --group dev
5260
61+
#- name: "Update Version"
62+
# if: ${{ inputs.version-file }}
63+
# uses: justalemon/VersionPatcher@master
64+
# with:
65+
# version: ${{ inputs.version }}
66+
# initpy-files: ${{ inputs.version-file }}
67+
#
68+
#- name: "Debug Version"
69+
# if: ${{ inputs.version-file }}
70+
# continue-on-error: true
71+
# run: |
72+
# cat ${{ inputs.version-file }}
73+
5374
- name: "Build"
5475
run: |
5576
python -m build
5677
5778
- name: "List Artifacts"
79+
continue-on-error: true
5880
working-directory: ${{ inputs.path }}
5981
run: |
60-
results="$(tree . || ls -lAhR .)"
82+
results="$(tree .)"
6183
echo "::group::results"
6284
echo "${results}"
6385
echo "::endgroup::"
64-
markdown='Artifacts: `${{ inputs.path }}`\n```text\n'"${results}"'\n```'
65-
echo -e "${markdown}" >> $GITHUB_STEP_SUMMARY
86+
md="Artifacts: \`${{ inputs.path }}\`\n\`\`\`text\n${results}\n\`\`\`"
87+
echo -e "${md}" >> "$GITHUB_STEP_SUMMARY"
6688
6789
- name: "Upload to Actions"
6890
uses: actions/upload-artifact@v5
6991
with:
7092
name: ${{ inputs.name }}
7193
path: ${{ inputs.path }}
7294

95+
- name: "Upload Release"
96+
if: ${{ github.event_name == 'release' }}
97+
uses: cssnr/upload-release-action@latest
98+
with:
99+
globs: |
100+
dist/*.whl
101+
dist/*.tar.gz
102+
73103
- name: "Send Failure Notification"
74104
if: ${{ failure() }}
75-
uses: sarisia/actions-status-discord@v1
105+
uses: sarisia/actions-status-discord@b8381b25576cb341b2af39926ab42c5056cc44ed # v1.15.5
76106
with:
77107
webhook: ${{ secrets.DISCORD_WEBHOOK }}
78-
description: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
108+
description: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

.github/workflows/docs.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ jobs:
5050
- name: "Build Docs"
5151
run: |
5252
python -m pip install -U pip
53+
python -m pip install --group dev
5354
python -m pip install -U pdoc
54-
python -m pip install -e .
55+
#python -m pip install -e .
5556
python -m pdoc -t docs -o "${{ inputs.path }}" \
5657
--logo "${{ env.logo }}" \
5758
--logo-link "${{ env.link }}" \
58-
vultr
59+
src/vultr
5960
6061
- name: "Fix Docs"
6162
working-directory: ${{ inputs.path }}
@@ -75,8 +76,8 @@ jobs:
7576
echo "::group::results"
7677
echo "${results}"
7778
echo "::endgroup::"
78-
markdown='Artifacts: `${{ inputs.path }}`\n```text\n'"${results}"'\n```'
79-
echo -e "${markdown}" >> $GITHUB_STEP_SUMMARY
79+
markdown="Artifacts: \`${{ inputs.path }}\`\n\`\`\`text\n${results}\n\`\`\`"
80+
echo -e "${markdown}" >> "$GITHUB_STEP_SUMMARY"
8081
8182
- name: "Upload Pages Artifact"
8283
if: ${{ inputs.name == 'github-pages' }}

.github/workflows/labeler.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "PR Labeler"
2+
3+
on:
4+
pull_request_target:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
labeler:
12+
name: "Labeler"
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
16+
permissions:
17+
pull-requests: write
18+
issues: write
19+
20+
steps:
21+
- name: "Checkout Configs"
22+
uses: actions/checkout@v6
23+
with:
24+
repository: cssnr/configs
25+
ref: master
26+
path: .configs
27+
sparse-checkout-cone-mode: false
28+
sparse-checkout: |
29+
labels/**
30+
31+
- name: "Debug"
32+
continue-on-error: true
33+
run: |
34+
echo "::group::labels.yaml"
35+
cat .configs/labels/labels.yaml
36+
echo "::endgroup::"
37+
38+
echo "::group::labeler.yaml"
39+
cat .configs/labels/labeler.yaml
40+
echo "::endgroup::"
41+
42+
- name: "Label Creator"
43+
continue-on-error: true
44+
uses: cssnr/label-creator-action@latest
45+
with:
46+
file: .configs/labels/labels.yaml
47+
48+
- name: "Labeler"
49+
uses: actions/labeler@v6
50+
with:
51+
sync-labels: true
52+
configuration-path: .configs/labels/labeler.yaml

.github/workflows/lint.yaml

Lines changed: 20 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ on:
55
push:
66
branches: [master]
77
paths-ignore:
8+
- ".gitattributes"
89
- ".gitignore"
910
- ".prettierignore"
1011
- "MANIFEST.in"
1112
pull_request:
13+
branches: [master]
1214

1315
concurrency:
1416
group: ${{ github.workflow }}-${{ github.ref }}
@@ -30,34 +32,22 @@ jobs:
3032
- name: "Debug event.json"
3133
continue-on-error: true
3234
run: cat "${GITHUB_EVENT_PATH}"
33-
3435
- name: "Debug CTX github"
3536
continue-on-error: true
3637
env:
3738
GITHUB_CTX: ${{ toJSON(github) }}
3839
run: echo "$GITHUB_CTX"
39-
4040
- name: "Debug Environment"
4141
continue-on-error: true
4242
run: env
4343

44-
#- name: "Check Changed Files"
45-
# id: changed
46-
# uses: tj-actions/changed-files@v47
47-
# with:
48-
# files: |
49-
# src/**
50-
# tests/**
51-
# pyproject.toml
52-
5344
- name: "Setup Python 3.13"
5445
uses: actions/setup-python@v6
5546
with:
5647
python-version: "3.13"
5748
cache: "pip"
5849

59-
- name: "Install"
60-
id: install
50+
- name: "Install Project"
6151
run: |
6252
python -m pip install -U pip
6353
python -m pip install --group dev
@@ -75,7 +65,7 @@ jobs:
7565
7666
- name: "astral-sh/ruff"
7767
if: ${{ !cancelled() }}
78-
uses: astral-sh/ruff-action@v3
68+
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
7969
with:
8070
version: latest
8171

@@ -90,7 +80,7 @@ jobs:
9080

9181
- name: "isort"
9282
if: ${{ !cancelled() }}
93-
uses: isort/isort-action@v1
83+
uses: isort/isort-action@24d8a7a51d33ca7f36c3f23598dafa33f7071326 # v1.1.1
9484

9585
- name: "mypy"
9686
if: ${{ !cancelled() }}
@@ -107,39 +97,32 @@ jobs:
10797
run: |
10898
validate-pyproject pyproject.toml
10999
110-
- name: "prettier"
100+
- name: "tombi"
111101
if: ${{ !cancelled() }}
112102
run: |
113-
echo "::group::Install"
114-
npm install prettier
115-
echo "::endgroup::"
116-
npx prettier --check .
103+
tombi lint
117104
118105
- name: "yamllint"
119106
if: ${{ !cancelled() }}
120-
env:
121-
CONFIG: "{extends: relaxed, ignore: [node_modules/], rules: {line-length: {max: 119}}}"
122107
run: |
123108
echo "::group::List Files"
124-
yamllint -d '${{ env.CONFIG }}' --list-files .
109+
yamllint -d .github/yamllint.yaml --list-files .
125110
echo "::endgroup::"
126-
yamllint -d '${{ env.CONFIG }}' .
111+
yamllint -d .github/yamllint.yaml .
127112
128-
- name: "actionlint"
113+
- name: "prettier"
129114
if: ${{ !cancelled() }}
130115
run: |
131-
echo "::group::Download"
132-
loc=$(curl -sI https://github.com/rhysd/actionlint/releases/latest | grep -i '^location:')
133-
echo "loc: ${loc}"
134-
tag=$(echo "${loc}" | sed -E 's|.*/tag/v?(.*)|\1|' | tr -d '\t\r\n')
135-
echo "tag: ${tag}"
136-
url="https://github.com/rhysd/actionlint/releases/latest/download/actionlint_${tag}_linux_amd64.tar.gz"
137-
echo "url: ${url}"
138-
curl -sL "${url}" | tar xz -C "${RUNNER_TEMP}" actionlint
139-
file "${RUNNER_TEMP}/actionlint"
140-
"${RUNNER_TEMP}/actionlint" --version
116+
echo "::group::Install"
117+
npm install prettier
141118
echo "::endgroup::"
142-
"${RUNNER_TEMP}/actionlint" -color -verbose -shellcheck= -pyflakes=
119+
npx prettier --check .
120+
121+
- name: "actionlint"
122+
if: ${{ !cancelled() }}
123+
uses: cssnr/actionlint-action@v1
124+
with:
125+
shellcheck_opts: -e SC2012
143126

144127
- name: "pytest"
145128
if: ${{ !cancelled() }}
@@ -151,21 +134,6 @@ jobs:
151134
152135
- name: "codecov"
153136
if: ${{ !cancelled() && steps.coverage.outcome == 'success' }}
154-
uses: codecov/codecov-action@v5
137+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
155138
with:
156139
token: ${{ secrets.CODECOV_TOKEN }}
157-
158-
#- name: "hadolint"
159-
# if: ${{ !cancelled() }}
160-
# uses: hadolint/hadolint-action@v3.3.0
161-
# with:
162-
# dockerfile: Dockerfile
163-
164-
#- name: "Vale"
165-
# if: ${{ !cancelled() }}
166-
# uses: errata-ai/vale-action@v2.1.1
167-
168-
#- name: "SonarQube"
169-
# uses: SonarSource/sonarqube-scan-action@v4
170-
# env:
171-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)