allow for platform whitelist in yaml

This commit is contained in:
Jacob Heider 2023-04-21 17:19:52 -04:00 committed by Jacob Heider
parent 10969174eb
commit a0081c4023
4 changed files with 20 additions and 15 deletions

View file

@ -10,6 +10,9 @@ on:
platform:
required: true
type: string
projects:
required: false
type: string
outputs:
pr:
description: 'The PR number'
@ -21,14 +24,17 @@ jobs:
outputs:
os: ${{ steps.platform.outputs.os }}
cache-set: ${{ steps.platform.outputs.cache-set }}
available: ${{ steps.platform.outputs.available }}
steps:
- uses: teaxyz/brewkit/actions/get-platform@v0
id: platform
with:
platform: ${{ inputs.platform }}
projects: ${{ inputs.projects }}
bottle:
needs: [get-platform]
if: ${{ needs.get-platform.outputs.available == 'true' }}
runs-on: ${{ fromJson(needs.get-platform.outputs.os) }}
outputs:
srcs: ${{ env.srcs }}
@ -118,7 +124,8 @@ jobs:
if-no-files-found: error
upload:
needs: [bottle]
needs: [get-platform, bottle]
if: ${{ needs.get-platform.outputs.available == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: teaxyz/brewkit/actions/setup-brewkit@v0

View file

@ -19,16 +19,19 @@ jobs:
container: ${{ steps.platform.outputs.container }}
test-matrix: ${{ steps.platform.outputs.test-matrix }}
cache-set: ${{ steps.platform.outputs.cache-set }}
available: ${{ steps.platform.outputs.available }}
steps:
- uses: teaxyz/brewkit/actions/get-platform@v0
id: platform
with:
platform: ${{ inputs.platform }}
projects: ${{ inputs.projects }}
build:
runs-on: ${{ fromJson(needs.get-platform.outputs.build-os) }}
container: ${{ fromJson(needs.get-platform.outputs.container) }}
needs: [get-platform]
if: ${{ needs.get-platform.outputs.available == 'true' }}
steps:
- uses: actions/checkout@v3
@ -90,6 +93,7 @@ jobs:
test:
needs: [get-platform, build]
if: ${{ needs.get-platform.outputs.available == 'true' }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
@ -139,9 +143,9 @@ jobs:
HAS_SECRETS: ${{ secrets.AWS_S3_CACHE != null }}
stage:
needs: [test]
needs: [get-platform, test]
# this only works for PRs from our team to our repo (security! :( )
if: startsWith(github.ref, 'refs/pull/') && github.repository_owner == 'teaxyz' && needs.test.outputs.HAS_SECRETS == 'true'
if: startsWith(github.ref, 'refs/pull/') && github.repository_owner == 'teaxyz' && needs.test.outputs.HAS_SECRETS == 'true' && needs.get-platform.outputs.available == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3

View file

@ -39,6 +39,7 @@ jobs:
with:
new-version: true
platform: ${{ matrix.platform }}
projects: ${{ inputs.projects }}
secrets: inherit
complain:

View file

@ -3,7 +3,9 @@ distributable:
strip-components: 1
versions:
github: freedesktop/libbsd/tags
github: guillemj/libbsd/tags
platform: linux
build:
dependencies:
@ -11,20 +13,11 @@ build:
tea.xyz/gx/make: '*'
hadrons.org/libmd: '*'
script: |
if test "{{hw.platform}}" != "linux"; then
echo "libbsd is only supported on Linux"
mkdir -p "{{prefix}}"
touch {{prefix}}/linux-only
exit 0
fi
./configure --prefix={{prefix}}
make --jobs {{hw.concurrency}} install
test:
dependencies:
gnu.org/binutils: '*'
script: |
if test "{{hw.platform}}" = "linux"; then
script:
nm {{prefix}}/lib/libbsd.so.{{version.major}} | grep strtonum
fi