Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake dynamic libs packaging #97

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/docker-switch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Docker Image CI for GHCR
on:
push:
paths:
- docker/impacto-switch/*
- .github/workflows/docker-switch.yml

jobs:
build_and_publish:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/committeeofzero/impacto-switch

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
context: docker/impacto-switch
file: docker/impacto-switch/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
108 changes: 40 additions & 68 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ jobs:
os_name: macos-x64
triplet: x64-osx-ci
host_triplet: x64-osx-ci
- os: ubuntu-latest
os_name: switch
triplet: none
host_triplet: none
- os: ubuntu-latest
os_name: android
triplet: arm64-android-ci
Expand Down Expand Up @@ -109,69 +105,22 @@ jobs:
distribution: "temurin"
cache: 'gradle'

- name: Download Switch deps
if: matrix.os_name == 'switch'
uses: blauqs/actions-download-asset@master
with:
repo: MrRevo3D/impacto
version: buildtag
file: devkitpro.tgz
out: /opt
token: ${{ secrets.SWITCH_BUILD_TOKEN }}

- name: Cache LibAtrac9
if: matrix.os_name != 'switch'
uses: actions/cache@v3
with:
key: libatrac9 | ${{ matrix.os_name }}
path: vendor/LibAtrac9

- uses: lukka/get-cmake@latest
- name: Setup vcpkg
if: matrix.os_name != 'switch'
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgDirectory: '${{ runner.workspace }}/build/vcpkg'
vcpkgGitCommitId: '${{ env.vcpkgCommitId }}'
vcpkgJsonGlob: '**/vcpkg.json'
- name: Build Atrac9 Windows
if: matrix.os_name == 'windows'
run: |
./build-deps.ps1 -Arg1 x64
shell: pwsh
- name: Setup Dependencies Linux/MacOS/Android
if: contains(matrix.os_name, 'macos') || contains(matrix.os_name, 'linux') || contains(matrix.os_name, 'android')
run: |-
pushd vendor
if [ ! -d "LibAtrac9" ]; then
git clone https://github.com/Thealexbarney/LibAtrac9.git --depth 1
fi
cd LibAtrac9/C
if [[ "${{ matrix.os_name }}" == "macos"* ]]; then
sed -i '' -e 's/,--version-script=libatrac9.version//g' Makefile
fi
if [ -z "${CC}" ]; then
make
else
make CC="$CC"
fi

mkdir -p ../include/libatrac9
mkdir -p ../libs
cp bin/libatrac9.a ../libs/
cp src/libatrac9.h ../include/libatrac9/
popd
echo "LIBATRAC9DIR=${{ github.workspace }}/vendor/LibAtrac9" >> $GITHUB_ENV
find "${{ github.workspace }}/vendor/LibAtrac9"
- name: Install Dependencies Linux
run: sudo apt-get install nasm libx11-dev libxft-dev libxext-dev libwayland-dev libxkbcommon-dev libegl1-mesa-dev libibus-1.0-dev libxrandr-dev
if: matrix.os_name == 'linux' || matrix.os_name == 'android'
- name: Install Dependencies Mac
run: brew install nasm
if: contains(matrix.os_name, 'macos')
- name: Run CMake with vcpkg.json manifest
if: matrix.os_name != 'switch'
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
Expand All @@ -182,21 +131,6 @@ jobs:
'-DVCPKG_HOST_TRIPLET=${{ matrix.host_triplet }}',
]
buildPreset: ${{ env.PresetName }}

- name: Run Switch build
if: matrix.os_name == 'switch'
run: |-
tar -xzf /opt/devkitpro.tgz -C /opt
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=/opt/devkitpro/devkitARM
export PATH="/opt/devkitpro/tools/bin:$PATH"
cmake . -DCMAKE_TOOLCHAIN_FILE=HorizonNX.toolchain
make -j2
elf2nro impacto impacto.nro
mkdir -p "${{ github.workspace }}/release/${{ env.PresetName }}"
cp impacto.nro "${{ github.workspace }}/release/${{ env.PresetName }}"
cp -r profiles "${{ github.workspace }}/release/${{ env.PresetName }}"
cp -r games "${{ github.workspace }}/release/${{ env.PresetName }}"
- name: Copy Shaders
run: cp -r src/shaders "${{ github.workspace }}/release/${{ env.PresetName }}"
shell: bash
Expand Down Expand Up @@ -230,15 +164,52 @@ jobs:
path: impacto-${{ matrix.os_name }}-${{ vars.VERSION }}${{ github.run_number }}-${{ github.sha }}.zip
name: release-${{ matrix.os_name }}


switch:
runs-on: ubuntu-latest
timeout-minutes: 120
needs: lint
permissions:
contents: read
container:
image: ghcr.io/committeeofzero/impacto-switch:latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ needs.lint.outputs.commitid }}
- name: Run build
run: |-
cmake . -DCMAKE_TOOLCHAIN_FILE=HorizonNX.toolchain
make -j2
elf2nro impacto impacto.nro
mkdir -p "release/ci-release"
cp impacto.nro "release/ci-release"
cp -r profiles "release/ci-release"
cp -r games "release/ci-release"
- name: Copy Shaders
run: cp -r src/shaders "release/${{ env.PresetName }}"
shell: bash
- name: Copy docs
run: |
cp THIRDPARTY.md README.md LICENSE "release/${{ env.PresetName }}"
shell: bash
- name: Archive Artifacts
run: |
7z u impacto-switch-${{ vars.VERSION }}${{ github.run_number }}-${{ github.sha }}.zip release/ci-release/*
- name: Upload Artifact
uses: actions/[email protected]
with:
path: impacto-switch-${{ vars.VERSION }}${{ github.run_number }}-${{ github.sha }}.zip
name: release-switch

publish_artifacts:
name: Publish Artifacts
runs-on: ubuntu-22.04
permissions:
contents: write
needs:
- job-matrix
if: needs.job-matrix.result == 'success' && github.event_name != 'pull_request_target' && ((startsWith(github.ref, 'refs/tags') || github.ref_name == 'master'))
- switch
if: needs.job-matrix.result == 'success' && needs.switch.result == 'success' && github.event_name != 'pull_request_target' && ((startsWith(github.ref, 'refs/tags') || github.ref_name == 'master'))
steps:
- uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -283,6 +254,7 @@ jobs:
runs-on: ubuntu-22.04
needs:
- job-matrix
- switch
if: always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled'))
steps:
- uses: actions/checkout@v2
Expand Down
Loading
Loading