diff --git a/.github/actions/set-up-vcpkg-binary-cache-action/action.yml b/.github/actions/set-up-vcpkg-binary-cache-action/action.yml new file mode 100644 index 00000000..5a03147f --- /dev/null +++ b/.github/actions/set-up-vcpkg-binary-cache-action/action.yml @@ -0,0 +1,41 @@ +name: Set up a vcpkg binary cache + +description: Bootstraps vcpkg and configures GitHub Packages as a binary cache. + +inputs: + github-token: + description: Token for authenticating with GitHub Packages + required: true + +runs: + using: composite + steps: + - name: Bootstrap vcpkg + shell: bash + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + ./dependencies/vcpkg/bootstrap-vcpkg.bat + else + bash ./dependencies/vcpkg/bootstrap-vcpkg.sh + fi + + - name: Setup NuGet Credentials for vcpkg + shell: bash + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + alias vcpkg_nuget=`./dependencies/vcpkg/vcpkg.exe fetch nuget | tail -n 1` + else + alias vcpkg_nuget="mono `./dependencies/vcpkg/vcpkg fetch nuget | tail -n 1`" + fi + + vcpkg_nuget \ + sources add \ + -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ + -storepasswordincleartext \ + -name "GitHub" \ + -username "${{ github.repository_owner }}" \ + -password "${{ inputs.github-token }}" + + vcpkg_nuget \ + setapikey "${{ inputs.github-token }}" \ + -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80d84948..820ff61c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,23 +46,10 @@ jobs: with: cmake-version: "3.29.0" - - name: "Bootstrap vcpkg" - run: | - bash ./dependencies/vcpkg/bootstrap-vcpkg.sh - - - name: "Setup NuGet Credentials for vcpkg" - shell: "bash" - run: | - mono `./dependencies/vcpkg/vcpkg fetch nuget | tail -n 1` \ - sources add \ - -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - -storepasswordincleartext \ - -name "GitHub" \ - -username "${{ github.repository_owner }}" \ - -password "${{ secrets.GITHUB_TOKEN }}" - mono `./dependencies/vcpkg/vcpkg fetch nuget | tail -n 1` \ - setapikey "${{ secrets.GITHUB_TOKEN }}" \ - -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + - name: Setup vcpkg binary cache + uses: ./.github/actions/set-up-vcpkg-binary-cache-action + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "cmake" run: | @@ -135,23 +122,10 @@ jobs: with: cmake-version: "3.29.0" - - name: "Bootstrap vcpkg" - run: | - ./dependencies/vcpkg/bootstrap-vcpkg.bat - - - name: "Setup NuGet Credentials for vcpkg" - shell: "bash" - run: | - `./dependencies/vcpkg/vcpkg.exe fetch nuget | tail -n 1` \ - sources add \ - -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - -storepasswordincleartext \ - -name "GitHub" \ - -username "${{ github.repository_owner }}" \ - -password "${{ secrets.GITHUB_TOKEN }}" - `./dependencies/vcpkg/vcpkg.exe fetch nuget | tail -n 1` \ - setapikey "${{ secrets.GITHUB_TOKEN }}" \ - -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + - name: Setup vcpkg binary cache + uses: ./.github/actions/set-up-vcpkg-binary-cache-action + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "cmake" run: | @@ -215,23 +189,10 @@ jobs: with: cmake-version: "3.29.0" - - name: "Bootstrap vcpkg" - run: | - bash ./dependencies/vcpkg/bootstrap-vcpkg.sh - - - name: "Setup NuGet Credentials for vcpkg" - shell: "bash" - run: | - mono `./dependencies/vcpkg/vcpkg fetch nuget | tail -n 1` \ - sources add \ - -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - -storepasswordincleartext \ - -name "GitHub" \ - -username "${{ github.repository_owner }}" \ - -password "${{ secrets.GITHUB_TOKEN }}" - mono `./dependencies/vcpkg/vcpkg fetch nuget | tail -n 1` \ - setapikey "${{ secrets.GITHUB_TOKEN }}" \ - -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + - name: Setup vcpkg binary cache + uses: ./.github/actions/set-up-vcpkg-binary-cache-action + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "cmake" run: | @@ -291,6 +252,11 @@ jobs: msgunfmt $mo_file -o $po_file || echo "Failed to uncompile message catalog from $mo_file" done + - name: Setup vcpkg binary cache + uses: ./.github/actions/set-up-vcpkg-binary-cache-action + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Build Cemu env: ANDROID_STORE_FILE_BASE64: ${{ secrets.ANDROID_STORE_FILE_BASE64 }}