Skip to content

Commit f97bace

Browse files
committed
Initial commit
0 parents  commit f97bace

File tree

119 files changed

+8979
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+8979
-0
lines changed

.clang-format

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
BasedOnStyle: Microsoft,
3+
IndentWidth: 4,
4+
TabWidth: 4,
5+
PointerAlignment: Left,
6+
ColumnLimit: 0,
7+
NamespaceIndentation: All,
8+
IndentCaseLabels: true,
9+
Language: Cpp,
10+
}

.github/workflows/build-ndk.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: NDK build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [master, RedBrumbler-branch]
7+
paths-ignore:
8+
- '**.yml'
9+
- '!.github/workflows/build-ndk.yml'
10+
- '**.json'
11+
- '!qpm.json'
12+
- '!mod.template.json'
13+
- '**.txt'
14+
- '!CMakeLists.txt'
15+
- '**.ps1'
16+
- '!build.ps1'
17+
- '!createqmod.ps1'
18+
- '**.md'
19+
- '.gitignore'
20+
pull_request:
21+
branches: master
22+
23+
env:
24+
ndkname: android-ndk-r22
25+
module_id: scoresaber
26+
qmodName: ScoreSaber
27+
28+
jobs:
29+
build:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
name: Checkout
35+
with:
36+
submodules: true
37+
lfs: true
38+
39+
- uses: seanmiddleditch/gha-setup-ninja@v3
40+
41+
- name: Create ndkpath.txt
42+
run: |
43+
echo "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt
44+
cat ${GITHUB_WORKSPACE}/ndkpath.txt
45+
46+
- name: Get QPM
47+
if: steps.cache-qpm.outputs.cache-hit != 'true'
48+
uses: dawidd6/action-download-artifact@v2
49+
with:
50+
github_token: ${{secrets.GITHUB_TOKEN}}
51+
workflow: cargo-build.yml
52+
name: linux-qpm-rust
53+
path: QPM
54+
repo: RedBrumbler/QuestPackageManager-Rust
55+
56+
- name: QPM Collapse
57+
run: |
58+
chmod +x ./QPM/qpm-rust
59+
./QPM/qpm-rust collapse
60+
61+
- name: QPM Dependencies Cache
62+
id: cache-qpm-deps
63+
uses: actions/cache@v2
64+
env:
65+
cache-name: cache-qpm-deps
66+
with:
67+
path: /home/runner/.local/share/QPM-Rust/cache
68+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('qpm.json') }}
69+
restore-keys: |
70+
${{ runner.os }}-build-${{ env.cache-name }}-
71+
${{ runner.os }}-build-
72+
${{ runner.os }}-
73+
74+
- name: QPM Restore
75+
run: |
76+
./QPM/qpm-rust restore
77+
78+
- name: List Post Restore
79+
run: |
80+
echo includes:
81+
ls -la ${GITHUB_WORKSPACE}/extern/includes
82+
echo libs:
83+
ls -la ${GITHUB_WORKSPACE}/extern/libs
84+
echo cache:
85+
ls -la $HOME/.local/share/QPM-Rust/cache
86+
87+
- name: Apply Legacy fix
88+
run: |
89+
./QPM/qpm-rust cache legacy-fix
90+
91+
- name: Build
92+
run: |
93+
cd ${GITHUB_WORKSPACE}
94+
./QPM/qpm-rust qmod build --include_libs "lib${module_id}.so"
95+
pwsh -Command ./build.ps1
96+
97+
- name: Create Qmod
98+
run: |
99+
pwsh -Command ./createqmod.ps1 ${{env.qmodName}}
100+
101+
- name: Get Library Name
102+
id: libname
103+
run: |
104+
cd ./build/
105+
pattern="lib${module_id}*.so"
106+
files=( $pattern )
107+
echo ::set-output name=NAME::"${files[0]}"
108+
109+
- name: Upload non-debug artifact
110+
uses: actions/upload-artifact@v2
111+
with:
112+
name: ${{ steps.libname.outputs.NAME }}
113+
path: ./build/${{ steps.libname.outputs.NAME }}
114+
if-no-files-found: error
115+
116+
# - name: Upload debug artifact
117+
# uses: actions/upload-artifact@v2
118+
# with:
119+
# name: debug_${{ steps.libname.outputs.NAME }}
120+
# path: ./build/debug/${{ steps.libname.outputs.NAME }}
121+
# if-no-files-found: error
122+
123+
- name: Upload qmod artifact
124+
uses: actions/upload-artifact@v2
125+
with:
126+
name: ${{env.qmodName}}.qmod
127+
path: ./${{ env.qmodName }}.qmod
128+
if-no-files-found: error
129+
# - name: Check if webhook secret set
130+
# id: webhook-set
131+
# run: echo ::set-output name=EXISTS::"${{secrets.DISCORD_WEBHOOK_URL != ''}}"
132+
#
133+
# - name: Publish qmod to webhook
134+
# if: ${{ steps.webhook-set.outputs.EXISTS }}
135+
# uses: tsickert/[email protected]
136+
# with:
137+
# webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
138+
# content: "${{ env.CI_SHA_SHORT }} - `${{ github.event.head_commit.message }}`"
139+
# username: "${{ github.repository }}"
140+
# avatar-url: "http://github.com/${{ env.CI_REPOSITORY_OWNER }}.png"
141+
# filename: ./${{ env.qmodName }}.qmod

