Skip to content

Commit 5bc23c9

Browse files
committed
hello world!
0 parents  commit 5bc23c9

File tree

22 files changed

+1570
-0
lines changed

22 files changed

+1570
-0
lines changed

.cargo/config.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# copied from https://github.com/srcwr/srcwrtimer/blob/main/.cargo/config.toml
2+
3+
[build]
4+
target-dir = "_build"
5+
6+
# 2025... we can rely on CPUs to be using SSE2... not that it will likely change much in codegen...
7+
rustflags = ["-Ctarget-feature=+sse2"]
8+
9+
target = "i686-pc-windows-msvc"
10+
11+
[env]
12+
CFLAGS_i686_pc_windows_msvc = "/Zi /FS"
13+
CXXFLAGS_i686_pc_windows_msvc = "/Zi /FS"
14+
15+
[target.i686-pc-windows-msvc]
16+
rustflags = [
17+
# 2025... we can rely on CPUs to be using SSE2... not that it will likely change much in codegen...
18+
"-Ctarget-feature=+sse2",
19+
# TODO: Do we want static crt on Windows? I can't remember if there was a reason for this...
20+
"-Ctarget-feature=+crt-static",
21+
# Yeah, we want frame pointers...
22+
"-Cforce-frame-pointers=yes",
23+
]

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text=auto
2+
*.inc diff=sourcepawn linguist-language=SourcePawn
3+
*.sp diff=sourcepawn linguist-language=SourcePawn
4+
*.txt diff
5+
*.cfg diff
6+
7+
*.smx binary
8+
*.mp3 binary
9+
*.vmt diff
10+
*.vtf binary
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copied mostly from https://github.com/srcwr/srcwrtimer/blob/main/.github/workflows/build-everything.yml
2+
3+
name: Build everything
4+
5+
# TODO: Print hashes to ghactions "summary" info and/or setup some of the ghactions attestation shit...
6+
# Steal from this maybe: https://github.com/zhongfly/mpv-winbuild/blob/main/.github/workflows/mpv.yml
7+
8+
# TODO: add another job that only builds sourcepawn files when only those are touched
9+
on:
10+
push:
11+
paths: ['**.rs', '**.h', '**.hpp', '**.c', '**.cpp', '**.sp', '**.inc', '**.toml', '**.lock', '**.yml']
12+
pull_request:
13+
paths: ['**.rs', '**.h', '**.hpp', '**.c', '**.cpp', '**.sp', '**.inc', '**.toml', '**.lock', '**.yml']
14+
workflow_dispatch:
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
19+
jobs:
20+
build_everything:
21+
runs-on: windows-latest
22+
23+
steps:
24+
- name: Prepare env
25+
shell: bash
26+
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
27+
# checkout current repo...
28+
- uses: actions/checkout@v4
29+
# checkout srcwrtimer since we use it for shit...
30+
- uses: actions/checkout@v4
31+
with:
32+
repository: srcwr/srcwrtimer
33+
path: ..
34+
- name: Install cargo-binstall
35+
uses: cargo-bins/[email protected]
36+
- name: Install the cargo bins we use...
37+
shell: pwsh
38+
run: |
39+
cargo binstall -y cargo-make
40+
cargo binstall -y cargo-zigbuild
41+
# This is `cargo make full` but turned into steps so you can have better progress visibility
42+
- name: Install Rust toolchains
43+
run: |
44+
cargo make rustup-linux
45+
cargo make rustup-msvc
46+
- name: Clone alliedmodders repositories
47+
run: cargo make clone-alliedmodders
48+
- name: Setup SourcePawn Compiler
49+
uses: rumblefrog/[email protected]
50+
with:
51+
version: '1.12.7177' ### UPDATE Makefile.toml whenever this is updated.
52+
- name: Setup Zig
53+
uses: mlugg/setup-zig@v1
54+
with:
55+
version: '0.13.0' ### UPDATE Makefile.toml whenever this is updated.
56+
- name: Build extensions for Linux
57+
run: cargo make linux
58+
- name: Build extensions for Windows/MSVC
59+
run: cargo make msvc
60+
- name: Copy things to _package
61+
run: |
62+
cargo make copy-srcwrtimer
63+
cargo make copy-extensions
64+
- name: Build plugins
65+
run: cargo make compile-srcwrtimer-scripts
66+
- name: Upload package
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: srcwrtimer-${{ github.head_ref || github.ref_name }}-${{ env.GITHUB_SHA_SHORT }}
70+
path: _package/srcwrtimer
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Post artifact link in pull request
2+
on:
3+
workflow_run:
4+
workflows: ['Build everything']
5+
types: [completed]
6+
jobs:
7+
pr_comment:
8+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/github-script@v6
12+
with:
13+
# This snippet is public-domain, taken from
14+
# https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml
15+
script: |
16+
async function upsertComment(owner, repo, issue_number, purpose, body) {
17+
const {data: comments} = await github.rest.issues.listComments(
18+
{owner, repo, issue_number});
19+
20+
const marker = `<!-- bot: ${purpose} -->`;
21+
body = marker + "\n" + body;
22+
23+
const existing = comments.filter((c) => c.body.includes(marker));
24+
if (existing.length > 0) {
25+
const last = existing[existing.length - 1];
26+
core.info(`Updating comment ${last.id}`);
27+
await github.rest.issues.updateComment({
28+
owner, repo,
29+
body,
30+
comment_id: last.id,
31+
});
32+
} else {
33+
core.info(`Creating a comment in issue / PR #${issue_number}`);
34+
await github.rest.issues.createComment({issue_number, body, owner, repo});
35+
}
36+
}
37+
38+
const {owner, repo} = context.repo;
39+
const run_id = ${{github.event.workflow_run.id}};
40+
41+
const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }};
42+
if (!pull_requests.length) {
43+
return core.error("This workflow doesn't match any pull requests!");
44+
}
45+
46+
const artifacts = await github.paginate(
47+
github.rest.actions.listWorkflowRunArtifacts, {owner, repo, run_id});
48+
if (!artifacts.length) {
49+
return core.error(`No artifacts found`);
50+
}
51+
let body = `Download the artifacts for this pull request:\n`;
52+
for (const art of artifacts) {
53+
body += `\n* [${art.name}.zip](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
54+
}
55+
56+
core.info("Review thread message body:", body);
57+
58+
for (const pr of pull_requests) {
59+
await upsertComment(owner, repo, pr.number,
60+
"nightly-link", body);
61+
}

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
/_build
3+
/_package
4+
/_external
5+
6+
/target
7+
/debug
8+
/release
9+
10+
*secret*
11+
12+
*.ilk
13+
*.smx
14+
*.dll
15+
*.exe
16+
*.so
17+
*.pdb
18+
*.zip

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"rust-analyzer.cargo.target": "i686-pc-windows-msvc",
3+
"rust-analyzer.cargo.extraArgs": ["--release"],
4+
"rust-analyzer.check.allTargets": false,
5+
"rust-analyzer.checkOnSave.allTargets": false,
6+
"search.exclude": {
7+
"**/_build": true,
8+
"**/_package": true,
9+
"**/target": true
10+
}
11+
}

0 commit comments

Comments
 (0)