diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a48fa12..ef7596d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,111 +6,6 @@ on: jobs: - build-simapi: - - strategy: - matrix: - os: [ubuntu-latest, debian-latest, debian-stable] - runs-on: ${{ matrix.os }} - - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - - - name: Set build dir - id: strings - shell: bash - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - github_sha_hash=${{ github.sha }} - echo "github-sha-short=${github_sha_hash:0:7}" >> $GITHUB_OUTPUT - - - name: Update apt - run: sudo apt update - - name: Install Dependencies - run: sudo apt install -y libuv1-dev libargtable2-dev libconfig-dev libyder-dev libproc2-dev - - - name: Configure CMake - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=g++ - -DCMAKE_C_COMPILER=gcc - -DCMAKE_BUILD_TYPE=Release - -DBUILD_SIMD=ON - -S ${{ github.workspace }} - - - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release - - - name: Build simapi debian package - run: | - rm -rf SIMAPI_PKG_SOURCE - mkdir SIMAPI_PKG_SOURCE - mkdir -p SIMAPI_PKG_SOURCE/DEBIAN - mkdir -p SIMAPI_PKG_SOURCE/usr/lib/x86_64-linux-gnu/ - cp ./tools/distro/debian/dpkg/${{ matrix.os }}/simapi_control ./SIMAPI_PKG_SOURCE/DEBIAN/control - cp -r \ - build/libsimapi.so \ - build/libsimapi.so.1 \ - build/libsimapi.so.1.0.1 \ - SIMAPI_PKG_SOURCE/usr/lib/x86_64-linux-gnu/ - dpkg-deb --build SIMAPI_PKG_SOURCE simapi-${{ matrix.os }}.deb - - - name: Build simd debian package - run: | - rm -rf SIMD_PKG_SOURCE - mkdir SIMD_PKG_SOURCE - mkdir -p SIMD_PKG_SOURCE/DEBIAN - mkdir -p SIMD_PKG_SOURCE/usr/bin/ - cp ./tools/distro/debian/dpkg/${{ matrix.os }}/simd_control ./SIMD_PKG_SOURCE/DEBIAN/control - cp build/simd/simd ./SIMD_PKG_SOURCE/usr/bin/simd - dpkg-deb --build SIMD_PKG_SOURCE simd-${{ matrix.os }}.deb - - - name: Release the Package - uses: softprops/action-gh-release@v1 - with: - files: simapi-${{ matrix.os }}.deb - - - name: Release the Package - uses: softprops/action-gh-release@v1 - with: - files: simd-${{ matrix.os }}.deb - - build-simapi-rpms: - strategy: - matrix: - os: [fedora-43] - runs-on: ${{ matrix.os }} - permissions: - contents: write - steps: - - - name: create rpmbuild dirs - run: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - - name: get spec file - run: curl -o ~/simapi.spec https://raw.githubusercontent.com/Spacefreak18/simapi/refs/heads/master/tools/distro/fedora/rpm/simapi.spec - - name: run spec file - run: rpmbuild -ba ~/simapi.spec - - name: rename file - run: cp ~/rpmbuild/RPMS/x86_64/libsimapi-0.0.5-1.x86_64.rpm $GITHUB_WORKSPACE/libsimapi-${{ matrix.os }}.rpm - - name: get spec file - run: curl -o ~/simd.spec https://raw.githubusercontent.com/Spacefreak18/simapi/refs/heads/master/tools/distro/fedora/rpm/simd.spec - - name: run spec file - run: rpmbuild -ba ~/simd.spec - - name: rename file - run: cp ~/rpmbuild/RPMS/x86_64/simd-0.0.5-1.x86_64.rpm $GITHUB_WORKSPACE/simd-${{ matrix.os }}.rpm - - name: Release libsimapi Package - uses: softprops/action-gh-release@v1 - with: - files: libsimapi-${{ matrix.os }}.rpm - - name: Release simd Package - uses: softprops/action-gh-release@v1 - with: - files: simd-${{ matrix.os }}.rpm - - build-simapi-nix: runs-on: ubuntu-latest diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index d6401b0..eaa4756 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -200,7 +200,12 @@ jobs: # The specs' hardcoded `Version: 0.0.5` is stale; stamped from the # tag here so the file stays a working default for a local rpmbuild. for spec in simapi simd; do - rpmbuild -ba --define "_version ${{ steps.pkgver.outputs.version }}" \ + # staged=1 tells %prep to use the tree copied into SOURCES above + # rather than cloning. Without it the spec clones the default + # branch, and the rpm's contents would track master rather than + # the tag being built. + rpmbuild -ba --define "staged 1" \ + --define "_version ${{ steps.pkgver.outputs.version }}" \ --define "version ${{ steps.pkgver.outputs.version }}" \ tools/distro/fedora/rpm/$spec.spec done diff --git a/tools/distro/fedora/rpm/simapi.spec b/tools/distro/fedora/rpm/simapi.spec index 3fdaeed..fd605b0 100644 --- a/tools/distro/fedora/rpm/simapi.spec +++ b/tools/distro/fedora/rpm/simapi.spec @@ -21,7 +21,12 @@ Racing Simulator Telemetry Libraries # CI stages the checked-out tree; a bare `rpmbuild -ba` still works as before. %prep rm -rf $RPM_BUILD_DIR/simapi -if [ ! -d $RPM_SOURCE_DIR/simapi ]; then +# Staging a tree is opt-in, via --define "staged 1". Without it this always +# starts from a fresh clone, including removing any previous $RPM_SOURCE_DIR +# checkout: on a self-hosted runner that directory persists between builds, so +# reusing whatever happens to be there silently builds a stale tree. +if [ "%{?staged}" != "1" ]; then + rm -rf $RPM_SOURCE_DIR/simapi cd $RPM_SOURCE_DIR git clone https://github.com/spacefreak18/simapi fi diff --git a/tools/distro/fedora/rpm/simd.spec b/tools/distro/fedora/rpm/simd.spec index 62c9a8a..db269d3 100644 --- a/tools/distro/fedora/rpm/simd.spec +++ b/tools/distro/fedora/rpm/simd.spec @@ -23,7 +23,12 @@ Racing Simulator Telemetry Libraries # CI stages the checked-out tree; a bare `rpmbuild -ba` still works as before. %prep rm -rf $RPM_BUILD_DIR/simapi -if [ ! -d $RPM_SOURCE_DIR/simapi ]; then +# Staging a tree is opt-in, via --define "staged 1". Without it this always +# starts from a fresh clone, including removing any previous $RPM_SOURCE_DIR +# checkout: on a self-hosted runner that directory persists between builds, so +# reusing whatever happens to be there silently builds a stale tree. +if [ "%{?staged}" != "1" ]; then + rm -rf $RPM_SOURCE_DIR/simapi cd $RPM_SOURCE_DIR git clone https://github.com/spacefreak18/simapi fi