2019-09-19 12:28:09 +02: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:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
timeout-minutes: 60
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-02-05 11:20:19 +01:00
|
|
|
job_name: ['linux', 'mac_amd64', 'mac_arm64', 'windows_amd64', 'windows_386', 'other_os', 'go1.13', 'go1.14', 'go1.15']
|
2019-09-19 12:28:09 +02:00
|
|
|
|
|
|
|
include:
|
|
|
|
- job_name: linux
|
|
|
|
os: ubuntu-latest
|
2021-02-17 01:37:30 +01:00
|
|
|
go: '1.16.x'
|
2019-09-19 12:28:09 +02:00
|
|
|
gotags: cmount
|
|
|
|
build_flags: '-include "^linux/"'
|
|
|
|
check: true
|
|
|
|
quicktest: true
|
2020-07-24 12:44:51 +02:00
|
|
|
racequicktest: true
|
2019-09-19 12:28:09 +02:00
|
|
|
deploy: true
|
|
|
|
|
2021-02-05 11:20:19 +01:00
|
|
|
- job_name: mac_amd64
|
2019-09-19 12:28:09 +02:00
|
|
|
os: macOS-latest
|
2021-02-17 01:37:30 +01:00
|
|
|
go: '1.16.x'
|
2020-07-03 22:36:21 +02:00
|
|
|
gotags: 'cmount'
|
2019-09-19 12:28:09 +02:00
|
|
|
build_flags: '-include "^darwin/amd64" -cgo'
|
|
|
|
quicktest: true
|
|
|
|
racequicktest: true
|
|
|
|
deploy: true
|
|
|
|
|
2021-02-05 11:20:19 +01:00
|
|
|
- job_name: mac_arm64
|
|
|
|
os: macOS-latest
|
2021-02-17 01:37:30 +01:00
|
|
|
go: '1.16.x'
|
2021-02-05 11:20:19 +01:00
|
|
|
gotags: 'cmount'
|
|
|
|
build_flags: '-include "^darwin/arm64" -cgo -macos-arch arm64 -macos-sdk macosx11.1 -cgo-cflags=-I/usr/local/include -cgo-ldflags=-L/usr/local/lib'
|
|
|
|
deploy: true
|
|
|
|
|
2019-09-19 12:28:09 +02:00
|
|
|
- job_name: windows_amd64
|
|
|
|
os: windows-latest
|
2021-02-17 01:37:30 +01:00
|
|
|
go: '1.16.x'
|
2019-09-19 12:28:09 +02:00
|
|
|
gotags: cmount
|
|
|
|
build_flags: '-include "^windows/amd64" -cgo'
|
2020-11-29 17:52:10 +01:00
|
|
|
build_args: '-buildmode exe'
|
2019-09-19 12:28:09 +02:00
|
|
|
quicktest: true
|
|
|
|
racequicktest: true
|
|
|
|
deploy: true
|
|
|
|
|
|
|
|
- job_name: windows_386
|
|
|
|
os: windows-latest
|
2021-02-17 01:37:30 +01:00
|
|
|
go: '1.16.x'
|
2019-09-19 12:28:09 +02:00
|
|
|
gotags: cmount
|
|
|
|
goarch: '386'
|
|
|
|
cgo: '1'
|
|
|
|
build_flags: '-include "^windows/386" -cgo'
|
2020-11-29 17:52:10 +01:00
|
|
|
build_args: '-buildmode exe'
|
2019-09-19 12:28:09 +02:00
|
|
|
quicktest: true
|
|
|
|
deploy: true
|
|
|
|
|
|
|
|
- job_name: other_os
|
|
|
|
os: ubuntu-latest
|
2021-02-17 01:37:30 +01:00
|
|
|
go: '1.16.x'
|
2021-02-05 11:20:19 +01:00
|
|
|
build_flags: '-exclude "^(windows/|darwin/|linux/)"'
|
2019-09-19 12:28:09 +02:00
|
|
|
compile_all: true
|
|
|
|
deploy: true
|
|
|
|
|
2020-02-26 22:17:06 +01:00
|
|
|
- job_name: go1.13
|
|
|
|
os: ubuntu-latest
|
|
|
|
go: '1.13.x'
|
|
|
|
quicktest: true
|
|
|
|
|
2020-08-09 11:38:02 +02:00
|
|
|
- job_name: go1.14
|
2020-07-24 12:44:51 +02:00
|
|
|
os: ubuntu-latest
|
2020-08-09 11:38:02 +02:00
|
|
|
go: '1.14.x'
|
2020-07-24 12:44:51 +02:00
|
|
|
quicktest: true
|
|
|
|
racequicktest: true
|
|
|
|
|
2021-02-04 10:01:36 +01:00
|
|
|
- job_name: go1.15
|
2021-01-08 13:22:37 +01:00
|
|
|
os: ubuntu-latest
|
2021-02-04 10:01:36 +01:00
|
|
|
go: '1.15.x'
|
2021-01-08 13:22:37 +01:00
|
|
|
quicktest: true
|
|
|
|
racequicktest: true
|
|
|
|
|
2019-09-19 12:28:09 +02:00
|
|
|
name: ${{ matrix.job_name }}
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2020-07-24 12:44:51 +02:00
|
|
|
uses: actions/checkout@v2
|
2019-09-19 12:28:09 +02:00
|
|
|
with:
|
2020-07-24 12:44:51 +02:00
|
|
|
fetch-depth: 0
|
2019-09-19 12:28:09 +02:00
|
|
|
|
|
|
|
- name: Install Go
|
2020-07-24 12:44:51 +02:00
|
|
|
uses: actions/setup-go@v2
|
2019-09-19 12:28:09 +02:00
|
|
|
with:
|
2020-07-24 12:44:51 +02:00
|
|
|
stable: 'false'
|
2019-09-19 12:28:09 +02:00
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Set environment variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2020-10-26 12:19:06 +01:00
|
|
|
echo 'GOTAGS=${{ matrix.gotags }}' >> $GITHUB_ENV
|
|
|
|
echo 'BUILD_FLAGS=${{ matrix.build_flags }}' >> $GITHUB_ENV
|
2020-11-29 17:52:10 +01:00
|
|
|
echo 'BUILD_ARGS=${{ matrix.build_args }}' >> $GITHUB_ENV
|
2020-10-26 12:19:06 +01: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 12:28:09 +02: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 17:07:59 +01:00
|
|
|
brew install --cask macfuse
|
2019-09-19 12:28:09 +02:00
|
|
|
if: matrix.os == 'macOS-latest'
|
|
|
|
|
|
|
|
- name: Install Libraries on Windows
|
|
|
|
shell: powershell
|
|
|
|
run: |
|
|
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
|
|
choco install -y winfsp zip
|
2020-10-26 12:19:06 +01: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 12:28:09 +02:00
|
|
|
if ($env:GOARCH -eq "386") {
|
|
|
|
choco install -y mingw --forcex86 --force
|
2020-10-26 12:19:06 +01:00
|
|
|
echo "C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw32\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
2019-09-19 12:28:09 +02: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 12:44:51 +02: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 12:28:09 +02:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
make
|
2020-07-24 12:44:51 +02:00
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2019-09-19 12:28:09 +02:00
|
|
|
make quicktest
|
|
|
|
if: matrix.quicktest
|
|
|
|
|
|
|
|
- name: Race test
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
make racequicktest
|
|
|
|
if: matrix.racequicktest
|
|
|
|
|
|
|
|
- name: Code quality test
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
make build_dep
|
|
|
|
make check
|
|
|
|
if: matrix.check
|
|
|
|
|
|
|
|
- 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 19:27:20 +02: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 12:28:09 +02:00
|
|
|
env:
|
|
|
|
RCLONE_CONFIG_PASS: ${{ secrets.RCLONE_CONFIG_PASS }}
|
|
|
|
# working-directory: '$(modulePath)'
|
2020-01-08 18:27:44 +01: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 16:36:19 +02:00
|
|
|
|
|
|
|
xgo:
|
|
|
|
timeout-minutes: 60
|
|
|
|
name: "xgo cross compile"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
2019-12-04 14:48:03 +01:00
|
|
|
uses: actions/checkout@v1
|
2019-09-25 16:36:19 +02:00
|
|
|
with:
|
2020-01-08 18:27:44 +01:00
|
|
|
# Checkout into a fixed path to avoid import path problems on go < 1.11
|
|
|
|
path: ./src/github.com/rclone/rclone
|
2019-09-25 16:36:19 +02:00
|
|
|
|
|
|
|
- name: Set environment variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2020-10-26 12:19:06 +01:00
|
|
|
echo 'GOPATH=${{ runner.workspace }}' >> $GITHUB_ENV
|
|
|
|
echo '${{ runner.workspace }}/bin' >> $GITHUB_PATH
|
2019-09-25 16:36:19 +02:00
|
|
|
|
|
|
|
- name: Cross-compile rclone
|
|
|
|
run: |
|
|
|
|
docker pull billziss/xgo-cgofuse
|
2020-06-02 14:41:36 +02:00
|
|
|
GO111MODULE=off go get -v github.com/karalabe/xgo # don't add to go.mod
|
2020-06-29 15:51:16 +02:00
|
|
|
# xgo \
|
|
|
|
# -image=billziss/xgo-cgofuse \
|
2020-08-09 13:59:17 +02:00
|
|
|
# -targets=darwin/amd64,linux/386,linux/amd64,windows/386,windows/amd64 \
|
2020-06-29 15:51:16 +02:00
|
|
|
# -tags cmount \
|
|
|
|
# -dest build \
|
|
|
|
# .
|
2019-09-25 16:36:19 +02:00
|
|
|
xgo \
|
|
|
|
-image=billziss/xgo-cgofuse \
|
|
|
|
-targets=android/*,ios/* \
|
|
|
|
-dest build \
|
|
|
|
.
|
|
|
|
|
|
|
|
- name: Build rclone
|
2020-07-24 12:44:51 +02:00
|
|
|
shell: bash
|
2019-09-25 16:36:19 +02:00
|
|
|
run: |
|
2020-07-24 12:44:51 +02:00
|
|
|
make
|
2019-09-25 16:36:19 +02:00
|
|
|
|
|
|
|
- name: Upload artifacts
|
|
|
|
run: |
|
2020-06-15 21:20:25 +02:00
|
|
|
make ci_upload
|
2019-09-25 16:36:19 +02:00
|
|
|
env:
|
|
|
|
RCLONE_CONFIG_PASS: ${{ secrets.RCLONE_CONFIG_PASS }}
|
2020-01-08 18:27:44 +01:00
|
|
|
# Upload artifacts if not a PR && not a fork
|
|
|
|
if: github.head_ref == '' && github.repository == 'rclone/rclone'
|