Skip to content

Commit

Permalink
Merge branch 'main' into dev_generate-styles
Browse files Browse the repository at this point in the history
  • Loading branch information
azahnen committed Oct 17, 2024
2 parents caea106 + b68f130 commit 72c3f42
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 6 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/xtracfg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: xtracfg

on: [push]

jobs:
build:
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
runs-on: ${{ matrix.os.runner }}
defaults:
run:
working-directory: ./xtracfg
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21.13"
cache-dependency-path: xtracfg/go.sum
- uses: graalvm/setup-graalvm@v1
with:
java-version: "17"
distribution: "liberica"
native-image-job-reports: true
cache: gradle
cache-dependency-path: |
xtracfg/*.gradle*
xtracfg/**/gradle-wrapper.properties
- name: build go
env:
CI_COMMIT_BRANCH: ${{ github.ref_name }}
CI_COMMIT_SHA: ${{ github.sha }}
CI_COMMIT_TAG: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
JAVA_INCLUDE: ${{ matrix.os.type == 'macos' && 'darwin' || 'linux' }}
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
CGO_CFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/${JAVA_INCLUDE}" go build -buildmode c-archive -o dist/libxtracfg.a -ldflags="-s -w '-extldflags=-z noexecstack' -X github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitTag=${CI_COMMIT_TAG} -X github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitSha=${CI_COMMIT_SHA} -X github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitBranch=${CI_COMMIT_BRANCH}"
- name: log1
run: |
ls -lR ./dist
- name: build java
run: |
./gradlew nativeCompile ${{ matrix.os.type == 'linux' && '-PSTATIC=true' || '' }}
- name: log2
run: |
ls -lR ./build/native/nativeCompile
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os.platform }}
path: ./xtracfg/build/native/nativeCompile
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ matrix.os.platform == 'linux-amd64' }}
with:
name: common
path: ./xtracfg/Dockerfile
retention-days: 1

docker:
runs-on: ubuntu-latest
needs: build
steps:
- name: load
uses: actions/download-artifact@v4
- name: log1
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: .
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
93 changes: 93 additions & 0 deletions .github/workflows/xtractl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: xtractl

on: [push]

jobs:
build:
runs-on: ubuntu-latest
container:
image: docker://ghcr.io/ldproxy/golang-jdk:1.2
credentials:
username: ${{ github.actor }}
password: ${{ secrets.ghcr_ro_token }}
steps:
- name: clone
uses: actions/checkout@v4
- name: build
working-directory: ./xtractl
env:
CI_COMMIT_BRANCH: ${{ github.ref_name }}
CI_COMMIT_SHA: ${{ github.sha }}
CI_COMMIT_TAG: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o dist/linux-amd64/xtractl -ldflags="-s -w -X github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd.gitTag=${CI_COMMIT_TAG} -X github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd.gitSha=${CI_COMMIT_SHA} -X github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd.gitBranch=${CI_COMMIT_BRANCH}"
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o dist/linux-arm64/xtractl -ldflags="-s -w -X github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd.gitTag=${CI_COMMIT_TAG} -X github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd.gitSha=${CI_COMMIT_SHA} -X github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd.gitBranch=${CI_COMMIT_BRANCH}"
cp Dockerfile dist/
- name: log1
run: |
ls -lR ./xtractl/dist
- name: upx
uses: docker://backplane/upx:latest
with:
args: upx --best xtractl/dist/linux-amd64/xtractl xtractl/dist/linux-arm64/xtractl
- name: log2
run: |
ls -lR ./xtractl/dist
- name: save
uses: actions/upload-artifact@v4
with:
name: dist
path: ./xtractl/dist
retention-days: 1

docker:
runs-on: ubuntu-latest
needs: build
steps:
- name: load
uses: actions/download-artifact@v4
with:
name: dist
- name: log1
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: .
push: true
pull: true
tags: |
ghcr.io/ldproxy/xtractl:next
ghcr.io/ldproxy/xtractl: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: .
push: true
pull: true
tags: |
ghcr.io/ldproxy/xtractl:${{ github.ref_name }}
ghcr.io/ldproxy/xtractl:${{ github.ref_name }}-${{steps.short-sha.outputs.substring}}
platforms: |
linux/amd64
linux/arm64
2 changes: 1 addition & 1 deletion xtracfg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM cgr.dev/chainguard/glibc-dynamic:latest
ARG TARGETOS
ARG TARGETARCH
COPY --chmod=0777 ./$TARGETOS/$TARGETARCH/xtracfg /xtracfg
COPY --chmod=0777 ./$TARGETOS-$TARGETARCH/xtracfg /xtracfg
WORKDIR /src
ENTRYPOINT ["/xtracfg"]
8 changes: 6 additions & 2 deletions xtracfg/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ graalvmNative {
//buildArgs('-H:-UseServiceLoaderFeature')
//resources.autodetect()

// makes sense???
buildArgs('-H:+StaticExecutableWithDynamicLibC')
if (project.hasProperty('STATIC')) {
// makes sense???
buildArgs('-H:+StaticExecutableWithDynamicLibC')
} else {
buildArgs('--native-compiler-options=-Wl,-framework,Security')
}

// for jackson???
//buildArgs('-H:+PrintClassInitialization')
Expand Down
3 changes: 2 additions & 1 deletion xtracfg/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions xtracfg/src/main/java/de/ii/xtraplatform/cli/AutoHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private static FeatureProviderDataV2 parseFeatureProviderPgis(

builder
.connectionInfoBuilder()
.dialect(ConnectionInfoSql.Dialect.PGIS.toString())
.dialect(ConnectionInfoSql.Dialect.PGIS.name())
.host(Optional.ofNullable(parameters.get("host")))
.database(parameters.get("database"))
.user(Optional.ofNullable(parameters.get("user")))
Expand All @@ -266,7 +266,7 @@ private static FeatureProviderDataV2 parseFeatureProviderGpkg(

builder
.connectionInfoBuilder()
.dialect(ConnectionInfoSql.Dialect.GPKG.toString())
.dialect(ConnectionInfoSql.Dialect.GPKG.name())
.database(parameters.get("database"))
.poolBuilder();

Expand Down

0 comments on commit 72c3f42

Please sign in to comment.