Skip to content

Commit

Permalink
Test github docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasMarvin committed Feb 26, 2024
1 parent fe17312 commit 3382211
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 86 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build-javascript-sdk.yml
@@ -0,0 +1,8 @@
# action.yml
name: 'Build JavaScript SDK'
description: 'Builds the JavaScript SDK in a Docker Container'
runs:
using: 'docker'
image: './pgml-sdks/pgml/javascript/Dockerfile'
args:
- cd ./pgml-sdks/pgml/javascript && npm i && npm run build-release
163 changes: 83 additions & 80 deletions .github/workflows/javascript-sdk.yml
Expand Up @@ -2,94 +2,97 @@ name: deploy javascript sdk
on:
workflow_dispatch:
jobs:
build-javascript-sdk-macos-windows:
strategy:
matrix:
os:
[
"macos-latest",
"windows-latest",
]
include:
- neon-out-name: "x86_64-unknown-linux-gnu-index.node"
os: "ubuntu-22.04"
- neon-out-name: "aarch64-unknown-linux-gnu-index.node"
os: "buildjet-4vcpu-ubuntu-2204-arm"
- neon-out-name: "x86_64-apple-darwin-index.node"
os: "macos-latest"
- neon-out-name: "x86_64-pc-windows-gnu-index.node"
os: "windows-latest"
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: pgml-sdks/pgml/javascript
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:
command: version
- name: Do build
env:
TYPESCRIPT_DECLARATION_FILE: "javascript/index.d.ts"
run: |
npm i
npm run build-release
- name: Upload built .node file
uses: actions/upload-artifact@v3
with:
name: node-artifacts
path: pgml-sdks/pgml/javascript/dist/${{ matrix.neon-out-name }}
retention-days: 1
# build-javascript-sdk-macos-windows:
# strategy:
# matrix:
# os:
# [
# "macos-latest",
# "windows-latest",
# ]
# include:
# - neon-out-name: "x86_64-unknown-linux-gnu-index.node"
# os: "ubuntu-22.04"
# - neon-out-name: "aarch64-unknown-linux-gnu-index.node"
# os: "buildjet-4vcpu-ubuntu-2204-arm"
# - neon-out-name: "x86_64-apple-darwin-index.node"
# os: "macos-latest"
# - neon-out-name: "x86_64-pc-windows-gnu-index.node"
# os: "windows-latest"
# runs-on: ${{ matrix.os }}
# defaults:
# run:
# working-directory: pgml-sdks/pgml/javascript
# 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:
# command: version
# - name: Do build
# env:
# TYPESCRIPT_DECLARATION_FILE: "javascript/index.d.ts"
# run: |
# npm i
# npm run build-release
# - name: Upload built .node file
# uses: actions/upload-artifact@v3
# with:
# name: node-artifacts
# path: pgml-sdks/pgml/javascript/dist/${{ matrix.neon-out-name }}
# retention-days: 1
build-javascript-sdk-linux:
strategy:
matrix:
os:
[
"ubuntu-22.04",
"buildjet-4vcpu-ubuntu-2204-arm",
]
include:
- neon-out-name: "x86_64-unknown-linux-gnu-index.node"
os: "ubuntu-22.04"
- neon-out-name: "aarch64-unknown-linux-gnu-index.node"
os: "buildjet-4vcpu-ubuntu-2204-arm"
# strategy:
# matrix:
# os:
# [
# "ubuntu-22.04",
# "buildjet-4vcpu-ubuntu-2204-arm",
# ]
# include:
# - neon-out-name: "x86_64-unknown-linux-gnu-index.node"
# os: "ubuntu-22.04"
# - neon-out-name: "aarch64-unknown-linux-gnu-index.node"
# os: "buildjet-4vcpu-ubuntu-2204-arm"
runs-on: ubuntu-latest
container: ubuntu:16.04
defaults:
run:
working-directory: pgml-sdks/pgml/javascript
# container: ubuntu:16.04
# defaults:
# run:
# working-directory: pgml-sdks/pgml/javascript
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
apt update
apt-get -y install curl
apt-get -y install build-essential
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Validate cargo is working
uses: postgresml/gh-actions-cargo@master
with:
command: version
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Do build
env:
TYPESCRIPT_DECLARATION_FILE: "javascript/index.d.ts"
run: |
npm i
npm run build-release
# - name: Install dependencies
# run: |
# apt update
# apt-get -y install curl
# apt-get -y install build-essential
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# - name: Validate cargo is working
# uses: postgresml/gh-actions-cargo@master
# with:
# command: version
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: Do build
# env:
# TYPESCRIPT_DECLARATION_FILE: "javascript/index.d.ts"
# run: |
# npm i
# npm run build-release
- name: Build
uses: ./.github/workflows/build-javascript-sdk.yml
- name: Upload built .node file
uses: actions/upload-artifact@v3
with:
name: node-artifacts
path: pgml-sdks/pgml/javascript/dist/${{ matrix.neon-out-name }}
# path: ${{ github.workspace }}/pgml-sdks/pgml/javascript/dist/${{ matrix.neon-out-name }}
path: ${{ github.workspace }}/pgml-sdks/pgml/javascript/dist/x86_64-unknown-linux-gnu-index.node
retention-days: 1
# publish-javascript-sdk:
# needs: build-javascript-sdk
Expand Down
12 changes: 6 additions & 6 deletions pgml-sdks/pgml/javascript/Dockerfile
Expand Up @@ -7,15 +7,15 @@ RUN yum install -y npm
# Gives build errors if we don't have this
RUN yum install -y perl-IPC-Cmd

# Only need this when building locally
# Create a new user. We need this or we run as root and this will cause permission issues
RUN groupadd --g 1000 groupcontainer
RUN useradd -u 1000 -G groupcontainer -m containeruser
USER containeruser
# RUN groupadd --g 1000 groupcontainer
# RUN useradd -u 1000 -G groupcontainer -m containeruser
# USER containeruser

# Install cargo
RUN curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Add cargo to path
ENV PATH /home/containeruser/.cargo/bin:$PATH

ENTRYPOINT ["npm", "run"]
# ENV PATH /home/containeruser/.cargo/bin:$PATH
ENV PATH /root/.cargo/bin:$PATH

0 comments on commit 3382211

Please sign in to comment.