feat: кросс-компиляция linux/windows/darwin × amd64/arm64
All checks were successful
CI / test (push) Successful in 35s
CI / build-and-package (amd64, darwin) (push) Successful in 1m7s
CI / build-and-package (amd64, linux) (push) Successful in 34s
CI / build-and-package (amd64, windows) (push) Successful in 1m9s
CI / build-and-package (arm64, darwin) (push) Successful in 1m11s
CI / build-and-package (arm64, linux) (push) Successful in 1m17s
All checks were successful
CI / test (push) Successful in 35s
CI / build-and-package (amd64, darwin) (push) Successful in 1m7s
CI / build-and-package (amd64, linux) (push) Successful in 34s
CI / build-and-package (amd64, windows) (push) Successful in 1m9s
CI / build-and-package (arm64, darwin) (push) Successful in 1m11s
CI / build-and-package (arm64, linux) (push) Successful in 1m17s
This commit is contained in:
@@ -34,6 +34,13 @@ jobs:
|
|||||||
build-and-package:
|
build-and-package:
|
||||||
if: always()
|
if: always()
|
||||||
needs: test
|
needs: test
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
goos: [linux, windows, darwin]
|
||||||
|
goarch: [amd64, arm64]
|
||||||
|
exclude:
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm64
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -44,7 +51,17 @@ jobs:
|
|||||||
check-latest: true
|
check-latest: true
|
||||||
|
|
||||||
- name: Build binary
|
- name: Build binary
|
||||||
run: go build -ldflags="-s -w" -o ratatoskr ./cmd/ratatoskr/
|
run: |
|
||||||
|
FILENAME="ratatoskr-${{ matrix.goos }}-${{ matrix.goarch }}"
|
||||||
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||||
|
FILENAME="${FILENAME}.exe"
|
||||||
|
fi
|
||||||
|
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \
|
||||||
|
go build -ldflags="-s -w" -o "${FILENAME}" ./cmd/ratatoskr/
|
||||||
|
echo "FILENAME=${FILENAME}" >> "${GITEA_ENV}"
|
||||||
|
|
||||||
|
- name: Show size
|
||||||
|
run: ls -lh "$FILENAME"
|
||||||
|
|
||||||
- name: Upload to Gitea Packages
|
- name: Upload to Gitea Packages
|
||||||
if: gitea.ref == 'refs/heads/main'
|
if: gitea.ref == 'refs/heads/main'
|
||||||
@@ -53,9 +70,9 @@ jobs:
|
|||||||
curl -sS -X PUT \
|
curl -sS -X PUT \
|
||||||
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/${VERSION}/ratatoskr" \
|
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/${VERSION}/${FILENAME}" \
|
||||||
--data-binary @ratatoskr
|
--data-binary @${FILENAME}
|
||||||
echo "Uploaded version ${VERSION}"
|
echo "Uploaded ${VERSION}/${FILENAME}"
|
||||||
|
|
||||||
- name: Update latest tag
|
- name: Update latest tag
|
||||||
if: gitea.ref == 'refs/heads/main'
|
if: gitea.ref == 'refs/heads/main'
|
||||||
@@ -63,10 +80,6 @@ jobs:
|
|||||||
curl -sS -X PUT \
|
curl -sS -X PUT \
|
||||||
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/ratatoskr" \
|
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/${FILENAME}" \
|
||||||
--data-binary @ratatoskr
|
--data-binary @${FILENAME}
|
||||||
echo "Updated 'latest' tag"
|
echo "Updated 'latest/${FILENAME}'"
|
||||||
|
|
||||||
- name: Store binary (PR only)
|
|
||||||
if: gitea.ref != 'refs/heads/main'
|
|
||||||
run: ls -lh ratatoskr
|
|
||||||
4
Makefile
4
Makefile
@@ -35,4 +35,6 @@ bench:
|
|||||||
cross:
|
cross:
|
||||||
GOOS=linux GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-linux-amd64 $(CMD_DIR)
|
GOOS=linux GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-linux-amd64 $(CMD_DIR)
|
||||||
GOOS=linux GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(APP)-linux-arm64 $(CMD_DIR)
|
GOOS=linux GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(APP)-linux-arm64 $(CMD_DIR)
|
||||||
GOOS=darwin GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-darwin-amd64 $(CMD_DIR)
|
GOOS=darwin GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-darwin-amd64 $(CMD_DIR)
|
||||||
|
GOOS=darwin GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(APP)-darwin-arm64 $(CMD_DIR)
|
||||||
|
GOOS=windows GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-windows-amd64.exe $(CMD_DIR)
|
||||||
Reference in New Issue
Block a user