Skip to content

default values

default values #120

Workflow file for this run

name: xtracfg
on: [push]
jobs:
build_libraries:
runs-on: ${{ matrix.os.runner }}
strategy:
matrix:
os:
- runner: ubuntu-latest
type: linux
platform: linux-amd64
#- runner: buildjet-2vcpu-ubuntu-2204-arm
# type: linux
# platform: linux-arm64
- runner: macos-latest
type: macos
platform: darwin-arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-go@v5
with:
go-version: "1.23.2"
cache-dependency-path: xtracfg/go.sum
- uses: graalvm/setup-graalvm@v1
with:
java-version: "21"
distribution: "graalvm"
native-image-job-reports: true
cache: gradle
#cache-dependency-path: |
# xtracfg/*.gradle*
# xtracfg/**/gradle-wrapper.properties
- name: zlib
if: ${{ matrix.os.platform == 'linux-amd64' }}
working-directory: /tmp
env:
ZLIB_VERSION: 1.2.11
run: |
wget https://zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz
tar xzvf zlib-${ZLIB_VERSION}.tar.gz
mv zlib-${ZLIB_VERSION} zlib
cd zlib
CFLAGS="-fPIC" ./configure --static
make
- name: java
working-directory: ./libxtracfg/java
run: |
./gradlew nativeCompile -PLIB=true
- name: log1
run: |
ls -l ./libxtracfg/c/build
- name: c
working-directory: ./libxtracfg/c
run: |
./build.sh
./test.sh
- name: log2
run: |
ls -l ./libxtracfg/c/build
- name: js
working-directory: ./libxtracfg/js/xtracfg-native-binding
run: |
npm ci
npm run prebuildify
npm run test
- name: log3
run: |
ls -lR ./libxtracfg/js/xtracfg-native-binding/prebuilds
# TODO: run tests for java, c, go
- uses: actions/upload-artifact@v4
with:
name: libxtracfg-c-${{ matrix.os.platform }}
path: ./libxtracfg/c/build/libxtracfg.a
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: libxtracfg-c-hash-${{ matrix.os.platform }}
path: ./libxtracfg/go/xtracfg/libxtracfg.sha1sum
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: libxtracfg-js-${{ matrix.os.platform }}
path: ./libxtracfg/js/xtracfg-native-binding/prebuilds
retention-days: 1
build_binaries:
runs-on: ${{ matrix.os.runner }}
needs: build_libraries
strategy:
matrix:
os:
- runner: ubuntu-latest
type: linux
platform: linux-amd64
#- runner: buildjet-2vcpu-ubuntu-2204-arm
# type: linux
# platform: linux-arm64
- runner: macos-latest
type: macos
platform: darwin-arm64
defaults:
run:
working-directory: ./xtracfg
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23.2"
cache-dependency-path: xtracfg/go.sum
- uses: actions/download-artifact@v4
with:
name: libxtracfg-c-${{ matrix.os.platform }}
path: ./libxtracfg/c/build/
- uses: actions/download-artifact@v4
with:
name: libxtracfg-c-hash-${{ matrix.os.platform }}
path: ./libxtracfg/go/xtracfg/
- uses: bhowell2/[email protected]
id: short-sha
with:
value: ${{ github.sha }}
length_from_start: 7
- name: build
env:
CMD_GIT_BRANCH: github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitBranch=${{ github.ref_name }}
CMD_GIT_SHA: github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitSha=${{ steps.short-sha.outputs.substring }}
CMD_GIT_TAG: github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitTag=${{ github.ref_type == 'tag' && github.ref_name || '' }}
EXT_LDFLAGS: ${{ matrix.os.type == 'macos' && '-framework CoreServices -framework Foundation' || '-z noexecstack' }}
run: |
go build -o build/xtracfg -ldflags="-s -w -X ${CMD_GIT_TAG} -X ${CMD_GIT_SHA} -X ${CMD_GIT_BRANCH} '-extldflags=${EXT_LDFLAGS}'"
- name: log1
run: |
ls -lR ./build
- name: test
run: |
./build/xtracfg --version
./build/xtracfg info
- uses: actions/upload-artifact@v4
with:
name: xtracfg-${{ matrix.os.platform }}
path: ./xtracfg/build/xtracfg
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ matrix.os.platform == 'linux-amd64' }}
with:
name: common
path: ./xtracfg/Dockerfile
retention-days: 1
publish_npm:
runs-on: ubuntu-latest
needs: build_libraries
defaults:
run:
working-directory: ./libxtracfg/js
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # need full history for snapshot version
- uses: actions/download-artifact@v4
with:
pattern: "libxtracfg-js-*"
path: ./libxtracfg/js/xtracfg-native-binding/prebuilds
merge-multiple: true
- name: log1
run: |
ls -lR ./xtracfg-native-binding/prebuilds
- name: publish
env:
DIST_TAG: ${{ github.ref_name == 'main' && 'next' || github.ref_name }}
NPM_TOKEN: ${{ secrets.npm_rw_token }}
run: |
set -x
#npm run bump -- prerelease --build-metadata ${DIST_TAG} --preid ${DIST_TAG}
npm ci --ignore-scripts
npm run build
npm run publish -- --canary preminor --preid ${DIST_TAG} --dist-tag ${DIST_TAG}
- name: log2
run: |
ls -lR ./**/build
publish_docker:
runs-on: ubuntu-latest
needs: build_binaries
steps:
- name: load
uses: actions/download-artifact@v4
with:
pattern: "{common,xtracfg-}*"
- name: chmod
run: |
chmod +x ./xtracfg-*/xtracfg
- name: log1
run: |
ls -lR
- uses: mmatheson/[email protected]
with:
version: v4.2.4
files: |
./xtracfg-*/xtracfg
args: --best --force-macos
- name: log2
run: |
ls -lR
- uses: bhowell2/[email protected]
id: short-sha
with:
value: ${{ github.sha }}
length_from_start: 7
- name: login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ghcr_rw_token }}
- name: buildx
uses: docker/setup-buildx-action@v3
- name: push
if: ${{ github.ref_name == 'main' }}
uses: docker/build-push-action@v6
with:
context: .
file: ./common/Dockerfile
push: true
pull: true
tags: |
ghcr.io/ldproxy/xtracfg:next
ghcr.io/ldproxy/xtracfg:next-${{steps.short-sha.outputs.substring}}
platforms: |
linux/amd64
# linux/arm64
- name: push-branch
if: ${{ github.ref_name != 'main' }}
uses: docker/build-push-action@v6
with:
context: .
file: ./common/Dockerfile
push: true
pull: true
tags: |
ghcr.io/ldproxy/xtracfg:${{ github.ref_name }}
ghcr.io/ldproxy/xtracfg:${{ github.ref_name }}-${{steps.short-sha.outputs.substring}}
platforms: |
linux/amd64
# linux/arm64
# TODO: validate binaries and docker images