Skip to content

Commit 12c99ed

Browse files
committed
workflows
1 parent e29af77 commit 12c99ed

File tree

4 files changed

+42
-9
lines changed

4 files changed

+42
-9
lines changed

.github/copilot-instructions.md

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Purpose: Make AI contributions precise, minimal, and correct. Follow these rules
55
## Bash scripting (applies to all repos)
66

77
Do
8+
89
- Use `#!/bin/bash` as the shebang for Bash scripts.
910
- Use the `.bash` extension for Bash; use `.sh` only for POSIX-only scripts.
1011
- Prefer `$BASH_SOURCE` over `$0` for script path detection.
@@ -17,31 +18,40 @@ Do
1718
- For Bash references, consult: https://mywiki.wooledge.org and https://mywiki.wooledge.org/BashFAQ and include a source link when possible. Do not invent links.
1819

1920
Avoid
20-
- Global “set -euo pipefail”; prefer targeted checks and explicit error handling.
21+
22+
- `set -euo pipefail`; prefer targeted checks and explicit error handling.
2123
- Uppercase variable names for general scripting (reserve UPPERCASE for Docker/env settings).
2224
- Clever one-liners that harm clarity.
2325
- Generalized or speculative changes not asked for in the prompt.
2426
- Over-engineering; keep it stable, concise, and C-like in mindset.
2527

2628
Scope and behavior
27-
- Only implement what the prompt requests.
29+
30+
- Only implement what the prompt requests. All changes should be in the context of the prompt.
2831
- Keep solutions minimal and modular; do not add placeholders or future-proofing unless required.
2932
- When giving Bash/shell answers, add a relevant wooledge link if helpful; never fabricate links.
3033

3134
## GitHub Workflows (all repos)
3235

3336
- In reusable workflows, any job that uses outputs from another job must declare that job in `needs` to avoid null outputs.
3437
- Do not use outdated Actions. Check for current recommended versions before editing.
35-
- The `gh` CLI cannot fetch the ID of a workflow run it just started via `gh run workflow`. List runs afterward and extract the ID.
38+
- gh cli can get gets the id of a workflow it starts, here is an example usage
39+
40+
```bash
41+
run_url="$(~/bin/gh workflow run ci-main-reusable-caller.yml --repo user/repo -f skip_rerun=false -f retries=3)"
42+
~/bin/gh run watch "${run_url##*/}" --repo user/repo --exit-status --compact --interval 30
43+
```
3644

3745
## If repo name matches `*-musl-cross-make`
3846

3947
Toolchain specifics
48+
4049
- Use both `-static` and `--static` to produce static toolchain binaries. Using only `-static` can miss POSIX threads.
4150
- When using `../config.mak`, always load options from both `../gcc-configure-options.md` and `../gcc-configure-options-recursive.md`.
4251
- The binutils gold linker is deprecated. Use `ld=default` and `--disable-gold`.
4352

4453
Fully static toolchains with musl
54+
4555
- Do not use LTO: avoid `-flto` and `-fuse-linker-plugin`.
4656
- Do not add any LTO-related settings.
4757
- Only set linker options such as `LDFLAGS` at link time, not during library builds.
@@ -52,53 +62,63 @@ Fully static toolchains with musl
5262
## Debugging with QEMU
5363

5464
- Start the target under QEMU with gdbstub, then attach with gdb:
55-
- `qemu -g <port> <binary>` (e.g., `qemu -g 1234 ./qbt-nox-static`)
56-
- In another terminal: `gdb ./qbt-nox-static` and `target remote :1234`
65+
- `qemu -g <port> <binary>` (e.g., `qemu -g 1234 ./qbt-nox-static`)
66+
- In another terminal: `gdb ./qbt-nox-static` and `target remote :1234`
5767

5868
## If repo name matches `*qbittorrent-nox-static`
5969

6070
`qi.bash` script goals
71+
6172
- Simple installer that verifies installation and binaries.
6273
- Shebang must be `#!/bin/bash`.
6374

6475
OS detection
76+
6577
- `source /etc/os-release`.
6678
- Supported: `ID=alpine`, `ID=debian`, or `ID_LIKE` contains `debian`. Otherwise exit with a clear reason.
6779

6880
Transfer tools
81+
6982
- Prefer `curl` if present; use `wget` if present and `curl` is not; exit if neither is available.
7083
- Detect presence of `gh` CLI and use it when available, but it is not required.
7184

7285
Architecture detection
86+
7387
- Alpine: `apk --print-arch`.
7488
- Debian-like: `dpkg --print-architecture`.
7589
- Architectures are the same across distros except `armhf`: Debian uses `armv7`, Alpine uses `armv6`.
7690
- If architecture is not valid/supported, exit with a reason.
7791

7892
Download function
93+
7994
- Build the download URL from the detected architecture.
8095
- Create and store the download’s SHA-256 sum.
8196

8297
Attestation (optional)
98+
8399
- When `gh` CLI is available and usable, verify downloaded binaries:
84-
- `gh attestation verify <INSTALL_PATH> --repo <REPO> 2> /dev/null`
100+
- `gh attestation verify <INSTALL_PATH> --repo <REPO> 2> /dev/null`
85101

