Skip to content

Commit

Permalink
Merge pull request #175 from open-amt-cloud-toolkit/alpha
Browse files Browse the repository at this point in the history
chore: update main from alpha
  • Loading branch information
rsdmike authored May 29, 2024
2 parents c45a5f6 + 03bc63f commit 647a3c1
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 125 deletions.
28 changes: 1 addition & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Semantic-Release CI

on:
push:
branches: [main]
branches: [main, alpha]

permissions:
contents: read
Expand Down Expand Up @@ -59,29 +59,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.ROSIE_TOKEN }}

# - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
# if: ${{ steps.version.outputs.next != 'none' }}
# with:
# repository: open-amt-cloud-toolkit/e2e-testing
# ref: docker-release
# clean: true
# token: ${{ secrets.ROSIE_TOKEN }}

# - name: Create docker-release @ ${{ steps.version.outputs.next }}
# if: ${{ steps.version.outputs.next != 'none' }}
# env:
# RELEASE_YAML: release/sample-web-ui.yml
# NEXT_VERSION: ${{ steps.version.outputs.next }}
# run: |
# echo "Releasing ${{ github.repository }}@$NEXT_VERSION"
# if [ "$NEXT_VERSION" != "" ]; then
# CURRENT_VERSION=$(sed -nre 's/(.*):v[0-9]*(([0-9]+\\.)*[0-9]+).*/v\\2/p' $RELEASE_YAML)
# sed -i "s/$CURRENT_VERSION/$NEXT_VERSION/g" $RELEASE_YAML
# echo "========================="
# git config --local user.email "github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# git status
# git add .
# git commit -m "release(sample-web-ui): automated release of $NEXT_VERSION @ ${GITHUB_SHA::7}"
# git push origin docker-release
# fi
14 changes: 11 additions & 3 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@
{
"assets": [
{
"path": "console_linux_x64",
"path": "console_linux_x64.tar.gz",
"label": "Linux x64 Console Executable"
},
{
"path": "console_windows_x64.exe",
"path": "console_windows_x64.zip",
"label": "Windows x64 Console Executable"
},
{
"path": "console_mac_x64.tar.gz",
"label": "Mac x64 Console Executable"
},
{
"path": "console_mac_arm64.tar.gz",
"label": "Mac arm64 Console Executable"
}
]
}
Expand All @@ -31,7 +39,7 @@
[
"@semantic-release/exec",
{
"prepareCmd": "docker build -t vprodemo.azurecr.io/console:v${nextRelease.version} . && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags \"-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=${nextRelease.version}'\" -trimpath -o console_linux_x64 ./cmd/app/main.go && CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags \"-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=${nextRelease.version}'\" -trimpath -o console_windows_x64.exe ./cmd/app/main.go",
"prepareCmd": "./build.sh ${nextRelease.version} ",
"publishCmd": "docker push vprodemo.azurecr.io/console:v${nextRelease.version}",
"verifyReleaseCmd": "echo v${nextRelease.version} > .nextVersion"
}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
# Step 3: Final
FROM scratch
COPY --from=builder /app/config /config
COPY --from=builder /app/migrations /migrations
COPY --from=builder /app/internal/app/migrations /migrations
COPY --from=builder /bin/app /app
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
CMD ["/app"]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ swag-v1: ### swag init

run: ### run app
go mod tidy && go mod download && \
DISABLE_SWAGGER_HTTP_HANDLER='' GIN_MODE=debug CGO_ENABLED=1 go run ./cmd/app
DISABLE_SWAGGER_HTTP_HANDLER='' GIN_MODE=debug CGO_ENABLED=0 go run ./cmd/app
.PHONY: run

docker-rm-volume: ### remove docker volume
Expand Down Expand Up @@ -76,11 +76,11 @@ mock: ### run mockgen
.PHONY: mock

migrate-create: ### create new migration
migrate create -ext sql -dir migrations 'migrate_name'
migrate create -ext sql -dir /internal/app/migrations 'migrate_name'
.PHONY: migrate-create

migrate-up: ### migration up
migrate -path migrations -database '$(DB_URL)?sslmode=disable' up
migrate -path /internal/app/migrations -database '$(DB_URL)?sslmode=disable' up
.PHONY: migrate-up

bin-deps:
Expand Down
29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Get version from the first argument
version=$1

docker build -t vprodemo.azurecr.io/console:v$version .

# Build for Linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=$version'" -trimpath -o console_linux_x64 ./cmd/app/main.go

# Build for Windows
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=$version'" -trimpath -o console_windows_x64.exe ./cmd/app/main.go

# Build for Mac (x64)
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=$version'" -trimpath -o console_mac_x64 ./cmd/app/main.go

# Build for Mac (arm64)
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X 'github.com/open-amt-cloud-toolkit/console/internal/app.Version=$version'" -trimpath -o console_mac_arm64 ./cmd/app/main.go

# Mark the Unix system outputs as executable
chmod +x console_linux_x64
chmod +x console_mac_x64
chmod +x console_mac_arm64

# Add them to tar files respectively
tar cvfpz console_linux_x64.tar.gz console_linux_x64
tar cvfpz console_mac_x64.tar.gz console_mac_x64
tar cvfpz console_mac_arm64.tar.gz console_mac_arm64

# Add Windows build to a zip file
zip console_windows_x64.zip console_windows_x64.exe
29 changes: 13 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,37 @@ require (
github.com/gorilla/websocket v1.5.1
github.com/ilyakaznacheev/cleanenv v1.5.0
github.com/jackc/pgx/v5 v5.6.0
github.com/mattn/go-sqlite3 v1.14.22
github.com/prometheus/client_golang v1.19.1
github.com/rs/zerolog v1.33.0
github.com/stretchr/testify v1.9.0
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.3
go.uber.org/mock v0.4.0
modernc.org/sqlite v1.29.10
)

require (
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/objx v0.5.2 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/sync v0.5.0 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.36.3 // indirect
modernc.org/ccgo/v3 v3.16.9 // indirect
modernc.org/libc v1.17.1 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.2.1 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.18.1 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.0.0 // indirect
golang.org/x/sync v0.6.0 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.49.3 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)

require (
Expand Down Expand Up @@ -94,7 +91,7 @@ require (
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.10.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect
Expand Down
Loading

0 comments on commit 647a3c1

Please sign in to comment.