add plprofiler (#208) #126
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: Build and publish extensions | |
on: | |
push: | |
branches: | |
- "main" | |
paths: | |
- "contrib/**" | |
pull_request: | |
branches: | |
- "main" | |
paths: | |
- "contrib/**" | |
jobs: | |
find_directories: | |
name: Find changed extensions | |
runs-on: ubuntu-20.04 | |
outputs: | |
directories: ${{ steps.find_directories.outputs.build_matrix }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Find commit to compare with | |
id: versions | |
run: | | |
set -xe | |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | |
# On main branch, the diff should compare to the previous commit hash. | |
# On PR, the diff should compare with main branch. | |
if [ "${BRANCH_NAME}" == "main" ]; then | |
changed_relative_to_ref=$(git show --quiet HEAD^1 | grep commit | cut -d" " -f2) | |
else | |
changed_relative_to_ref="origin/${{ github.base_ref || 'not-a-branch' }}" | |
fi | |
echo "changed_relative_to_ref=${changed_relative_to_ref}" >> $GITHUB_OUTPUT | |
- name: Check out the coredb repo to reuse some actions | |
uses: actions/checkout@v3 | |
with: | |
repository: tembo-io/tembo | |
path: ./.tembo | |
ref: 21a43bbd64936b6b7fe7b080c2bfbd82df31fe2c | |
- name: Find directories with Dockerfiles that changed | |
id: find_directories | |
uses: ./.tembo/.github/actions/find-changed-directories | |
with: | |
contains_the_file: Trunk.toml | |
changed_relative_to_ref: ${{ steps.versions.outputs.changed_relative_to_ref }} | |
ignore_dirs: ".tembo cli" | |
build: | |
name: Build extensions | |
runs-on: | |
- self-hosted | |
- dind | |
- large-8x8 | |
needs: | |
- find_directories | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.find_directories.outputs.directories) }} | |
env: | |
TRUNK_API_TOKEN: ${{ secrets.TRUNK_AUTH_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install system dependencies | |
run: | | |
set -xe | |
sudo apt-get update | |
sudo apt-get install -y pkg-config libssl-dev | |
- name: Install minimal, stable rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "${{ matrix.name }}-extensions" | |
- name: Install Trunk | |
run: | | |
set -xe | |
cargo install --path ./cli | |
trunk --version | |
- name: Build the extension | |
run: cd ${{ matrix.path }} && trunk build | |
- name: Publish the extension | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: cd ${{ matrix.path }} && trunk publish |