mirror of
https://github.com/ivabus/pantry
synced 2024-09-21 01:00:50 +03:00
abb0921f3d
* don’t need cli checkouts anymore * tidy Co-authored-by: Jacob Heider <jacob@tea.xyz>
179 lines
5.3 KiB
YAML
179 lines
5.3 KiB
YAML
name: build
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
projects:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
check-core-sizes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
gha-linux-build-size: ${{ env.GHA_LINUX_BUILD_SIZE }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
repository: teaxyz/pantry.core
|
|
- uses: teaxyz/setup@v0
|
|
- run: scripts/check-core-sizes.ts ${{ inputs.projects }}
|
|
env:
|
|
TEA_PANTRY_PATH: ${{ github.workspace }}
|
|
|
|
build:
|
|
runs-on: ${{ matrix.platform.os }}
|
|
needs: [check-core-sizes]
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- os: macos-11
|
|
name: darwin+x86-64
|
|
- os: ${{ needs.check-core-sizes.outputs.gha-linux-build-size }}
|
|
name: linux+x86-64
|
|
container:
|
|
image: debian:buster-slim
|
|
- os: [self-hosted, macOS, ARM64]
|
|
name: darwin+aarch64
|
|
- os: [self-hosted, linux, ARM64]
|
|
name: linux+aarch64
|
|
container: ${{ matrix.platform.container }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: teaxyz/setup@v0
|
|
id: tea
|
|
with:
|
|
prefix: /opt
|
|
|
|
- name: sanitize macOS runners
|
|
if: matrix.platform.os == 'macos-11'
|
|
run: sudo mv /usr/local/bin/* /tmp/
|
|
|
|
- name: configure tea env
|
|
run: |
|
|
echo "$PWD/scripts:$TEA_PREFIX/tea.xyz/var/pantry/scripts" >> $GITHUB_PATH
|
|
echo "TEA_PANTRY_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
|
|
|
|
- run: sort.ts ${{ inputs.projects }}
|
|
id: sorted
|
|
|
|
- run: build.ts ${{ steps.sorted.outputs.pkgs }}
|
|
id: build
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
FORCE_UNSAFE_CONFIGURE: 1 # some configure scripts refuse to run as root
|
|
|
|
- name: delete `.la` files
|
|
run: find . -name '*.la' -delete
|
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
|
|
|
# cache data we'll need in the bottling job
|
|
- name: assemble artifact metadata
|
|
run: |
|
|
echo ${{ steps.build.outputs.pkgs }} >built
|
|
echo ${{ steps.build.outputs.relative-paths }} >relative-paths
|
|
echo ${{ steps.build.outputs.srcs }} >srcs
|
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
|
|
|
# tarring ourselves ∵ GHA-artifacts (ludicrously) lose permissions
|
|
# /ref https://github.com/actions/upload-artifact/issues/38
|
|
- name: create artifacts.tgz
|
|
run:
|
|
tar czf $GITHUB_WORKSPACE/artifacts.tgz
|
|
${{ steps.build.outputs.relative-paths }}
|
|
${{ steps.build.outputs.srcs-relative-paths }}
|
|
built relative-paths srcs
|
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
|
|
|
- name: upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.platform.name }}
|
|
path: artifacts.tgz
|
|
if-no-files-found: error
|
|
|
|
test:
|
|
needs: [build]
|
|
runs-on: ${{ matrix.platform.os }}
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- os: macos-11
|
|
name: darwin+x86-64
|
|
- os: ubuntu-latest
|
|
name: linux+x86-64
|
|
- os: ubuntu-latest
|
|
name: linux+x86-64
|
|
container: ghcr.io/teaxyz/infuser:latest
|
|
- os: ubuntu-latest
|
|
name: linux+x86-64
|
|
container: debian:buster-slim
|
|
- os: [self-hosted, macOS, ARM64]
|
|
name: darwin+aarch64
|
|
- os: [self-hosted, linux, ARM64]
|
|
name: linux+aarch64
|
|
outputs:
|
|
HAS_SECRETS: ${{ env.HAS_SECRETS }}
|
|
container: ${{ matrix.platform.container }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: teaxyz/setup@v0
|
|
|
|
- name: configure scripts PATH
|
|
run: echo "$PWD/scripts:$TEA_PREFIX/tea.xyz/var/pantry/scripts" >> $GITHUB_PATH
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: ${{ matrix.platform.name }}
|
|
|
|
- name: extract bottles
|
|
run: tar xzf artifacts.tgz -C $TEA_PREFIX
|
|
|
|
- run: test.ts ${{ inputs.projects }}
|
|
env:
|
|
TEA_PANTRY_PATH: ${{ github.workspace }}
|
|
|
|
- name: post
|
|
run:
|
|
echo "HAS_SECRETS=$HAS_SECRETS" >>$GITHUB_ENV
|
|
env:
|
|
HAS_SECRETS: ${{ secrets.AWS_S3_CACHE != null }}
|
|
|
|
stage:
|
|
needs: [test]
|
|
# this only works for PRs from our team to our repo (security! :( )
|
|
if: startsWith(github.ref, 'refs/pull/') && startsWith(github.repository, 'teaxyz/pantry.') && needs.test.outputs.HAS_SECRETS == 'true'
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- os: macos-11
|
|
name: darwin+x86-64
|
|
- os: ubuntu-latest
|
|
name: linux+x86-64
|
|
- os: [self-hosted, macOS, ARM64]
|
|
name: darwin+aarch64
|
|
- os: [self-hosted, linux, ARM64]
|
|
name: linux+aarch64
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: teaxyz/setup@v0
|
|
|
|
- name: configure scripts PATH
|
|
run: echo "$PWD/scripts:$TEA_PREFIX/tea.xyz/var/pantry/scripts" >> $GITHUB_PATH
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: ${{ matrix.platform.name }}
|
|
|
|
- run: cache-artifacts.ts
|
|
${{github.repository}}
|
|
${{github.ref}}
|
|
${{matrix.platform.name}}
|
|
artifacts.tgz
|
|
env:
|
|
AWS_S3_CACHE: ${{ secrets.AWS_S3_CACHE }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|