[api] Add interface to SQLite #965
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 | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
env: | |
IMAGE: flomesh/pipy | |
PKG_NAME: pipy | |
S3_PATH: repo/pipy | |
defaults: | |
run: | |
shell: bash | |
working-directory: pipy | |
jobs: | |
set-release-version: | |
name: set-release-version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: pipy | |
- name: Set RELEASE_VERSION | |
id: version | |
run: | | |
pwd | |
ls -l | |
CI_COMMIT_DATE=$(date +%Y%m%d%H%M) | |
echo "CI_COMMIT_DATE=${CI_COMMIT_DATE}" >> $GITHUB_ENV | |
git fetch --tags | |
RELEASE_VERSION=`git name-rev --tags --name-only $(git rev-parse HEAD)` | |
if [ $RELEASE_VERSION = 'undefined' ] | |
then | |
echo "release_version=nightly-${CI_COMMIT_DATE}" >> $GITHUB_OUTPUT | |
echo "version=nightly" >> $GITHUB_OUTPUT | |
echo "commit_date=${CI_COMMIT_DATE}" >> $GITHUB_OUTPUT | |
else | |
echo "release_version=${RELEASE_VERSION}" >> $GITHUB_OUTPUT | |
echo "commit_date=${CI_COMMIT_DATE}" >> $GITHUB_OUTPUT | |
fi | |
- name: Show envs | |
run: export | |
outputs: | |
release_version: ${{steps.version.outputs.release_version}} | |
commit_date: ${{steps.version.outputs.commit_date}} | |
x86-binary: | |
needs: set-release-version | |
name: x86-binary | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: pipy | |
- name: Show envs | |
run: export | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Build | |
id: build | |
env: | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
set -x | |
./build.sh -p -t ${RELEASE_VERSION} | |
ls -l | |
echo "artifact_name=$(ls *${RELEASE_VERSION}*.tar.gz)" >> $GITHUB_OUTPUT | |
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT | |
- name: Setup s3cmd | |
run: | | |
sudo apt-get install -y s3cmd | |
cat > $HOME/.s3cfg << EOF | |
bucket_location = ${{ secrets.S3_REGION }} | |
host_base = ${{ secrets.S3_GLOBAL_ACC_HOST_BASE }} | |
host_bucket = %(bucket)s.${{ secrets.S3_GLOBAL_ACC_HOST_BASE}} | |
access_key = ${{ secrets.S3_ACCESS_KEY }} | |
secret_key = ${{ secrets.S3_SECRET_KEY }} | |
EOF | |
- name: Upload artifacts | |
env: | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
if [[ "$RELEASE_VERSION" == "nightly"* ]] | |
then | |
s3cmd put ${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}-nightly/$(uname -m)/binary/${{steps.build.outputs.artifact_name}} | |
else | |
s3cmd put ${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}/$(uname -m)/binary/${{steps.build.outputs.artifact_name}} | |
fi | |
outputs: | |
artifact_name: ${{steps.build.outputs.artifact_name}} | |
arch: ${{steps.build.outputs.arch}} | |
x86-alpine-docker: | |
needs: set-release-version | |
name: x86-alpine-docker | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: pipy | |
- name: Setup buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Show envs | |
run: export | |
- name: Build image | |
id: build | |
env: | |
DOCKER_BUILDKIT: 1 | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
./build.sh -ncp -t ${RELEASE_VERSION} | |
ls -l | |
echo "artifact_name=$(ls *${RELEASE_VERSION}*.tar.gz)" >> $GITHUB_OUTPUT | |
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT | |
- name: Setup s3cmd | |
run: | | |
sudo apt-get install -y s3cmd | |
cat > $HOME/.s3cfg << EOF | |
bucket_location = ${{ secrets.S3_REGION }} | |
host_base = ${{ secrets.S3_GLOBAL_ACC_HOST_BASE }} | |
host_bucket = %(bucket)s.${{ secrets.S3_GLOBAL_ACC_HOST_BASE}} | |
access_key = ${{ secrets.S3_ACCESS_KEY }} | |
secret_key = ${{ secrets.S3_SECRET_KEY }} | |
EOF | |
- name: Upload artifacts | |
env: | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
if [[ "$RELEASE_VERSION" == "nightly"* ]] | |
then | |
s3cmd put ${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}-nightly/$(uname -m)/image/${{steps.build.outputs.artifact_name}} | |
else | |
s3cmd put ${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}/$(uname -m)/image/${{steps.build.outputs.artifact_name}} | |
fi | |
outputs: | |
artifact_name: ${{steps.build.outputs.artifact_name}} | |
arch: ${{steps.build.outputs.arch}} | |
aarch64-binary: | |
needs: set-release-version | |
name: aarch64-binary | |
runs-on: [self-hosted, arm64] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: pipy | |
- name: Show envs | |
run: export | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Build | |
id: build | |
env: | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
./build.sh -p -t ${RELEASE_VERSION} | |
ls -l | |
echo "artifact_name=$(ls *${RELEASE_VERSION}*.tar.gz)" >> $GITHUB_OUTPUT | |
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT | |
- name: Setup s3cmd | |
run: | | |
sudo apt-get install -y s3cmd | |
cat > $HOME/.s3cfg << EOF | |
bucket_location = ${{ secrets.S3_REGION }} | |
host_base = ${{ secrets.S3_GLOBAL_ACC_HOST_BASE }} | |
host_bucket = %(bucket)s.${{ secrets.S3_GLOBAL_ACC_HOST_BASE}} | |
access_key = ${{ secrets.S3_ACCESS_KEY }} | |
secret_key = ${{ secrets.S3_SECRET_KEY }} | |
EOF | |
- name: Upload artifacts | |
env: | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
if [[ "$RELEASE_VERSION" == "nightly"* ]] | |
then | |
s3cmd put ${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}-nightly/$(uname -m)/binary/${{steps.build.outputs.artifact_name}} | |
else | |
s3cmd put ${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}/$(uname -m)/binary/${{steps.build.outputs.artifact_name}} | |
fi | |
outputs: | |
artifact_name: ${{steps.build.outputs.artifact_name}} | |
arch: ${{steps.build.outputs.arch}} | |
aarch64-alpine-docker: | |
needs: set-release-version | |
name: aarch64-alpine-docker | |
runs-on: [self-hosted, arm64] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: pipy | |
- name: Setup buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Show envs | |
run: export | |
- name: Build image | |
id: build | |
env: | |
DOCKER_BUILDKIT: 1 | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
./build.sh -ncp -t ${RELEASE_VERSION} | |
ls -l | |
echo "artifact_name=$(ls *${RELEASE_VERSION}*.tar.gz)" >> $GITHUB_OUTPUT | |
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT | |
- name: Setup s3cmd | |
run: | | |
sudo apt-get install -y s3cmd | |
cat > $HOME/.s3cfg << EOF | |
bucket_location = ${{ secrets.S3_REGION }} | |
host_base = ${{ secrets.S3_GLOBAL_ACC_HOST_BASE }} | |
host_bucket = %(bucket)s.${{ secrets.S3_GLOBAL_ACC_HOST_BASE}} | |
access_key = ${{ secrets.S3_ACCESS_KEY }} | |
secret_key = ${{ secrets.S3_SECRET_KEY }} | |
EOF | |
- name: Upload artifacts | |
env: | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
if [[ "$RELEASE_VERSION" == "nightly"* ]] | |
then | |
s3cmd put ${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}-nightly/$(uname -m)/image/${{steps.build.outputs.artifact_name}} | |
else | |
s3cmd put ${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}/$(uname -m)/image/${{steps.build.outputs.artifact_name}} | |
fi | |
outputs: | |
artifact_name: ${{steps.build.outputs.artifact_name}} | |
arch: ${{steps.build.outputs.arch}} | |
x86-rpm: | |
needs: set-release-version | |
name: x86-rpm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: pipy | |
- name: Show envs | |
run: export | |
- name: Build rpm | |
id: build | |
env: | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
./build.sh -nr -t ${RELEASE_VERSION} | |
ls -l | |
echo "artifact_name=$(cd rpm; ls *.rpm)" >> $GITHUB_OUTPUT | |
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT | |
- name: Setup s3cmd | |
run: | | |
sudo apt-get install -y s3cmd | |
cat > $HOME/.s3cfg << EOF | |
bucket_location = ${{ secrets.S3_REGION }} | |
host_base = ${{ secrets.S3_GLOBAL_ACC_HOST_BASE }} | |
host_bucket = %(bucket)s.${{ secrets.S3_GLOBAL_ACC_HOST_BASE}} | |
access_key = ${{ secrets.S3_ACCESS_KEY }} | |
secret_key = ${{ secrets.S3_SECRET_KEY }} | |
EOF | |
- name: Upload artifacts | |
env: | |
RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
run: | | |
TARGET_FILE_NAME=`echo ${{steps.build.outputs.artifact_name}} | sed 's/.el7./-el7-/g'` | |
if [[ "$RELEASE_VERSION" == "nightly"* ]] | |
then | |
s3cmd put rpm/${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}-nightly/$(uname -m)/rpm/${TARGET_FILE_NAME} | |
else | |
s3cmd put rpm/${{steps.build.outputs.artifact_name}} s3://${{ secrets.S3_BUCKET }}/${S3_PATH}/$(uname -m)/rpm/${TARGET_FILE_NAME} | |
fi | |
outputs: | |
artifact_name: ${{steps.build.outputs.artifact_name}} | |
arch: ${{steps.build.outputs.arch}} | |
save-log: | |
name: save log | |
runs-on: ubuntu-latest | |
needs: | |
- set-release-version | |
- x86-binary | |
- aarch64-binary | |
- x86-alpine-docker | |
- aarch64-alpine-docker | |
- x86-rpm | |
steps: | |
- name: Save log | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.REPO_DISPATCH_PAT }} | |
repository: ${{ secrets.REPO_FOR_LOG }} | |
event-type: save-log | |
client-payload: | | |
{ | |
"github": ${{toJSON(github)}}, | |
"release_version": "${{needs.set-release-version.outputs.release_version}}", | |
"artifacts": [ | |
{ "type": "rpm", "arch": "${{needs.x86-rpm.outputs.arch}}", "name": "${{ needs.x86-rpm.outputs.artifact_name }}" }, | |
{ "type": "binary", "arch": "${{needs.x86-binary.outputs.arch}}", "name": "${{ needs.x86-binary.outputs.artifact_name }}" }, | |
{ "type": "binary", "arch": "${{needs.aarch64-binary.outputs.arch}}", "name": "${{ needs.aarch64-binary.outputs.artifact_name }}" }, | |
{ "type": "image", "arch": "${{needs.x86-alpine-docker.outputs.arch}}", "name": "${{ needs.x86-alpine-docker.outputs.artifact_name }}" }, | |
{ "type": "image", "arch": "${{needs.aarch64-alpine-docker.outputs.arch}}", "name": "${{ needs.aarch64-alpine-docker.outputs.artifact_name }}" } | |
] | |
} |