.github/workflows/publish.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
name: Publish QPM Package
2+
3+
env:
4+
ndkname: android-ndk-r22
5+
module_id: scoresaber
6+
qmodName: ScoreSaber
7+
8+
on:
9+
push:
10+
tags:
11+
- 'v*'
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
name: Checkout
20+
with:
21+
submodules: true
22+
lfs: true
23+
24+
- uses: seanmiddleditch/gha-setup-ninja@v3
25+
26+
- name: Create ndkpath.txt
27+
run: |
28+
echo "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt
29+
cat ${GITHUB_WORKSPACE}/ndkpath.txt
30+
31+
- name: Get QPM
32+
if: steps.cache-qpm.outputs.cache-hit != 'true'
33+
uses: dawidd6/action-download-artifact@v2
34+
with:
35+
github_token: ${{secrets.GITHUB_TOKEN}}
36+
workflow: cargo-build.yml
37+
name: linux-qpm-rust
38+
path: QPM
39+
repo: RedBrumbler/QuestPackageManager-Rust
40+
41+
- name: QPM Collapse
42+
run: |
43+
chmod +x ./QPM/qpm-rust
44+
./QPM/qpm-rust collapse
45+
46+
- name: QPM Dependencies Cache
47+
id: cache-qpm-deps
48+
uses: actions/cache@v2
49+
env:
50+
cache-name: cache-qpm-deps
51+
with:
52+
path: /home/runner/.local/share/QPM-Rust/cache
53+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('qpm.json') }}
54+
restore-keys: |
55+
${{ runner.os }}-build-${{ env.cache-name }}-
56+
${{ runner.os }}-build-
57+
${{ runner.os }}-
58+
59+
- name: QPM Restore
60+
run: |
61+
./QPM/qpm-rust restore
62+
63+
- name: List Post Restore
64+
run: |
65+
echo includes:
66+
ls -la ${GITHUB_WORKSPACE}/extern/includes
67+
echo libs:
68+
ls -la ${GITHUB_WORKSPACE}/extern/libs
69+
echo cache:
70+
ls -la $HOME/.local/share/QPM-Rust/cache
71+
72+
- name: Get Tag Version
73+
id: get_tag_version
74+
run: |
75+
echo ${GITHUB_REF#refs/tags/}
76+
echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
77+
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
78+
79+
- name: QPM Edit Version
80+
run: |
81+
./QPM/qpm-rust package edit --version "${{ steps.get_tag_version.outputs.VERSION }}"
82+
83+
- name: Apply Legacy fix
84+
run: |
85+
./QPM/qpm-rust cache legacy-fix
86+
87+
- name: Build
88+
run: |
89+
cd ${GITHUB_WORKSPACE}
90+
./QPM/qpm-rust qmod build --include_libs "lib${module_id}.so"
91+
pwsh -Command ./build.ps1
92+
93+
- name: Create Qmod
94+
run: |
95+
pwsh -Command ./createqmod.ps1 ${{env.qmodName}}
96+
97+
# Commit the change to the package, .vscode/c_cpp_properties.json, and Android.mk
98+
- name: Configure commit
99+
run: |
100+
git config user.name "Github Actions"
101+
git config user.email "<>"
102+
- name: Commit Edit Version
103+
run: |
104+
git add ./qpm.json
105+
git commit -m "Update Version and post restore" --allow-empty
106+
# Then, we want to use the commit we have just made, and force push our tag to that commit
107+
- name: Get Commit ID
108+
id: get_commit_id
109+
run: |
110+
echo `git rev-parse HEAD`
111+
echo ::set-output name=ID::`git rev-parse HEAD`
112+
- name: Force create tag
113+
run: |
114+
git tag --force ${{ steps.get_tag_version.outputs.TAG }} ${{ steps.get_commid_id.outputs.ID }}
115+
# Then, push, upload our artifacts, modify the config file to have soLink and debugSoLink
116+
- name: Create and push version specific branch
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
run: |
120+
git branch version-${{ steps.get_tag_version.outputs.TAG }}
121+
git push -u origin version-${{ steps.get_tag_version.outputs.TAG }} --force --tags
122+
# Get release that was created for this tag
123+
- name: Get Release
124+
uses: octokit/[email protected]
125+
id: get_release
126+
with:
127+
route: GET /repos/:repository/releases/tags/${{ steps.get_tag_version.outputs.TAG }}
128+
repository: ${{ github.repository }}
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
132+
- name: Get Release Upload URL
133+
id: get_upload_url
134+
run: |
135+
url=$(echo "$response" | jq -r '.upload_url')
136+
echo $url
137+
echo "::set-output name=upload_url::$url"
138+
env:
139+
response: ${{ steps.get_release.outputs.data }}
140+
141+
- name: Get Library Name
142+
id: libname
143+
run: |
144+
cd ./build/
145+
pattern="lib${module_id}*.so"
146+
files=( $pattern )
147+
echo ::set-output name=NAME::"${files[0]}"
148+
149+
# Upload our release assets
150+
- name: Upload Release Asset
151+
id: upload_release_asset
152+
uses: actions/upload-release-asset@v1
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155+
with:
156+
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
157+
asset_path: ./build/${{ steps.libname.outputs.NAME }}
158+
asset_name: ${{ steps.libname.outputs.NAME }}
159+
asset_content_type: application/octet-stream
160+
161+
- name: Upload Debug Asset
162+
id: upload_debug_asset
163+
uses: actions/upload-release-asset@v1
164+
env:
165+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166+
with:
167+
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
168+
asset_path: ./build/debug_${{ steps.libname.outputs.NAME }}
169+
asset_name: debug_${{ steps.libname.outputs.NAME }}
170+
asset_content_type: application/octet-stream
171+
172+
- name: Upload Qmod asset
173+
id: upload_qmod_asset
174+
uses: actions/upload-release-asset@v1
175+
env:
176+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
177+
with:
178+
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
179+
asset_path: ./${{ env.qmodName }}.qmod
180+
asset_name: ${{ env.qmodName }}.qmod
181+
asset_content_type: application/octet-stream
182+
183+
- name: Change QPM Package Info
184+
run: |
185+
./QPM/qpm-rust package edit-extra --branchName "version-${{ steps.get_tag_version.outputs.TAG }}"
186+
./QPM/qpm-rust package edit-extra --soLink "${{ steps.upload_release_asset.outputs.browser_download_url }}"
187+
./QPM/qpm-rust package edit-extra --debugSoLink "${{ steps.upload_debug_asset.outputs.browser_download_url }}"
188+
./QPM/qpm-rust package edit-extra --modLink "${{ steps.upload_qmod_asset.outputs.browser_download_url }}"
189+
190+
- name: Commit Changed package info
191+
run: |
192+
git add qpm.json
193+
git commit -m "Updated qpm.json"
194+
195+
# Then, we want to use the commit we have just made, and force push our tag to that commit
196+
- name: Get Commit ID
197+
id: get_created_commit_id
198+
run: |
199+
echo `git rev-parse HEAD`
200+
echo ::set-output name=ID::`git rev-parse HEAD`
201+
202+
- name: Push New Commit and Tag
203+
run: |
204+
git push origin HEAD:version-${{ steps.get_tag_version.outputs.TAG }} --force
205+
git tag --force ${{ steps.get_tag_version.outputs.TAG }} ${{ steps.get_created_commit_id.outputs.ID }}
206+
git push --tags --force
207+
208+
# - name: Merge this branch into whatever branch we were originally built off of.
209+
# TODO
210+
# Not a Package
211+
# - name: QPM Publish
212+
# run: ./QPM/qpm-rust publish

0 commit comments

Comments
 (0)