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

View file

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

View file

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

View file

@ -3,7 +3,9 @@ distributable:
strip-components: 1 strip-components: 1
versions: versions:
github: freedesktop/libbsd/tags github: guillemj/libbsd/tags
platform: linux
build: build:
dependencies: dependencies:
@ -11,20 +13,11 @@ build:
tea.xyz/gx/make: '*' tea.xyz/gx/make: '*'
hadrons.org/libmd: '*' hadrons.org/libmd: '*'
script: | 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}} ./configure --prefix={{prefix}}
make --jobs {{hw.concurrency}} install make --jobs {{hw.concurrency}} install
test: test:
dependencies: dependencies:
gnu.org/binutils: '*' gnu.org/binutils: '*'
script: | script:
if test "{{hw.platform}}" = "linux"; then nm {{prefix}}/lib/libbsd.so.{{version.major}} | grep strtonum
nm {{prefix}}/lib/libbsd.so.{{version.major}} | grep strtonum
fi