86102
Error handling
103+
87104
- Provide a helper that checks command exit codes and exits with a concise, helpful message on failure.
88105

89106
Output formatting
107+
90108
- Provide a print helper that supports:
91-
- `[INFO]` (blue), `[WARNING]` (yellow), `[ERROR]` (red), `[SUCCESS]` (green), `[FAILURE]` (magenta)
109+
- `[INFO]` (blue), `[WARNING]` (yellow), `[ERROR]` (red), `[SUCCESS]` (green), `[FAILURE]` (magenta)
92110
- Use `printf '%s'` and `printf '%b'`; do not use `echo`.
93111
- Keep messages succinct. Be verbose only on errors to aid troubleshooting.
94112

95113
---
96114

97115
Meta for AI contributors
116+
98117
- Be conservative: do only what the prompt requests. No broad refactors.
99118
- Prefer small, well-named functions and staged changes.
100119
- Preserve existing public behavior and style unless the prompt requires changes.
101120
- If something cannot be done with available context/tools, state why and propose the smallest viable alternative.
121+
102122
# Bash Scripting - All repos
103123

104124
- use $BASH_SOURCE instead of $0
@@ -128,8 +148,10 @@ Meta for AI contributors
128148
- Do not use outdated GitHub Actions in workflow code. Always check the version recommended is the current version
129149
- The `gh` CLI cannot get the ID of a workflow it started with `gh run workflow`; you must list runs after and extract the ID.
130150

131-
# If repo = *-musl-cross-make
151+
# If repo = \*-musl-cross-make
152+
132153
GCC / Binutils
154+
133155
- Use both `-static` and `--static` to create static toolchain binaries. Using `-static` alone can cause errors (e.g., missing POSIX threads).
134156
- When working with `../config.mak`, always load options from both `../gcc-configure-options.md` and `../gcc-configure-options-recursive.md`.
135157
- The binutils gold linker is deprecated. Use `ld=default` and `--disable-gold`.
@@ -146,42 +168,50 @@ GCC / Binutils
146168
- To debug with QEMU:
147169
Run `qemu -g <port> <binary>` (e.g., `qemu -g 1234 ./qbt-nox-static`), then connect with `gdb ./qbt-nox-static` in another terminal.
148170

149-
# If repo = * qbittorrent-nox-static
171+
# If repo = \* qbittorrent-nox-static
150172

151173
## qi.bash script
152174

153175
General features
176+
154177
- Always use `#!/bin/bash` as the shebang.
155178
- this script is focused on being a simple installer that verifies installation and binaries.
156179

157180
basic check for supported os
181+
158182
- use source /etc/os-release
159183
- if ID = alpine of debian or if the or if ID_LIKE=debian is debian like we can proceed.
160184
- if not supported os exit with reason.
161185

162186
basic check for wget or curl, default to curl if present.
187+
163188
- if no tools exit with reason.
164189
- wget or curl must have, curl default if present but use wget if there.
165190
- check if gh cli is available to use but no required.
166191

167192
basic check of which arch using
193+
168194
- alpine use apk --print-arch
169195
- debian like use dpkg --print-architecture
170196
- all arches are the same except armhf. on debian this is armv7 and alpine armv6
171197
- if not valid arch exit with reason.
172198

173199
create download function based on arch checks.
200+
174201
- configure download url based on arch.
175202
- creates sha256 of download.
176203

177204
gh cli function
205+
178206
- if gh cli exists and is usable use it to very the binaries downloaded
179207
- if gh attestation verify <INSTALL_PATH> --repo <REPO> 2> /dev/null; then ...
180208

181209
error handling
210+
182211
- there should be a error handling function to test commands exit the script with helpful explanations when a command or function fails.
183212

184213
ouputs
214+
185215
- there should be a function to handle printing outputs.
186216
- It should handle [INFO] (blue) [WARNING] (yellow) [ERROR] (red) [SUCCESS] (Green) [FAILURE] (magenta)
187217
- Use `printf '%s'` for printing strings and `printf '%b'` for escape sequences. **Avoid using `echo`.**

.github/workflows/ci-auto-rerun-failed-jobs-action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
permissions:
2828
actions: write
2929
runs-on: ubuntu-24.04-arm
30+
environment: production
3031
env:
3132
GH_TOKEN: "${{ secrets.AUTO_RERUN || github.token }}"
3233
steps:

.github/workflows/ci-main-reusable-caller.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ jobs:
113113
permissions:
114114
actions: write
115115
runs-on: ubuntu-24.04-arm
116+
environment: production
116117
env:
117118
GH_TOKEN: "${{ secrets.AUTO_RERUN || github.token }}"
118119
github_repo: "" # To use ci-auto-rerun-failed-jobs.yml hosted in a remote repository else default to the current repository. Requires PAT token AUTO_RERUN

.github/workflows/send_files.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions: {}
1414
jobs:
1515
send_to_usrdx_s:
1616
runs-on: ubuntu-24.04-arm
17+
environment: production
1718

1819
steps:
1920
- name: Trigger grab_files workflow in usrdx/s

0 commit comments

Comments
 (0)