|
| 1 | +name: Build rclone release for Renku |
| 2 | + |
| 3 | +# Trigger the workflow on tag pushes or manually |
| 4 | +on: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - '**' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + timeout-minutes: 60 |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + job_name: ['linux', 'linux_386', 'mac_amd64', 'mac_arm64', 'windows', 'other_os'] |
| 17 | + |
| 18 | + include: |
| 19 | + - job_name: linux |
| 20 | + os: ubuntu-latest |
| 21 | + go: '>=1.23.0-rc.1' |
| 22 | + gotags: cmount |
| 23 | + build_flags: '-include "^linux/"' |
| 24 | + check: true |
| 25 | + quicktest: true |
| 26 | + racequicktest: true |
| 27 | + librclonetest: true |
| 28 | + deploy: true |
| 29 | + |
| 30 | + - job_name: linux_386 |
| 31 | + os: ubuntu-latest |
| 32 | + go: '>=1.23.0-rc.1' |
| 33 | + goarch: 386 |
| 34 | + gotags: cmount |
| 35 | + quicktest: true |
| 36 | + |
| 37 | + - job_name: mac_amd64 |
| 38 | + os: macos-latest |
| 39 | + go: '>=1.23.0-rc.1' |
| 40 | + gotags: 'cmount' |
| 41 | + build_flags: '-include "^darwin/amd64" -cgo' |
| 42 | + quicktest: true |
| 43 | + racequicktest: true |
| 44 | + deploy: true |
| 45 | + |
| 46 | + - job_name: mac_arm64 |
| 47 | + os: macos-latest |
| 48 | + go: '>=1.23.0-rc.1' |
| 49 | + gotags: 'cmount' |
| 50 | + build_flags: '-include "^darwin/arm64" -cgo -macos-arch arm64 -cgo-cflags=-I/usr/local/include -cgo-ldflags=-L/usr/local/lib' |
| 51 | + deploy: true |
| 52 | + |
| 53 | + - job_name: windows |
| 54 | + os: windows-latest |
| 55 | + go: '>=1.23.0-rc.1' |
| 56 | + gotags: cmount |
| 57 | + cgo: '0' |
| 58 | + build_flags: '-include "^windows/"' |
| 59 | + build_args: '-buildmode exe' |
| 60 | + quicktest: true |
| 61 | + deploy: true |
| 62 | + |
| 63 | + - job_name: other_os |
| 64 | + os: ubuntu-latest |
| 65 | + go: '>=1.23.0-rc.1' |
| 66 | + build_flags: '-exclude "^(windows/|darwin/|linux/)"' |
| 67 | + compile_all: true |
| 68 | + deploy: true |
| 69 | + |
| 70 | + name: ${{ matrix.job_name }} |
| 71 | + |
| 72 | + runs-on: ${{ matrix.os }} |
| 73 | + |
| 74 | + steps: |
| 75 | + - name: Checkout |
| 76 | + uses: actions/checkout@v4 |
| 77 | + with: |
| 78 | + fetch-depth: 0 |
| 79 | + |
| 80 | + - name: Install Go |
| 81 | + uses: actions/setup-go@v5 |
| 82 | + with: |
| 83 | + go-version: ${{ matrix.go }} |
| 84 | + check-latest: true |
| 85 | + |
| 86 | + - name: Set environment variables |
| 87 | + shell: bash |
| 88 | + run: | |
| 89 | + echo 'GOTAGS=${{ matrix.gotags }}' >> $GITHUB_ENV |
| 90 | + echo 'BUILD_FLAGS=${{ matrix.build_flags }}' >> $GITHUB_ENV |
| 91 | + echo 'BUILD_ARGS=${{ matrix.build_args }}' >> $GITHUB_ENV |
| 92 | + if [[ "${{ matrix.goarch }}" != "" ]]; then echo 'GOARCH=${{ matrix.goarch }}' >> $GITHUB_ENV ; fi |
| 93 | + if [[ "${{ matrix.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ matrix.cgo }}' >> $GITHUB_ENV ; fi |
| 94 | +
|
| 95 | + - name: Install Libraries on Linux |
| 96 | + shell: bash |
| 97 | + run: | |
| 98 | + sudo modprobe fuse |
| 99 | + sudo chmod 666 /dev/fuse |
| 100 | + sudo chown root:$USER /etc/fuse.conf |
| 101 | + sudo apt-get update |
| 102 | + sudo apt-get install -y fuse3 libfuse-dev rpm pkg-config git-annex git-annex-remote-rclone nfs-common |
| 103 | + if: matrix.os == 'ubuntu-latest' |
| 104 | + |
| 105 | + - name: Install Libraries on macOS |
| 106 | + shell: bash |
| 107 | + run: | |
| 108 | + # https://github.com/Homebrew/brew/issues/15621#issuecomment-1619266788 |
| 109 | + # https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6319008 |
| 110 | + unset HOMEBREW_NO_INSTALL_FROM_API |
| 111 | + brew untap --force homebrew/core |
| 112 | + brew untap --force homebrew/cask |
| 113 | + brew update |
| 114 | + brew install --cask macfuse |
| 115 | + brew install git-annex git-annex-remote-rclone |
| 116 | + if: matrix.os == 'macos-latest' |
| 117 | + |
| 118 | + - name: Install Libraries on Windows |
| 119 | + shell: powershell |
| 120 | + run: | |
| 121 | + $ProgressPreference = 'SilentlyContinue' |
| 122 | + choco install -y winfsp zip |
| 123 | + echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
| 124 | + if ($env:GOARCH -eq "386") { |
| 125 | + choco install -y mingw --forcex86 --force |
| 126 | + echo "C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw32\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 127 | + } |
| 128 | + # Copy mingw32-make.exe to make.exe so the same command line |
| 129 | + # can be used on Windows as on macOS and Linux |
| 130 | + $path = (get-command mingw32-make.exe).Path |
| 131 | + Copy-Item -Path $path -Destination (Join-Path (Split-Path -Path $path) 'make.exe') |
| 132 | + if: matrix.os == 'windows-latest' |
| 133 | + |
| 134 | + - name: Print Go version and environment |
| 135 | + shell: bash |
| 136 | + run: | |
| 137 | + printf "Using go at: $(which go)\n" |
| 138 | + printf "Go version: $(go version)\n" |
| 139 | + printf "\n\nGo environment:\n\n" |
| 140 | + go env |
| 141 | + printf "\n\nRclone environment:\n\n" |
| 142 | + make vars |
| 143 | + printf "\n\nSystem environment:\n\n" |
| 144 | + env |
| 145 | +
|
| 146 | + - name: Build rclone |
| 147 | + shell: bash |
| 148 | + run: | |
| 149 | + make |
| 150 | +
|
| 151 | + - name: Rclone version |
| 152 | + shell: bash |
| 153 | + run: | |
| 154 | + rclone version |
| 155 | +
|
| 156 | + - name: Run tests |
| 157 | + shell: bash |
| 158 | + run: | |
| 159 | + make quicktest |
| 160 | + if: matrix.quicktest |
| 161 | + |
| 162 | + - name: Race test |
| 163 | + shell: bash |
| 164 | + run: | |
| 165 | + make racequicktest |
| 166 | + if: matrix.racequicktest |
| 167 | + |
| 168 | + - name: Run librclone tests |
| 169 | + shell: bash |
| 170 | + run: | |
| 171 | + make -C librclone/ctest test |
| 172 | + make -C librclone/ctest clean |
| 173 | + librclone/python/test_rclone.py |
| 174 | + if: matrix.librclonetest |
| 175 | + |
| 176 | + - name: Compile all architectures test |
| 177 | + shell: bash |
| 178 | + run: | |
| 179 | + make |
| 180 | + make compile_all |
| 181 | + if: matrix.compile_all |
| 182 | + |
| 183 | + - name: Build binaries for release |
| 184 | + shell: bash |
| 185 | + run: | |
| 186 | + if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then make release_dep_linux ; fi |
| 187 | + make ci_gha |
| 188 | + ls -al build/ |
| 189 | + if: matrix.deploy |
| 190 | + |
| 191 | + - name: Upload artifacts to GitHub |
| 192 | + uses: actions/upload-artifact@v4 |
| 193 | + with: |
| 194 | + name: build-${{ matrix.job_name }} |
| 195 | + path: build |
| 196 | + retention-days: 7 |
| 197 | + if: matrix.deploy |
0 commit comments