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
85 lines
2.3 KiB
YAML
85 lines
2.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths-ignore:
|
|
- '**.md'
|
|
- '.gitea/**'
|
|
- 'LICENSE'
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ gitea.workflow }}-${{ gitea.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23'
|
|
check-latest: true
|
|
|
|
- name: Run tests
|
|
run: go test ./... -v -count=1 -timeout 120s 2>&1
|
|
|
|
- name: Vet
|
|
run: go vet ./...
|
|
|
|
build-and-package:
|
|
if: always()
|
|
needs: test
|
|
strategy:
|
|
matrix:
|
|
goos: [linux, windows, darwin]
|
|
goarch: [amd64, arm64]
|
|
exclude:
|
|
- goos: windows
|
|
goarch: arm64
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23'
|
|
check-latest: true
|
|
|
|
- name: Build binary
|
|
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
|
|
if: gitea.ref == 'refs/heads/main'
|
|
run: |
|
|
VERSION="commit-$(echo '${{ gitea.sha }}' | cut -c1-7)"
|
|
curl -sS -X PUT \
|
|
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/${VERSION}/${FILENAME}" \
|
|
--data-binary @${FILENAME}
|
|
echo "Uploaded ${VERSION}/${FILENAME}"
|
|
|
|
- name: Update latest tag
|
|
if: gitea.ref == 'refs/heads/main'
|
|
run: |
|
|
curl -sS -X PUT \
|
|
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/${FILENAME}" \
|
|
--data-binary @${FILENAME}
|
|
echo "Updated 'latest/${FILENAME}'" |