diff --git a/.github/actions/deps/action.yml b/.github/actions/deps/action.yml new file mode 100644 index 0000000..b8bb6dc --- /dev/null +++ b/.github/actions/deps/action.yml @@ -0,0 +1,55 @@ +name: Install Dependencies +description: Install Dependencies +inputs: + ccache-cache-name: + description: CCache cache name + required: true + runs-on: + description: The platform on which the workflow will be run. + required: true +runs: + using: composite + steps: + - name: Install GCC Problem Matcher + uses: root-project/gcc-problem-matcher-improved@9d83f12b27a78210f0485fb188e08d94fa807a6d + with: + build-directory: build # ${{ env.BUILD_DIR }} has backslashes, which make the problem matcher choke + + - name: Install Dependencies (Windows) + uses: msys2/setup-msys2@v2 + if: ${{ contains(inputs.runs-on, 'windows') }} + with: + msystem: MINGW64 + update: true + install: git pkgconf mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-ninja mingw-w64-x86_64-toolchain + + - name: Install Dependencies (macOS) + if: ${{ contains(inputs.runs-on, 'macos') }} + shell: bash + run: brew install pkg-config cmake ninja ccache + + - name: Install Dependencies (Linux x86_64) + if: ${{ contains(inputs.runs-on, 'ubuntu-latest') }} + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: cmake ninja-build libepoxy-dev ccache + version: 1.0 + + - name: Set Up Repositories (Linux aarch64) + uses: ryankurte/action-apt@v0.3.0 + if: ${{ contains(inputs.ccache-cache-name, 'linux-aarch64') }} + with: + arch: arm64 + packages: git + + - name: Install Dependencies (Linux aarch64) + if: ${{ contains(inputs.ccache-cache-name, 'linux-aarch64') }} + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: {gcc-10,g++-10}-aarch64-linux-gnu {pkg-config,libepoxy-dev}:arm64 cmake ninja-build extra-cmake-modules dpkg-dev ccache + version: 1.0-arm + + - name: Set Up CCache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ inputs.ccache-cache-name }} \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8e59141..d1ea623 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -75,15 +75,11 @@ jobs: - name: Check Out Source uses: actions/checkout@v3 - - name: Set Up CCache - uses: hendrikmuhs/ccache-action@v1.2 + - name: Install Dependencies + uses: ./.github/actions/deps with: - key: ${{ inputs.archive-name }}-${{ matrix.build-type }} - - - name: Install GCC Problem Matcher - uses: root-project/gcc-problem-matcher-improved@9d83f12b27a78210f0485fb188e08d94fa807a6d - with: - build-directory: build # ${{ env.BUILD_DIR }} has backslashes, which make the problem matcher choke + ccache-cache-name: ${{ inputs.archive-name }}-{{ matrix.build-type }} + runs-on: ${{ inputs.runs-on }} - name: Create build environment run: mkdir -vp "${{ env.BUILD_DIR }}" diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d4d1830..0be36c6 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -8,53 +8,8 @@ on: branches: - main jobs: - deps-windows: - name: Install Dependencies (Windows) - runs-on: windows-latest - steps: - - name: Install Dependencies - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: true - install: git pkgconf mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-ninja mingw-w64-x86_64-toolchain - - deps-macos: - name: Install Dependencies (macOS) - runs-on: macos-latest - steps: - - name: Install Dependencies - run: brew install pkg-config cmake ninja ccache - - deps-linux-x86_64: - name: Install Dependencies (Linux x86_64) - runs-on: ubuntu-latest - steps: - - name: Install Dependencies - run: | - sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/kubernetes.list - # Don't check for dependencies that we won't use - - sudo apt-get update - sudo apt-get install -y cmake ninja-build libepoxy-dev ccache - - deps-linux-aaarch64: - name: Install Dependencies (Linux aarch64) - runs-on: ubuntu-latest - steps: - - name: Install Dependencies - run: | - sudo apt-get update - sudo dpkg --add-architecture arm64 - sudo sh -c "sed \"s|^deb \([a-z\.:/]*\) \([a-z\-]*\) \(.*\)$|deb [arch=amd64] \1 \2 \3\ndeb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports \2 \3|\" /etc/apt/sources.list > /etc/apt/sources.list.new" - sudo rm -f /etc/apt/sources.list - sudo mv /etc/apt/sources.list{.new,} - sudo apt-get update - sudo apt-get install -y {gcc-10,g++-10}-aarch64-linux-gnu {pkg-config,libepoxy-dev}:arm64 cmake ninja-build extra-cmake-modules dpkg-dev ccache - windows: name: Windows (x86_64) - needs: [deps-windows] uses: ./.github/workflows/build.yaml with: archive-name: melondsds_libretro-win32-x86_64 @@ -65,7 +20,6 @@ jobs: macos: name: macOS (Universal) - needs: [deps-macos] uses: ./.github/workflows/build.yaml with: archive-name: melondsds_libretro-macos-universal @@ -74,7 +28,6 @@ jobs: linux-x86_64: name: Linux (x86_64) - needs: [deps-linux-x86_64] uses: ./.github/workflows/build.yaml with: archive-name: melondsds_libretro-linux-x86_64 @@ -83,7 +36,6 @@ jobs: linux-aarch64: name: Linux (aarch64) - needs: [deps-linux-aaarch64] uses: ./.github/workflows/build.yaml with: archive-name: melondsds_libretro-linux-aarch64 @@ -92,7 +44,6 @@ jobs: android: name: Android - needs: [deps-linux-x86_64] uses: ./.github/workflows/build.yaml with: lib-ext: so @@ -103,7 +54,6 @@ jobs: ios: name: iOS - needs: [deps-macos] uses: ./.github/workflows/build.yaml with: runs-on: macos-latest