2019-09-19 10:28:09 +00:00
|
|
|
---
|
|
|
|
# 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:
|
|
|
|
- '*'
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
pull_request:
|
2021-04-26 16:52:03 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
manual:
|
|
|
|
required: true
|
|
|
|
default: true
|
2019-09-19 10:28:09 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2021-04-26 16:52:03 +00:00
|
|
|
if: ${{ github.repository == 'rclone/rclone' || github.event.inputs.manual }}
|
2019-09-19 10:28:09 +00:00
|
|
|
timeout-minutes: 60
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-04-01 16:48:59 +00:00
|
|
|
job_name: ['linux', 'mac_amd64', 'mac_arm64', 'windows_amd64', 'windows_386', 'other_os', 'go1.16', 'go1.17']
|
2019-09-19 10:28:09 +00:00
|
|
|
|
|
|
|
include:
|
|
|
|
- job_name: linux
|
|
|
|
os: ubuntu-latest
|
2022-04-01 16:48:59 +00:00
|
|
|
go: '1.18.x'
|
2019-09-19 10:28:09 +00:00
|
|
|
gotags: cmount
|
|
|
|
build_flags: '-include "^linux/"'
|
|
|
|
check: true
|
|
|
|
quicktest: true
|
2020-07-24 10:44:51 +00:00
|
|
|
racequicktest: true
|
2021-03-30 10:37:59 +00:00
|
|
|
librclonetest: true
|
2019-09-19 10:28:09 +00:00
|
|
|
deploy: true
|
|
|
|
|
2021-02-05 10:20:19 +00:00
|
|
|
- job_name: mac_amd64
|
2022-01-26 17:44:36 +00:00
|
|
|
os: macos-11
|
2022-04-01 16:48:59 +00:00
|
|
|
go: '1.18.x'
|
2020-07-03 20:36:21 +00:00
|
|
|
gotags: 'cmount'
|
2019-09-19 10:28:09 +00:00
|
|
|
build_flags: '-include "^darwin/amd64" -cgo'
|
|
|
|
quicktest: true
|
|
|
|
racequicktest: true
|
|
|
|
deploy: true
|
|
|
|
|
2021-02-05 10:20:19 +00:00
|
|
|
- job_name: mac_arm64
|
2022-01-26 17:44:36 +00:00
|
|
|
os: macos-11
|
2022-04-01 16:48:59 +00:00
|
|
|
go: '1.18.x'
|
2021-02-05 10:20:19 +00:00
|
|
|
gotags: 'cmount'
|
2022-01-26 17:55:38 +00:00
|
|
|
build_flags: '-include "^darwin/arm64" -cgo -macos-arch arm64 -cgo-cflags=-I/usr/local/include -cgo-ldflags=-L/usr/local/lib'
|
2021-02-05 10:20:19 +00:00
|
|
|
deploy: true
|
|
|
|
|
2019-09-19 10:28:09 +00:00
|
|
|
- job_name: windows_amd64
|
|
|
|
os: windows-latest
|
2022-04-01 16:48:59 +00:00
|
|
|
go: '1.18.x'
|
2019-09-19 10:28:09 +00:00
|
|
|
gotags: cmount
|
|
|
|
build_flags: '-include "^windows/amd64" -cgo'
|
2020-11-29 16:52:10 +00:00
|
|
|
build_args: '-buildmode exe'
|
2019-09-19 10:28:09 +00:00
|
|
|
quicktest: true
|
|
|
|
racequicktest: true
|
|
|
|
deploy: true
|
|
|
|
|
|
|
|
- job_name: windows_386
|
|
|
|
os: windows-latest
|
2022-04-01 16:48:59 +00:00
|
|
|
go: '1.18.x'
|
2019-09-19 10:28:09 +00:00
|
|
|
gotags: cmount
|
|
|
|
goarch: '386'
|
|
|
|
cgo: '1'
|
|
|
|
build_flags: '-include "^windows/386" -cgo'
|
2020-11-29 16:52:10 +00:00
|
|
|
build_args: '-buildmode exe'
|
2019-09-19 10:28:09 +00:00
|
|
|
quicktest: true
|
|
|
|
deploy: true
|
|
|
|
|
|
|
|
- job_name: other_os
|
|
|
|
os: ubuntu-latest
|
2022-04-01 16:48:59 +00:00
|
|
|
go: '1.18.x'
|
2021-11-19 17:36:43 +00:00
|
|
|
build_flags: '-exclude "^(windows/(386|amd64)|darwin/|linux/)"'
|
2019-09-19 10:28:09 +00:00
|
|
|
compile_all: true
|
|
|
|
deploy: true
|
|
|
|
|
2022-04-01 16:48:59 +00:00
|
|
|
- job_name: go1.16
|
2021-01-08 12:22:37 +00:00
|
|
|
os: ubuntu-latest
|
2022-04-01 16:48:59 +00:00
|
|
|
go: '1.16.x'
|
2021-01-08 12:22:37 +00:00
|
|
|
quicktest: true
|
|
|
|
racequicktest: true
|
|
|
|
|
2022-04-01 16:48:59 +00:00
|
|
|
- job_name: go1.17
|
2021-08-15 15:42:51 +00:00
|
|
|
os: ubuntu-latest
|
2022-04-01 16:48:59 +00:00
|
|
|
go: '1.17.x'
|
2021-08-15 15:42:51 +00:00
|
|
|
quicktest: true
|
|
|
|
racequicktest: true
|
|
|
|
|
2019-09-19 10:28:09 +00:00
|
|
|
name: ${{ matrix.job_name }}
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2020-07-24 10:44:51 +00:00
|
|
|
uses: actions/checkout@v2
|
2019-09-19 10:28:09 +00:00
|
|
|
with:
|
2020-07-24 10:44:51 +00:00
|
|
|
fetch-depth: 0
|
2019-09-19 10:28:09 +00:00
|
|
|
|
|
|
|
- name: Install Go
|
2020-07-24 10:44:51 +00:00
|
|
|
uses: actions/setup-go@v2
|
2019-09-19 10:28:09 +00:00
|
|
|
with:
|
2020-07-24 10:44:51 +00:00
|
|
|
stable: 'false'
|
2019-09-19 10:28:09 +00:00
|
|
|
go-version: ${{ matrix.go }}
|
2022-03-17 17:14:50 +00:00
|
|
|
check-latest: true
|
2019-09-19 10:28:09 +00:00
|
|
|
|
|
|
|
- name: Set environment variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2020-10-26 11:19:06 +00:00
|
|
|
echo 'GOTAGS=${{ matrix.gotags }}' >> $GITHUB_ENV
|
|
|
|
echo 'BUILD_FLAGS=${{ matrix.build_flags }}' >> $GITHUB_ENV
|
2020-11-29 16:52:10 +00:00
|
|
|
echo 'BUILD_ARGS=${{ matrix.build_args }}' >> $GITHUB_ENV
|
2020-10-26 11:19:06 +00:00
|
|
|
if [[ "${{ matrix.goarch }}" != "" ]]; then echo 'GOARCH=${{ matrix.goarch }}' >> $GITHUB_ENV ; fi
|
|
|
|
if [[ "${{ matrix.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ matrix.cgo }}' >> $GITHUB_ENV ; fi
|
2019-09-19 10:28:09 +00:00
|
|
|
|
|
|
|
- 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 fuse libfuse-dev rpm pkg-config
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
|
|
|
|
- name: Install Libraries on macOS
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
brew update
|
2021-02-05 16:07:59 +00:00
|
|
|
brew install --cask macfuse
|
2022-01-26 17:44:36 +00:00
|
|
|
if: matrix.os == 'macos-11'
|
2019-09-19 10:28:09 +00:00
|
|
|
|
|
|
|
- name: Install Libraries on Windows
|
|
|
|
shell: powershell
|
|
|
|
run: |
|
|
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
|
|
choco install -y winfsp zip
|
2020-10-26 11:19:06 +00:00
|
|
|
echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
2019-09-19 10:28:09 +00:00
|
|
|
if ($env:GOARCH -eq "386") {
|
|
|
|
choco install -y mingw --forcex86 --force
|
2020-10-26 11:19:06 +00:00
|
|
|
echo "C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw32\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
2019-09-19 10:28:09 +00:00
|
|
|
}
|
|
|
|
# Copy mingw32-make.exe to make.exe so the same command line
|
|
|
|
# can be used on Windows as on macOS and Linux
|
|
|
|
$path = (get-command mingw32-make.exe).Path
|
|
|
|
Copy-Item -Path $path -Destination (Join-Path (Split-Path -Path $path) 'make.exe')
|
|
|
|
if: matrix.os == 'windows-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
|
|
|
|
|
2020-07-24 10:44:51 +00:00
|
|
|
- name: Go module cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
|
|
|
- name: Build rclone
|
2019-09-19 10:28:09 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
make
|
2020-07-24 10:44:51 +00:00
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2019-09-19 10:28:09 +00:00
|
|
|
make quicktest
|
|
|
|
if: matrix.quicktest
|
|
|
|
|
|
|
|
- name: Race test
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
make racequicktest
|
|
|
|
if: matrix.racequicktest
|
|
|
|
|
2021-03-30 10:37:59 +00:00
|
|
|
- name: Run librclone tests
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
make -C librclone/ctest test
|
|
|
|
make -C librclone/ctest clean
|
2021-04-28 15:53:35 +00:00
|
|
|
librclone/python/test_rclone.py
|
2021-03-30 10:37:59 +00:00
|
|
|
if: matrix.librclonetest
|
|
|
|
|
2019-09-19 10:28:09 +00:00
|
|
|
- name: Compile all architectures test
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
make
|
|
|
|
make compile_all
|
|
|
|
if: matrix.compile_all
|
|
|
|
|
|
|
|
- name: Deploy built binaries
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2020-06-15 17:27:20 +00:00
|
|
|
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then make release_dep_linux ; fi
|
|
|
|
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then make release_dep_windows ; fi
|
|
|
|
make ci_beta
|
2019-09-19 10:28:09 +00:00
|
|
|
env:
|
|
|
|
RCLONE_CONFIG_PASS: ${{ secrets.RCLONE_CONFIG_PASS }}
|
|
|
|
# working-directory: '$(modulePath)'
|
2020-01-08 17:27:44 +00:00
|
|
|
# Deploy binaries if enabled in config && not a PR && not a fork
|
|
|
|
if: matrix.deploy && github.head_ref == '' && github.repository == 'rclone/rclone'
|
2019-09-25 14:36:19 +00:00
|
|
|
|
2021-10-14 16:23:19 +00:00
|
|
|
lint:
|
|
|
|
if: ${{ github.repository == 'rclone/rclone' || github.event.inputs.manual }}
|
|
|
|
timeout-minutes: 30
|
|
|
|
name: "lint"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Code quality test
|
|
|
|
uses: golangci/golangci-lint-action@v2
|
|
|
|
with:
|
|
|
|
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
|
|
|
version: latest
|
|
|
|
|
2021-03-17 17:00:16 +00:00
|
|
|
android:
|
2021-10-15 11:35:21 +00:00
|
|
|
if: ${{ github.repository == 'rclone/rclone' || github.event.inputs.manual }}
|
|
|
|
timeout-minutes: 30
|
|
|
|
name: "android-all"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
# Upgrade together with NDK version
|
|
|
|
- name: Set up Go 1.16
|
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: 1.16
|
|
|
|
|
|
|
|
# Upgrade together with Go version. Using a GitHub-provided version saves around 2 minutes.
|
|
|
|
- name: Force NDK version
|
|
|
|
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;22.1.7171670" | grep -v = || true
|
|
|
|
|
|
|
|
- name: Go module cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
|
|
|
- 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 get golang.org/x/mobile/cmd/gobind
|
|
|
|
go get golang.org/x/mobile/cmd/gomobile
|
|
|
|
env PATH=$PATH:~/go/bin gomobile init
|
|
|
|
|
|
|
|
- name: arm-v7a gomobile build
|
|
|
|
run: env PATH=$PATH:~/go/bin gomobile bind -v -target=android/arm -javapkg=org.rclone -ldflags '-s -X github.com/rclone/rclone/fs.Version='${VERSION} github.com/rclone/rclone/librclone/gomobile
|
|
|
|
|
|
|
|
- name: arm-v7a Set environment variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "CC=$(echo $ANDROID_HOME/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi16-clang)" >> $GITHUB_ENV
|
|
|
|
echo "CC_FOR_TARGET=$CC" >> $GITHUB_ENV
|
|
|
|
echo 'GOOS=android' >> $GITHUB_ENV
|
|
|
|
echo 'GOARCH=arm' >> $GITHUB_ENV
|
|
|
|
echo 'GOARM=7' >> $GITHUB_ENV
|
|
|
|
echo 'CGO_ENABLED=1' >> $GITHUB_ENV
|
|
|
|
echo 'CGO_LDFLAGS=-fuse-ld=lld -s -w' >> $GITHUB_ENV
|
|
|
|
- name: arm-v7a build
|
|
|
|
run: go build -v -tags android -trimpath -ldflags '-s -X github.com/rclone/rclone/fs.Version='${VERSION} -o build/rclone-android-16-armv7a .
|
|
|
|
|
|
|
|
- name: arm64-v8a Set environment variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "CC=$(echo $ANDROID_HOME/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-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/rclone/rclone/fs.Version='${VERSION} -o build/rclone-android-21-armv8a .
|
|
|
|
|
|
|
|
- name: x86 Set environment variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "CC=$(echo $ANDROID_HOME/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android16-clang)" >> $GITHUB_ENV
|
|
|
|
echo "CC_FOR_TARGET=$CC" >> $GITHUB_ENV
|
|
|
|
echo 'GOOS=android' >> $GITHUB_ENV
|
|
|
|
echo 'GOARCH=386' >> $GITHUB_ENV
|
|
|
|
echo 'CGO_ENABLED=1' >> $GITHUB_ENV
|
|
|
|
echo 'CGO_LDFLAGS=-fuse-ld=lld -s -w' >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: x86 build
|
|
|
|
run: go build -v -tags android -trimpath -ldflags '-s -X github.com/rclone/rclone/fs.Version='${VERSION} -o build/rclone-android-16-x86 .
|
|
|
|
|
|
|
|
- name: x64 Set environment variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "CC=$(echo $ANDROID_HOME/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang)" >> $GITHUB_ENV
|
|
|
|
echo "CC_FOR_TARGET=$CC" >> $GITHUB_ENV
|
|
|
|
echo 'GOOS=android' >> $GITHUB_ENV
|
|
|
|
echo 'GOARCH=amd64' >> $GITHUB_ENV
|
|
|
|
echo 'CGO_ENABLED=1' >> $GITHUB_ENV
|
|
|
|
echo 'CGO_LDFLAGS=-fuse-ld=lld -s -w' >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: x64 build
|
|
|
|
run: go build -v -tags android -trimpath -ldflags '-s -X github.com/rclone/rclone/fs.Version='${VERSION} -o build/rclone-android-21-x64 .
|
|
|
|
|
|
|
|
- name: Upload artifacts
|
|
|
|
run: |
|
|
|
|
make ci_upload
|
|
|
|
env:
|
|
|
|
RCLONE_CONFIG_PASS: ${{ secrets.RCLONE_CONFIG_PASS }}
|
|
|
|
# Upload artifacts if not a PR && not a fork
|
|
|
|
if: github.head_ref == '' && github.repository == 'rclone/rclone'
|