2022-08-09 02:50:24 +03:00
|
|
|
|
name: build
|
|
|
|
|
on:
|
|
|
|
|
workflow_call:
|
|
|
|
|
inputs:
|
|
|
|
|
projects:
|
|
|
|
|
required: true
|
|
|
|
|
type: string
|
|
|
|
|
|
2022-09-29 02:19:56 +03:00
|
|
|
|
env:
|
|
|
|
|
TEA_SECRET: ${{ secrets.TEA_SECRET }}
|
|
|
|
|
|
2022-08-09 02:50:24 +03:00
|
|
|
|
jobs:
|
2022-09-09 00:15:54 +03:00
|
|
|
|
queue-builder:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- name: queue
|
|
|
|
|
run: |
|
|
|
|
|
curl https://app.tea.xyz/api/builder/enqueue \
|
|
|
|
|
-H "authorization: bearer ${{ secrets.TEA_API_TOKEN }}" \
|
2022-09-16 02:40:30 +03:00
|
|
|
|
-d "$GITHUB_SHA ${{ inputs.projects }}"
|
2022-09-29 02:19:56 +03:00
|
|
|
|
|
2022-08-09 02:50:24 +03:00
|
|
|
|
build:
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
strategy:
|
|
|
|
|
matrix:
|
|
|
|
|
include:
|
|
|
|
|
- os: macos-11
|
2022-08-10 21:58:22 +03:00
|
|
|
|
container: ~
|
2022-08-09 02:50:24 +03:00
|
|
|
|
- os: ubuntu-latest
|
2022-09-03 01:41:05 +03:00
|
|
|
|
container:
|
2022-09-29 21:14:58 +03:00
|
|
|
|
image: debian:buster-slim
|
2022-09-03 01:41:05 +03:00
|
|
|
|
options: --memory=16g
|
2022-08-09 02:50:24 +03:00
|
|
|
|
container: ${{ matrix.container }}
|
2022-09-08 23:40:35 +03:00
|
|
|
|
outputs:
|
2022-09-27 22:11:35 +03:00
|
|
|
|
built: ${{ steps.build.outputs.pkgs }}
|
2022-09-08 23:40:35 +03:00
|
|
|
|
pkgs: ${{ steps.sorted.outputs.pkgs }} ${{ steps.sorted.outputs.pre-install }}
|
2022-08-09 02:50:24 +03:00
|
|
|
|
steps:
|
|
|
|
|
- name: co pantry
|
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
with:
|
|
|
|
|
path: pantry
|
|
|
|
|
|
|
|
|
|
- name: co cli
|
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
with:
|
|
|
|
|
path: cli
|
|
|
|
|
repository: teaxyz/cli
|
|
|
|
|
token: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
|
|
|
|
|
|
2022-09-29 02:19:56 +03:00
|
|
|
|
- uses: teaxyz/setup@v0
|
|
|
|
|
id: tea
|
|
|
|
|
with:
|
2022-09-29 19:07:07 +03:00
|
|
|
|
srcroot: pantry
|
2022-09-29 02:19:56 +03:00
|
|
|
|
prefix: /opt
|
|
|
|
|
|
2022-08-09 02:50:24 +03:00
|
|
|
|
- name: HACKS
|
|
|
|
|
run: |
|
|
|
|
|
case ${{ matrix.os }} in
|
|
|
|
|
ubuntu-latest)
|
2022-09-29 21:14:58 +03:00
|
|
|
|
apt update
|
2022-08-19 23:48:18 +03:00
|
|
|
|
#FIXME needed for gdk-pixbuf
|
2022-09-28 18:14:46 +03:00
|
|
|
|
apt --yes install shared-mime-info
|
2022-09-29 21:14:58 +03:00
|
|
|
|
apt --yes install libc-dev libstdc++-8-dev libgcc-8-dev bzip2 xz-utils patchelf file
|
2022-08-09 02:50:24 +03:00
|
|
|
|
;;
|
|
|
|
|
macos-11)
|
2022-08-19 20:31:09 +03:00
|
|
|
|
# screws up a lot of build scripts
|
|
|
|
|
# TODO stop using GHA images or chroot or something
|
2022-09-02 00:42:09 +03:00
|
|
|
|
for x in /usr/local/*; do sudo mv $x /tmp; done
|
2022-08-19 20:31:09 +03:00
|
|
|
|
|
2022-09-15 18:26:10 +03:00
|
|
|
|
# for scripts/fix-machos.rb
|
|
|
|
|
sudo gem install ruby-macho
|
2022-08-09 02:50:24 +03:00
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
exit 1
|
|
|
|
|
esac
|
|
|
|
|
|
2022-09-29 02:19:56 +03:00
|
|
|
|
rm -rf /opt/tea.xyz/var
|
|
|
|
|
ln -s $GITHUB_WORKSPACE /opt/tea.xyz/var
|
2022-08-09 02:50:24 +03:00
|
|
|
|
|
2022-09-29 19:07:07 +03:00
|
|
|
|
- run: pantry/scripts/sort.ts ${{ inputs.projects }}
|
2022-08-09 02:50:24 +03:00
|
|
|
|
id: sorted
|
|
|
|
|
|
2022-09-29 19:07:07 +03:00
|
|
|
|
- run: cli/scripts/install.ts ${{ steps.sorted.outputs.pre-install }}
|
2022-09-01 20:49:14 +03:00
|
|
|
|
|
2022-09-29 21:14:58 +03:00
|
|
|
|
#FIXME remove later
|
|
|
|
|
- run: find /opt -name bin -type d -exec find {} -type f \; | xargs chmod 777
|
|
|
|
|
|
2022-09-29 19:07:07 +03:00
|
|
|
|
- run: pantry/scripts/build.ts ${{ steps.sorted.outputs.pkgs }}
|
2022-08-09 02:50:24 +03:00
|
|
|
|
id: build
|
|
|
|
|
env:
|
2022-09-28 18:14:46 +03:00
|
|
|
|
# GITHUB_TOKEN doesn't have private access to teaxyz/cli.
|
|
|
|
|
# TODO restore to ${{ github.token }} when public
|
2022-09-23 16:44:25 +03:00
|
|
|
|
GITHUB_TOKEN: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
|
2022-08-09 02:50:24 +03:00
|
|
|
|
FORCE_UNSAFE_CONFIGURE: 1 # some configure scripts refuse to run as root
|
|
|
|
|
|
2022-09-29 19:07:07 +03:00
|
|
|
|
# tarring ourselves ∵ GHA-artifacts (ludicrously) lose permissions
|
|
|
|
|
# /ref https://github.com/actions/upload-artifact/issues/38
|
|
|
|
|
- run: tar czf $GITHUB_WORKSPACE/artifacts.tgz ${{ steps.build.outputs.relative-paths }}
|
|
|
|
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
|
|
|
|
|
2022-09-10 11:09:40 +03:00
|
|
|
|
- name: upload artifacts
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: ${{ matrix.os }}
|
2022-09-29 19:07:07 +03:00
|
|
|
|
path: artifacts.tgz
|
2022-09-10 11:09:40 +03:00
|
|
|
|
if-no-files-found: error
|
|
|
|
|
|
2022-09-28 18:14:46 +03:00
|
|
|
|
test:
|
2022-09-10 11:09:40 +03:00
|
|
|
|
needs: [build]
|
2022-09-08 23:40:35 +03:00
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
defaults:
|
|
|
|
|
run:
|
2022-09-29 19:07:07 +03:00
|
|
|
|
working-directory: tea.xyz/var/pantry/scripts
|
2022-09-08 23:40:35 +03:00
|
|
|
|
strategy:
|
|
|
|
|
matrix:
|
2022-09-29 19:07:07 +03:00
|
|
|
|
include:
|
|
|
|
|
- os: macos-11
|
|
|
|
|
- os: ubuntu-latest
|
|
|
|
|
- os: ubuntu-latest
|
|
|
|
|
container: ghcr.io/teaxyz/infuser:main
|
|
|
|
|
- os: ubuntu-latest
|
|
|
|
|
container: debian:buster-slim
|
|
|
|
|
container: ${{ matrix.container }}
|
2022-09-08 23:40:35 +03:00
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
with:
|
2022-09-29 02:19:56 +03:00
|
|
|
|
path: tea.xyz/var/pantry
|
2022-09-08 23:40:35 +03:00
|
|
|
|
|
2022-09-29 02:19:56 +03:00
|
|
|
|
- uses: actions/checkout@v3
|
2022-09-08 23:40:35 +03:00
|
|
|
|
with:
|
2022-09-29 02:19:56 +03:00
|
|
|
|
path: tea.xyz/var/cli
|
2022-09-08 23:40:35 +03:00
|
|
|
|
repository: teaxyz/cli
|
|
|
|
|
token: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
|
|
|
|
|
|
|
|
|
|
- uses: teaxyz/setup@v0
|
|
|
|
|
id: tea
|
2022-09-29 02:19:56 +03:00
|
|
|
|
with:
|
|
|
|
|
prefix: ${{ github.workspace }}
|
2022-09-29 19:07:07 +03:00
|
|
|
|
srcroot: tea.xyz/var/pantry
|
2022-09-08 23:40:35 +03:00
|
|
|
|
|
2022-09-28 18:14:46 +03:00
|
|
|
|
- uses: actions/download-artifact@v3
|
2022-09-08 23:40:35 +03:00
|
|
|
|
with:
|
|
|
|
|
name: ${{ matrix.os }}
|
|
|
|
|
|
2022-09-29 19:07:07 +03:00
|
|
|
|
- run: tar xzf artifacts.tgz
|
|
|
|
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
|
|
|
|
|
|
|
|
|
- run: ./test.ts ${{ inputs.projects }}
|
2022-09-08 23:40:35 +03:00
|
|
|
|
|
2022-09-28 18:14:46 +03:00
|
|
|
|
bottle:
|
2022-09-27 22:11:35 +03:00
|
|
|
|
defaults:
|
|
|
|
|
run:
|
2022-09-29 19:07:07 +03:00
|
|
|
|
working-directory: tea.xyz/var/pantry/scripts
|
2022-09-28 18:14:46 +03:00
|
|
|
|
needs: [test, build]
|
|
|
|
|
runs-on: ${{ matrix.platform }}
|
2022-09-26 17:56:15 +03:00
|
|
|
|
strategy:
|
|
|
|
|
matrix:
|
|
|
|
|
platform:
|
|
|
|
|
- macos-11
|
|
|
|
|
- ubuntu-latest
|
2022-09-28 18:14:46 +03:00
|
|
|
|
compression:
|
|
|
|
|
- xz
|
|
|
|
|
- gz
|
2022-09-26 17:56:15 +03:00
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
with:
|
2022-09-29 02:19:56 +03:00
|
|
|
|
path: tea.xyz/var/pantry
|
2022-09-26 17:56:15 +03:00
|
|
|
|
|
2022-09-29 02:19:56 +03:00
|
|
|
|
- uses: actions/checkout@v3
|
2022-09-26 17:56:15 +03:00
|
|
|
|
with:
|
2022-09-29 02:19:56 +03:00
|
|
|
|
path: tea.xyz/var/cli
|
2022-09-26 17:56:15 +03:00
|
|
|
|
repository: teaxyz/cli
|
|
|
|
|
token: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
|
|
|
|
|
|
|
|
|
|
- uses: teaxyz/setup@v0
|
|
|
|
|
id: tea
|
2022-09-29 02:19:56 +03:00
|
|
|
|
with:
|
|
|
|
|
prefix: ${{ github.workspace }}
|
2022-09-29 19:07:07 +03:00
|
|
|
|
srcroot: tea.xyz/var/pantry
|
2022-09-26 17:56:15 +03:00
|
|
|
|
|
2022-09-28 18:14:46 +03:00
|
|
|
|
- uses: actions/download-artifact@v3
|
2022-09-26 17:56:15 +03:00
|
|
|
|
with:
|
|
|
|
|
name: ${{ matrix.platform }}
|
|
|
|
|
path: ${{ steps.tea.outputs.prefix }}
|
|
|
|
|
|
2022-09-29 19:07:07 +03:00
|
|
|
|
- run: tar xzf artifacts.tgz
|
|
|
|
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
|
|
|
|
|
|
|
|
|
- run: ./bottle.ts ${{ needs.build.outputs.built }}
|
2022-09-26 17:56:15 +03:00
|
|
|
|
id: bottle
|
|
|
|
|
env:
|
2022-09-28 18:14:46 +03:00
|
|
|
|
COMPRESSION: ${{ matrix.compression }}
|
|
|
|
|
|
2022-09-26 17:56:15 +03:00
|
|
|
|
- name: upload bottles
|
2022-09-28 18:14:46 +03:00
|
|
|
|
id: upload
|
2022-09-29 19:07:07 +03:00
|
|
|
|
run: ./upload.ts
|
2022-09-27 22:11:35 +03:00
|
|
|
|
--pkgs ${{ needs.build.outputs.built }}
|
2022-09-26 17:56:15 +03:00
|
|
|
|
--bottles ${{ steps.bottle.outputs.bottles }}
|
|
|
|
|
--checksums ${{ steps.bottle.outputs.checksums }}
|
|
|
|
|
env:
|
|
|
|
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
|
|
2022-09-28 18:14:46 +03:00
|
|
|
|
#NOTE ideally we’d invalidate all at once so this is atomic
|
|
|
|
|
# however GHA can’t consolidate outputs from a matrix :/
|
|
|
|
|
- uses: chetan/invalidate-cloudfront-action@v2
|
|
|
|
|
env:
|
|
|
|
|
PATHS: ${{ steps.upload.outputs.cf-invalidation-paths }}
|
|
|
|
|
DISTRIBUTION: ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
|
|
|
|
|
AWS_REGION: us-east-1
|
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
2022-09-26 17:56:15 +03:00
|
|
|
|
|
2022-08-30 02:13:00 +03:00
|
|
|
|
notify:
|
2022-08-31 01:02:33 +03:00
|
|
|
|
if: always()
|
2022-09-28 18:14:46 +03:00
|
|
|
|
needs: [bottle]
|
2022-08-30 02:13:00 +03:00
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
2022-09-29 01:59:30 +03:00
|
|
|
|
- uses: martialonline/workflow-status@v3
|
|
|
|
|
id: status
|
2022-08-30 02:13:00 +03:00
|
|
|
|
- uses: rtCamp/action-slack-notify@v2
|
2022-08-26 23:24:38 +03:00
|
|
|
|
env:
|
|
|
|
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
|
|
|
|
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
|
2022-09-29 01:59:30 +03:00
|
|
|
|
SLACK_MESSAGE: build job for ${{ inputs.projects }} ${{ steps.status.outputs.status }}
|
|
|
|
|
SLACK_COLOR: ${{ steps.status.outputs.status }}
|