build: use fromJSON to parse runner repo vars, don't add deps on self-hosted (#2564)

This commit is contained in:
briaguya 2023-03-01 19:41:04 -05:00 committed by GitHub
parent b13f6f4b70
commit 72777a0eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
build-macos: build-macos:
runs-on: ${{ vars.MAC_RUNNER || 'macos-12' }} runs-on: ${{ (vars.MAC_RUNNER && fromJSON(vars.MAC_RUNNER)) || 'macos-12' }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -17,12 +17,14 @@ jobs:
with: with:
key: ${{ runner.os }}-ccache key: ${{ runner.os }}-ccache
- name: Install gtar wrapper - name: Install gtar wrapper
if: ${{ !vars.MAC_RUNNER }}
run: | run: |
sudo mv /usr/local/bin/gtar /usr/local/bin/gtar.orig sudo mv /usr/local/bin/gtar /usr/local/bin/gtar.orig
sudo cp .github/workflows//gtar /usr/local/bin/gtar sudo cp .github/workflows//gtar /usr/local/bin/gtar
sudo chmod +x /usr/local/bin/gtar sudo chmod +x /usr/local/bin/gtar
- name: Cache MacPorts - name: Cache MacPorts
id: cache-macports id: cache-macports
if: ${{ !vars.MAC_RUNNER }}
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: /opt/local/ path: /opt/local/
@ -30,6 +32,7 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-macports- ${{ runner.os }}-macports-
- name: Install MacPorts (if necessary) - name: Install MacPorts (if necessary)
if: ${{ !vars.MAC_RUNNER }}
run: | run: |
if [ -d /opt/local/ ]; then if [ -d /opt/local/ ]; then
echo "MacPorts already installed" echo "MacPorts already installed"
@ -39,6 +42,7 @@ jobs:
fi fi
echo "/opt/local/bin:/opt/local/sbin" >> $GITHUB_PATH echo "/opt/local/bin:/opt/local/sbin" >> $GITHUB_PATH
- name: Install dependencies - name: Install dependencies
if: ${{ !vars.MAC_RUNNER }}
run: | run: |
brew uninstall --ignore-dependencies libpng brew uninstall --ignore-dependencies libpng
sudo port install $(cat .github/workflows/macports-deps.txt) sudo port install $(cat .github/workflows/macports-deps.txt)
@ -70,7 +74,7 @@ jobs:
- os: ubuntu-22.04 - os: ubuntu-22.04
gcc: 12 gcc: 12
archive-suffix: performance archive-suffix: performance
runs-on: ${{ (matrix.os == 'ubuntu-20.04' && (vars.LINUX_COMPATIBILITY_RUNNER || matrix.os)) || (matrix.os == 'ubuntu-22.04' && (vars.LINUX_PERFORMANCE_RUNNER || matrix.os)) }} runs-on: ${{ (matrix.os == 'ubuntu-20.04' && ((vars.LINUX_COMPATIBILITY_RUNNER && fromJSON(vars.LINUX_COMPATIBILITY_RUNNER)) || matrix.os)) || (matrix.os == 'ubuntu-22.04' && ((vars.LINUX_PERFORMANCE_RUNNER && fromJSON(vars.LINUX_PERFORMANCE_RUNNER)) || matrix.os)) }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -124,7 +128,7 @@ jobs:
soh.appimage soh.appimage
readme.txt readme.txt
build-switch: build-switch:
runs-on: ${{ vars.LINUX_RUNNER || 'ubuntu-latest' }} runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }}
container: container:
image: devkitpro/devkita64:latest image: devkitpro/devkita64:latest
steps: steps:
@ -154,7 +158,7 @@ jobs:
soh.nro soh.nro
readme.txt readme.txt
build-wiiu: build-wiiu:
runs-on: ${{ vars.LINUX_RUNNER || 'ubuntu-latest' }} runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }}
container: container:
image: devkitpro/devkitppc:latest image: devkitpro/devkitppc:latest
steps: steps:
@ -189,7 +193,7 @@ jobs:
soh.wuhb soh.wuhb
readme.txt readme.txt
build-windows: build-windows:
runs-on: ${{ vars.WINDOWS_RUNNER || 'windows-latest' }} runs-on: ${{ (vars.WINDOWS_RUNNER && fromJSON(vars.WINDOWS_RUNNER)) || 'windows-latest' }}
steps: steps:
- name: Install dependencies - name: Install dependencies
run: | run: |