pantry/.github/workflows/build.yml

207 lines
6 KiB
YAML
Raw Normal View History

name: build
on:
workflow_call:
inputs:
projects:
required: true
type: string
jobs:
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 }}"
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-11
2022-08-10 21:58:22 +03:00
container: ~
- os: ubuntu-latest
2022-09-03 01:41:05 +03:00
container:
image: ghcr.io/teaxyz/infuser:main
options: --memory=16g
container: ${{ matrix.container }}
defaults:
run:
working-directory: pantry
2022-09-08 23:40:35 +03:00
outputs:
pkgs: ${{ steps.sorted.outputs.pkgs }} ${{ steps.sorted.outputs.pre-install }}
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 }}
- name: HACKS
run: |
case ${{ matrix.os }} in
ubuntu-latest)
rm -rf /opt/tea.xyz/var/pantry
ln -s $GITHUB_WORKSPACE/pantry /opt/tea.xyz/var/pantry
2022-09-20 15:07:09 +03:00
# no git in our image, needed for tea finding SRCROOT
mkdir .git ../cli/.git
2022-08-19 23:08:56 +03:00
#FIXME needed for gdk-pixbuf
apt --yes install shared-mime-info
#FIXME needed for teaxyz/setup
apt --yes install curl
;;
macos-11)
# 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
sudo mkdir -p /opt/tea.xyz/var
sudo chown -R $(whoami):staff /opt
ln -s $GITHUB_WORKSPACE/pantry /opt/tea.xyz/var/pantry
# HACKs for teaxyz/setup since it currently requires the working dir to be a srcroot
cp README.md ..
mkdir ../.git
# for scripts/fix-machos.rb
sudo gem install ruby-macho
;;
*)
exit 1
esac
- uses: teaxyz/setup@v0
env:
TEA_SECRET: ${{ secrets.TEA_SECRET }}
VERBOSE: 1
2022-09-08 23:40:35 +03:00
with:
prefix: /opt
2022-09-02 17:51:31 +03:00
- name: sort topologically
run: scripts/sort.ts ${{ inputs.projects }}
id: sorted
2022-09-20 02:19:31 +03:00
- run: |
2022-09-23 16:44:25 +03:00
../cli/scripts/install.ts ${{ steps.sorted.outputs.pre-install }}
2022-09-01 20:49:14 +03:00
2022-09-08 23:40:35 +03:00
- run: scripts/build.ts ${{ steps.sorted.outputs.pkgs }}
id: build
env:
2022-09-23 16:44:25 +03:00
# TODO: GITHUB_TOKEN doesn't have private access to teaxyz/cli. This can be restored once that repo is public.
# GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
FORCE_UNSAFE_CONFIGURE: 1 # some configure scripts refuse to run as root
2022-09-02 17:51:31 +03:00
- name: test
run: echo ${{ steps.build.outputs.pkgs }} | xargs -tn1 scripts/test.ts
2022-09-02 17:51:31 +03:00
- name: bottle
run: scripts/bottle.ts ${{ steps.build.outputs.pkgs }}
id: bottle
# TODO only upload if all jobs succeed
# TODO only upload when we merge
# TODO upload to a staging location until we release new pantry versions
2022-09-02 17:51:31 +03:00
- name: upload bottles
run: scripts/upload.ts
--pkgs ${{ steps.build.outputs.pkgs }}
--bottles ${{ steps.bottle.outputs.bottles }}
--checksums ${{ steps.bottle.outputs.checksums }}
env:
2022-09-13 16:18:47 +03:00
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-10 11:09:40 +03:00
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: ${{ steps.bottle.outputs.artifacts }}
2022-09-10 11:09:40 +03:00
if-no-files-found: error
invalidate-cloudfront:
needs: [build]
runs-on: ubuntu-latest
steps:
#FIXME incredibly inefficient - have upload.ts tell us what to invalidate
- uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
PATHS: "/*"
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-08 23:40:35 +03:00
verify-relocatable:
needs: [invalidate-cloudfront, build]
2022-09-08 23:40:35 +03:00
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: pantry
strategy:
matrix:
os:
- macos-11
- ubuntu-latest
steps:
- 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 }}
- name: HACKS
run: |
mkdir -p ~/opt/tea.xyz/var
ln -s $GITHUB_WORKSPACE/pantry ~/opt/tea.xyz/var/pantry
mkdir ../.git
cp README.md ..
- uses: teaxyz/setup@v0
id: tea
env:
TEA_SECRET: ${{ secrets.TEA_SECRET }}
- name: download bottles
uses: actions/download-artifact@v3
with:
name: ${{ matrix.os }}
path: ${{ steps.tea.outputs.prefix }}
- run: scripts/deps.ts -i ${{ needs.build.outputs.pkgs }}
id: deps
2022-09-23 16:44:25 +03:00
- run: ../cli/scripts/install.ts ${{ steps.deps.outputs.pkgs }}
2022-09-08 23:40:35 +03:00
- run:
echo ${{ inputs.projects }} | xargs -tn1
scripts/test.ts
2022-08-30 02:13:00 +03:00
notify:
if: always()
2022-09-08 23:40:35 +03:00
needs: [verify-relocatable]
2022-08-30 02:13:00 +03:00
runs-on: ubuntu-latest
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
2022-09-20 02:19:31 +03:00
SLACK_MESSAGE: build job for ${{ inputs.projects }} ${{ needs.verify-relocatable.result }}
SLACK_COLOR: $ {{ needs.verify-relocatable.result }}