Used my go-mega for fix #5
This file contains 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
--- | |
# Github Actions build for rclone | |
# -*- compile-command: "yamllint -f parsable build.yml" -*- | |
name: build | |
# Trigger the workflow on push or pull request | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '**' | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
manual: | |
description: Manual run (bypass default conditions) | |
type: boolean | |
required: true | |
default: true | |
jobs: | |
build: | |
if: ${{ github.event.inputs.manual == 'true' || (github.repository == 'et-ness/rclone' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)) }} | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
job_name: ['linux'] | |
include: | |
- job_name: linux | |
os: ubuntu-latest | |
go: '>=1.23.0-rc.1' | |
gotags: cmount | |
build_flags: '-include "^linux/" -exclude "^linux/mips|^linux/arm"' | |
check: true | |
quicktest: true | |
racequicktest: true | |
librclonetest: true | |
deploy: true | |
name: ${{ matrix.job_name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
check-latest: true | |
- name: Set environment variables | |
shell: bash | |
run: | | |
echo 'GOTAGS=${{ matrix.gotags }}' >> $GITHUB_ENV | |
echo 'BUILD_FLAGS=${{ matrix.build_flags }}' >> $GITHUB_ENV | |
echo 'BUILD_ARGS=${{ matrix.build_args }}' >> $GITHUB_ENV | |
if [[ "${{ matrix.goarch }}" != "" ]]; then echo 'GOARCH=${{ matrix.goarch }}' >> $GITHUB_ENV ; fi | |
if [[ "${{ matrix.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ matrix.cgo }}' >> $GITHUB_ENV ; fi | |
- name: Install Libraries on Linux | |
shell: bash | |
run: | | |
sudo modprobe fuse | |
sudo chmod 666 /dev/fuse | |
sudo chown root:$USER /etc/fuse.conf | |
sudo apt-get install fuse3 libfuse-dev rpm pkg-config git-annex git-annex-remote-rclone nfs-common | |
if: matrix.os == 'ubuntu-latest' | |
- name: Print Go version and environment | |
shell: bash | |
run: | | |
printf "Using go at: $(which go)\n" | |
printf "Go version: $(go version)\n" | |
printf "\n\nGo environment:\n\n" | |
go env | |
printf "\n\nRclone environment:\n\n" | |
make vars | |
printf "\n\nSystem environment:\n\n" | |
env | |
- name: Build rclone | |
shell: bash | |
run: | | |
make | |
- name: Rclone version | |
shell: bash | |
run: | | |
rclone version | |
- name: Deploy built binaries | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then make release_dep_linux ; fi | |
make cross2 | |
# working-directory: '$(modulePath)' | |
# Deploy binaries if enabled in config && not a PR && not a fork | |
if: matrix.deploy && github.head_ref == '' && github.repository == 'et-ness/rclone' | |
- name: Prepare artifact | |
if: success() | |
id: prepareArtifact | |
run: | | |
VER386=`ls -1d build/*main-linux-386* | sed 's/build\/rclone-//' | sed 's/\.main//' | tail -1 | sed 's/386\..*/386/'` && echo "VER386=$VER386" >> $GITHUB_OUTPUT | |
VER386P=`ls -1d build/*main-linux-386* | sed 's/build\/rclone-//' | tail -1 | sed 's/386\..*/386/'` && echo "VER386P=$VER386P" >> $GITHUB_OUTPUT | |
VERX64=`ls -1d build/*main-linux-amd64* | sed 's/build\/rclone-//' | sed 's/\.main//' | tail -1 | sed 's/amd64\..*/amd64/'` && echo "VERX64=$VERX64" >> $GITHUB_OUTPUT | |
VERX64P=`ls -1d build/*main-linux-amd64* | sed 's/build\/rclone-//' | tail -1 | sed 's/amd64\..*/amd64/'` && echo "VERX64P=$VERX64P" >> $GITHUB_OUTPUT | |
- name: Upload linux 386 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepareArtifact.outputs.VER386 }} | |
path: build/rclone-${{ steps.prepareArtifact.outputs.VER386P }}.* | |
- name: Upload linux amd64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepareArtifact.outputs.VERX64 }} | |
path: build/rclone-${{ steps.prepareArtifact.outputs.VERX64P }}.* | |
lint: | |
if: ${{ github.event.inputs.manual == 'true' || (github.repository == 'et-ness/rclone' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)) }} | |
timeout-minutes: 30 | |
name: "lint" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get runner parameters | |
id: get-runner-parameters | |
shell: bash | |
run: | | |
echo "year-week=$(/bin/date -u "+%Y%V")" >> $GITHUB_OUTPUT | |
echo "runner-os-version=$ImageOS" >> $GITHUB_OUTPUT | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Go | |
id: setup-go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.23.0-rc.1' | |
check-latest: true | |
cache: false | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/.cache/golangci-lint | |
key: golangci-lint-${{ steps.get-runner-parameters.outputs.runner-os-version }}-go${{ steps.setup-go.outputs.go-version }}-${{ steps.get-runner-parameters.outputs.year-week }}-${{ hashFiles('go.sum') }} | |
restore-keys: golangci-lint-${{ steps.get-runner-parameters.outputs.runner-os-version }}-go${{ steps.setup-go.outputs.go-version }}-${{ steps.get-runner-parameters.outputs.year-week }}- | |
- name: Code quality test (Linux) | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
skip-cache: true | |
- name: Install govulncheck | |
run: go install golang.org/x/vuln/cmd/govulncheck@latest | |
- name: Scan for vulnerabilities | |
run: govulncheck ./... | |
android: | |
if: ${{ github.event.inputs.manual == 'true' || (github.repository == 'et-ness/rclone' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)) }} | |
timeout-minutes: 30 | |
name: "android-all" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Upgrade together with NDK version | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.23.0-rc.1' | |
- name: Set global environment variables | |
shell: bash | |
run: | | |
echo "VERSION=$(make version)" >> $GITHUB_ENV | |
- name: build native rclone | |
run: | | |
make | |
- name: install gomobile | |
run: | | |
go install golang.org/x/mobile/cmd/gobind@latest | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
env PATH=$PATH:~/go/bin gomobile init | |
echo "RCLONE_NDK_VERSION=21" >> $GITHUB_ENV | |
- name: arm64-v8a Set environment variables | |
shell: bash | |
run: | | |
echo "CC=$(echo $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android${RCLONE_NDK_VERSION}-clang)" >> $GITHUB_ENV | |
echo "CC_FOR_TARGET=$CC" >> $GITHUB_ENV | |
echo 'GOOS=android' >> $GITHUB_ENV | |
echo 'GOARCH=arm64' >> $GITHUB_ENV | |
echo 'CGO_ENABLED=1' >> $GITHUB_ENV | |
echo 'CGO_LDFLAGS=-fuse-ld=lld -s -w' >> $GITHUB_ENV | |
- name: arm64-v8a build | |
run: go build -v -tags android -trimpath -ldflags '-s -X github.com/et-ness/rclone/fs.Version='${VERSION} -o build/rclone-android-${RCLONE_NDK_VERSION}-armv8a/rclone . | |
- name: Upload android arm64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rclone-android-${{ env.RCLONE_NDK_VERSION }}-armv8a | |
path: build/rclone-android-${{ env.RCLONE_NDK_VERSION }}-armv8a/* |