[Fix Bug] Cannot install postgresml packages. #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Pkgs & Docker Image for the tgmc-master Branch | |
on: | |
push: | |
branches: | |
- tgmc-master | |
workflow_dispatch: | |
env: | |
PACKAGE_VERSION: "2.8.3" | |
jobs: | |
# | |
# PostgresML extension. | |
# | |
postgresml-pgml: | |
strategy: | |
fail-fast: false # Let the other job finish | |
matrix: | |
os: ["ubuntu-22.04"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Validate cargo is working | |
uses: postgresml/gh-actions-cargo@master | |
with: | |
working-directory: pgml-extension | |
command: version | |
- name: Cache artifacts | |
uses: actions/cache@v3 | |
with: | |
path: pgml-extension/target | |
key: buildjet-pgml-extension-artifacts-1-${{ runner.arch }} # Change this when dependencies change | |
- name: Cache pgrx | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: buildjet-pgml-extension-pgrx-2-${{ runner.arch }} # Change this when dependencies change | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
TZ: Etc/UTC | |
run: | | |
git submodule update --init --recursive | |
# PostgreSQL apt | |
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null | |
sudo sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
sudo apt-get install -y software-properties-common | |
sudo add-apt-repository ppa:apt-fast/stable --yes | |
sudo add-apt-repository ppa:deadsnakes/ppa --yes | |
sudo apt update | |
sudo apt-get install -y apt-fast | |
sudo apt-get update && sudo apt-fast install -y \ | |
libopenblas-dev \ | |
libssl-dev \ | |
bison \ | |
flex \ | |
pkg-config \ | |
cmake \ | |
libreadline-dev \ | |
libz-dev \ | |
curl \ | |
lsb-release \ | |
tzdata \ | |
sudo \ | |
cmake \ | |
libpq-dev \ | |
libclang-dev \ | |
wget \ | |
postgresql-15 \ | |
postgresql-server-dev-15 \ | |
lsb-release \ | |
python3.10 \ | |
python3-pip \ | |
libpython3.10-dev \ | |
python3.10-dev \ | |
ruby \ | |
lld | |
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem | |
sudo gem install deb-s3-0.11.4.gem | |
dpkg-deb --version | |
- name: Install pgrx | |
uses: postgresml/gh-actions-cargo@master | |
with: | |
working-directory: pgml-extension | |
command: install | |
args: cargo-pgrx --version "0.11.2" --locked | |
- name: pgrx init | |
uses: postgresml/gh-actions-cargo@master | |
with: | |
working-directory: pgml-extension | |
command: pgrx | |
args: init --pg15=/usr/lib/postgresql/15/bin/pg_config | |
- name: Build Postgres 15 | |
uses: postgresml/gh-actions-cargo@master | |
with: | |
working-directory: pgml-extension | |
command: pgrx | |
args: package --pg-config /usr/lib/postgresql/15/bin/pg_config | |
- name: Build debs | |
run: | | |
# Always build using latest scripts | |
git checkout tgmc-master | |
bash packages/postgresql-pgml/release.tgmc.sh ${PACKAGE_VERSION} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: postgresml-pgml | |
path: postgresql-pgml-15_${{env.PACKAGE_VERSION}}-ubuntu22.04-amd64.deb | |
# | |
# PostgresML meta package which installs | |
# all the necessary dependencies. | |
# | |
postgresml: | |
needs: postgresml-pgml | |
strategy: | |
fail-fast: false # Let the other job finish | |
matrix: | |
os: ["ubuntu-22.04"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build and release package | |
run: | | |
bash packages/postgresml/release.tgmc.sh ${PACKAGE_VERSION} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: postgresml | |
path: postgresml-15-${{env.PACKAGE_VERSION}}-ubuntu22.04-all.deb | |
# | |
# PostgresML dashboard. | |
# | |
postgresml-dashboard: | |
strategy: | |
fail-fast: false # Let the other job finish | |
matrix: | |
os: ["ubuntu-22.04"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Build and release package | |
run: | | |
cargo install cargo-pgml-components | |
bash packages/postgresml-dashboard/release.tgmc.sh ${PACKAGE_VERSION} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: postgresml-dashboard | |
path: postgresml-dashboard-${{env.PACKAGE_VERSION}}-ubuntu22.04-amd64.deb | |
# | |
# PostgresML Docker image. | |
# | |
publish-extension-docker-image: | |
needs: | |
- postgresml | |
- postgresml-dashboard | |
strategy: | |
fail-fast: false # Let the other job finish | |
matrix: | |
os: ["ubuntu-22.04"] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: docker | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get the commit hash | |
id: commit_hash | |
run: echo "::set-output name=hash::$(git rev-parse --short ${{ github.sha }})" | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download artifact 1 | |
uses: actions/download-artifact@v2 | |
with: | |
name: postgresml | |
path: docker | |
- name: Download artifact 2 | |
uses: actions/download-artifact@v2 | |
with: | |
name: postgresml-dashboard | |
path: docker | |
- name: Download artifact 3 | |
uses: actions/download-artifact@v2 | |
with: | |
name: postgresml-pgml | |
path: docker | |
# 创建 Release | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} from the tgmc-master branch | |
draft: false | |
prerelease: false | |
# 上传 artifacts 到 Release | |
- name: Upload Release Asset 1 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./docker/postgresql-pgml-15_${{env.PACKAGE_VERSION}}-ubuntu22.04-amd64.deb | |
asset_name: postgresql-pgml-15_${{env.PACKAGE_VERSION}}-ubuntu22.04-amd64.deb | |
asset_content_type: application/octet-stream | |
- name: Upload Release Asset 2 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./docker/postgresml-15-${{env.PACKAGE_VERSION}}-ubuntu22.04-all.deb | |
asset_name: postgresml-15-${{env.PACKAGE_VERSION}}-ubuntu22.04-all.deb | |
asset_content_type: application/octet-stream | |
- name: Upload Release Asset 3 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./docker/postgresml-dashboard-${{env.PACKAGE_VERSION}}-ubuntu22.04-amd64.deb | |
asset_name: postgresml-dashboard-${{env.PACKAGE_VERSION}}-ubuntu22.04-amd64.deb | |
asset_content_type: application/octet-stream | |
# - name: Build and push Docker image | |
# run: | | |
# ls -l | |
# docker buildx create --use --name mybuilder | |
# docker buildx build \ | |
# --platform linux/amd64 \ | |
# --tag ghcr.io/yjcyxky/postgresml:${PACKAGE_VERSION}-${{ steps.commit_hash.outputs.hash }} \ | |
# -f Dockerfile.tgmc \ | |
# --push . |