Repository navigation
Merge pull request #35 from Obstor/dependabot/npm_and_yarn/tests/run/… #69
This file contains hidden or 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 Docker Image | |
| on: | |
| push: | |
| tags: | |
| - 'RELEASE.*' | |
| branches: | |
| - main | |
| - master | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.26.x' | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '26' | |
| - name: Build | |
| run: go build -trimpath --ldflags="-s -w" -o obstor | |
| - name: Test | |
| run: | | |
| sudo sysctl net.ipv6.conf.all.disable_ipv6=0 | |
| sudo sysctl net.ipv6.conf.default.disable_ipv6=0 | |
| go test --timeout 50m ./cmd/http/... ./cmd/backend/... ./cmd/config/... ./cmd/crypto/... ./cmd/jwt/... ./cmd/rest/... ./pkg/... | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: latest | |
| build: | |
| needs: test | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| suffix: amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| suffix: arm64 | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| digest-amd64: ${{ steps.build.outputs.digest }} | |
| digest-arm64: ${{ steps.build.outputs.digest }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/setup-buildx-action@v4 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=tag | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - uses: docker/build-push-action@v7 | |
| id: build | |
| with: | |
| context: . | |
| platforms: ${{ matrix.platform }} | |
| push: true | |
| provenance: mode=max | |
| tags: ${{ steps.meta.outputs.tags }}-${{ matrix.suffix }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| VERSION=${{ github.ref_name }} | |
| COMMIT=${{ github.sha }} | |
| cache-from: type=gha,scope=${{ matrix.suffix }} | |
| cache-to: type=gha,mode=max,scope=${{ matrix.suffix }} | |
| manifest: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=tag | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Create multi-arch manifest | |
| run: | | |
| TAGS="${{ steps.meta.outputs.tags }}" | |
| for TAG in $TAGS; do | |
| docker buildx imagetools create \ | |
| --tag "$TAG" \ | |
| "${TAG}-amd64" \ | |
| "${TAG}-arm64" | |
| done |