-
Notifications
You must be signed in to change notification settings - Fork 2
199 lines (172 loc) · 5.62 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
---
# Github Actions publish for rclone
# -*- compile-command: "yamllint -f parsable publish.yml" -*-
name: publish
# Trigger the workflow on push or pull request
on:
push:
# branches:
# - "*"
tags:
- "*"
pull_request:
jobs:
publish:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
job_name: ["linux", "mac", "windows", "other_os", "go1.17"]
include:
- job_name: linux
os: ubuntu-latest
go: "1.17.x"
gotags: cmount
build_flags: '-include "^linux/"'
check: true
quicktest: true
racequicktest: true
deploy: true
publish: true
- job_name: mac
os: macOS-latest
go: "1.17.x"
gotags: "cmount"
build_flags: '-include "^darwin/amd64" -cgo'
quicktest: true
racequicktest: true
deploy: true
publish: true
- job_name: windows
os: windows-latest
go: "1.17.x"
gotags: cmount
build_flags: '-include "^windows/amd64" -cgo'
build_args: "-buildmode exe"
quicktest: true
racequicktest: true
deploy: true
publish: true
- job_name: other_os
os: ubuntu-latest
go: "1.17.x"
build_flags: '-exclude "^(windows/|darwin/amd64|linux/)"'
compile_all: true
deploy: true
publish: false
- job_name: go1.17
os: ubuntu-latest
go: "1.17.x"
quicktest: true
racequicktest: true
publish: false
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Install Go
uses: actions/setup-go@v2
with:
stable: "false"
go-version: ${{ matrix.go }}
- 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 fuse libfuse-dev rpm pkg-config
if: matrix.os == 'ubuntu-latest'
- name: Install Libraries on macOS
shell: bash
run: |
brew update
brew install --cask osxfuse
if: matrix.os == 'macOS-latest'
- name: Install Libraries on Windows
shell: powershell
run: |
$ProgressPreference = 'SilentlyContinue'
choco install -y winfsp zip
echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
if ($env:GOARCH -eq "386") {
choco install -y mingw --forcex86 --force
echo "C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw32\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
# 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 -C rclone vars
printf "\n\nSystem environment:\n\n"
env
- name: Apply patch
shell: bash
run: |
make patch
# - 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
shell: bash
run: |
make -C rclone
# - name: Run tests
# shell: bash
# run: |
# 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 -C rclone
if: matrix.compile_all
- name: Make publish
shell: bash
run: |
make publish
if: matrix.publish == true && github.event_name != 'pull_request'
- name: Upload release binaries
uses: alexellis/upload-assets@0.2.2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["./rclone_*"]'
if: matrix.publish == true && github.event_name != 'pull_request'