84 lines
2.1 KiB
YAML
84 lines
2.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
nro:
|
|
name: Build NRO
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: devkitpro/devkita64:latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Configure
|
|
run: cmake --preset switch
|
|
|
|
- name: Build
|
|
run: cmake --build build -j$(nproc)
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: NXST-${{ github.sha }}
|
|
path: build/NXST.nro
|
|
|
|
release:
|
|
name: Upload release asset
|
|
runs-on: ubuntu-latest
|
|
needs: nro
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: NXST-${{ github.sha }}
|
|
|
|
- name: Create Gitea release and upload NRO
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
TAG: ${{ github.ref_name }}
|
|
API: ${{ github.server_url }}/api/v1
|
|
REPO: ${{ github.repository }}
|
|
run: |
|
|
release_id=$(curl -sf -X POST "$API/repos/$REPO/releases" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\": \"$TAG\", \"name\": \"$TAG\"}" \
|
|
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
|
|
|
curl -sf -X POST "$API/repos/$REPO/releases/$release_id/assets?name=NXST.nro" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary @NXST.nro
|
|
|
|
format:
|
|
name: Format check
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install clang-format
|
|
run: sudo apt-get install -y clang-format
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
find src include \( -name '*.cpp' -o -name '*.hpp' \) \
|
|
| xargs clang-format --dry-run --Werror
|
|
|
|
layering:
|
|
name: Layering check
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: UI must not include net/sys headers
|
|
run: |
|
|
! grep -rE '^#include\s*[<"](arpa/inet|sys/socket|pthread)' src/ui/
|