Skip to content

Commit

Permalink
feat: upgrade dependencies and multi-arch support (#311)
Browse files Browse the repository at this point in the history
Upgrade dependencies and add docker multi-arch support
  • Loading branch information
AlmogBaku committed Feb 9, 2024
2 parents 9438397 + f5e9882 commit 4652dd1
Show file tree
Hide file tree
Showing 60 changed files with 1,083 additions and 969 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/buf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
token: ${{ secrets.BOT_PAT }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event_name != 'push' && github.ref != 'refs/heads/master'
- name: Setup Go environment
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '^1.20'
go-version: '^1.21'
- uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/go-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Setup Go environment
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '^1.20'
go-version: '^1.21'
- name: Clone the code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Cache go dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labels-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/labsdk-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
skipped: ${{ steps.changelog.outputs.skipped }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
uses: TriPSs/conventional-changelog-action@v5
with:
release-count: '1'
skip-version-file: 'true'
Expand All @@ -40,7 +40,7 @@ jobs:
name: Build distributions - source and wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Override the version for the dist code
working-directory: ./labsdk/
run: |
Expand All @@ -54,7 +54,7 @@ jobs:
env:
BUILD_VERSION: "${{ needs.version.outputs.version }}"
run: pipx run build --sdist --wheel
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: |
./labsdk/dist/*.tar.gz
Expand All @@ -65,12 +65,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Fetch the artifacts"
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: "Publish to PyPi"
uses: pypa/gh-action-pypi-publish@v1.5.0
uses: pypa/gh-action-pypi-publish@v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
Expand All @@ -91,7 +91,7 @@ jobs:
git commit -m "chore(LabSDK-release): ${{ needs.version.outputs.version }}" labsdk/CHANGELOG.md
git push
- name: Tag
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Setup Go environment
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '^1.20'
go-version: '^1.21'
- name: Clone the code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install google/go-licenses
run: go install github.com/google/go-licenses@master
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: "Triage Pull Request"
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: codelytv/pr-size-labeler@v1
Expand Down
37 changes: 18 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BOT_PAT }}
Expand All @@ -47,28 +47,29 @@ jobs:
tag-prefix: 'v'
fallback-version: '0.2.0'
- name: Setup Go environment
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '^1.20'
- name: Build project
run: |
make generate docker-build bundle installer \
VERSION=${{ steps.version.outputs.version }} \
BUNDLE_VERSION=${{ steps.version.outputs.tag }} \
CHANNELS=${{ steps.bundle_channel.outputs.channel }} \
ENV=prod
go-version: '^1.21'
- # Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images
- name: Build and push the containers
run: |
docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-core
docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-historian
docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-runtime
docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-bundle
make generate docker-build bundle installer \
VERSION=${{ steps.version.outputs.version }} \
BUNDLE_VERSION=${{ steps.version.outputs.tag }} \
CHANNELS=${{ steps.bundle_channel.outputs.channel }} \
DOCKER_BUILD_FLAGS="--platform linux/amd64,linux/arm64 --push"
ENV=prod
- name: Update changelog
shell: bash
run: |
Expand All @@ -82,7 +83,7 @@ jobs:
git commit -m "chore(release): ${{ steps.version.outputs.version }}" CHANGELOG.md
git push
- name: Tag
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
Expand All @@ -95,8 +96,6 @@ jobs:
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.tag }}
files: |
installer.sh
body: |
${{ steps.version.outputs.clean_changelog }}
prerelease: ${{ inputs.prerelease }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Setup Go environment
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '^1.20'
go-version: '^1.21'
- name: Clone the code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Cache go dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
Expand All @@ -51,11 +51,11 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Install KiND
uses: helm/kind-action@v1.5.0
uses: helm/kind-action@v1.8.0
with:
install_only: true
- name: Install Kustomize
uses: imranismail/setup-kustomize@v1
uses: imranismail/setup-kustomize@v2
- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
Expand All @@ -70,7 +70,7 @@ jobs:
set -euo pipefail
go test -v -timeout 1h -json -tags e2e github.com/raptor-ml/raptor/internal/e2e --args -v 5 -build-tag=$(git rev-parse --short HEAD) 2>&1 | tee /tmp/gotest.log | gotestfmt
- name: Upload test log
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: test-log
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ repos:
- id: detect-aws-credentials
- id: detect-private-key
- id: end-of-file-fixer
exclude: ^api/proto/gen/
- id: fix-byte-order-marker
exclude: ^api/proto/gen/
- id: no-commit-to-branch
- id: pretty-format-json
args:
Expand All @@ -31,6 +33,7 @@ repos:
- id: debug-statements
- id: double-quote-string-fixer
- id: fix-encoding-pragma
exclude: ^api/proto/gen/
- repo: https://github.com/golangci/golangci-lint
rev: v1.50.1
hooks:
Expand All @@ -44,6 +47,7 @@ repos:
- id: pretty-format-golang
args:
- --autofix
exclude: ^api/proto/gen/
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
Expand Down
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
ARG TARGETOS=linux
ARG TARGETARCH=amd64
ARG LDFLAGS
ARG VERSION

### Build
FROM golang:1.20 AS build
ARG TARGETOS
ARG TARGETARCH
FROM golang:1.22 AS build
ARG LDFLAGS

WORKDIR /workspace
Expand All @@ -19,7 +15,7 @@ COPY . /workspace

### Core
FROM build AS build-core
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="${LDFLAGS}" -o /out/core cmd/core/*.go
RUN CGO_ENABLED=0 go build -ldflags="${LDFLAGS}" -o /out/core cmd/core/*.go

FROM gcr.io/distroless/static:nonroot as core
ARG VERSION
Expand All @@ -38,7 +34,7 @@ ENTRYPOINT ["/core"]

### Historian
FROM build AS build-historian
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -ldflags="${LDFLAGS}" -o /out/historian cmd/historian/*.go
RUN CGO_ENABLED=0 go build -ldflags="${LDFLAGS}" -o /out/historian cmd/historian/*.go

FROM gcr.io/distroless/static:nonroot as historian

Expand Down
Loading

0 comments on commit 4652dd1

Please sign in to comment.