Skip to content

Commit 3c5c6f9

Browse files
committed
build: add .github/workflows/build-renku.yml
1 parent 2598883 commit 3c5c6f9

1 file changed

Lines changed: 233 additions & 0 deletions

File tree

.github/workflows/build-renku.yml

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
name: Build rclone for Renku
2+
3+
# Trigger the workflow on push or pull request
4+
on:
5+
push:
6+
branches:
7+
- "**"
8+
tags:
9+
- "**"
10+
pull_request:
11+
workflow_dispatch:
12+
inputs:
13+
manual:
14+
description: Manual run (bypass default conditions)
15+
type: boolean
16+
default: true
17+
18+
jobs:
19+
build:
20+
if: inputs.manual || (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)
21+
timeout-minutes: 60
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
job_name: ["linux"]
26+
27+
include:
28+
- job_name: linux
29+
os: ubuntu-latest
30+
go: ">=1.23.0-rc.1"
31+
gotags: cmount
32+
build_flags: '-include "linux/amd64|linux/arm64"'
33+
deploy: true
34+
35+
name: ${{ matrix.job_name }}
36+
37+
runs-on: ${{ matrix.os }}
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Install Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version: ${{ matrix.go }}
49+
check-latest: true
50+
51+
- name: Set environment variables
52+
shell: bash
53+
run: |
54+
echo 'GOTAGS=${{ matrix.gotags }}' >> $GITHUB_ENV
55+
echo 'BUILD_FLAGS=${{ matrix.build_flags }}' >> $GITHUB_ENV
56+
echo 'BUILD_ARGS=${{ matrix.build_args }}' >> $GITHUB_ENV
57+
if [[ "${{ matrix.goarch }}" != "" ]]; then echo 'GOARCH=${{ matrix.goarch }}' >> $GITHUB_ENV ; fi
58+
if [[ "${{ matrix.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ matrix.cgo }}' >> $GITHUB_ENV ; fi
59+
60+
- name: Install Libraries on Linux
61+
shell: bash
62+
run: |
63+
sudo modprobe fuse
64+
sudo chmod 666 /dev/fuse
65+
sudo chown root:$USER /etc/fuse.conf
66+
sudo apt-get update
67+
sudo apt-get install -y fuse3 libfuse-dev rpm pkg-config git-annex git-annex-remote-rclone nfs-common
68+
if: matrix.os == 'ubuntu-latest'
69+
70+
- name: Install Libraries on macOS
71+
shell: bash
72+
run: |
73+
# https://github.com/Homebrew/brew/issues/15621#issuecomment-1619266788
74+
# https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6319008
75+
unset HOMEBREW_NO_INSTALL_FROM_API
76+
brew untap --force homebrew/core
77+
brew untap --force homebrew/cask
78+
brew update
79+
brew install --cask macfuse
80+
brew install git-annex git-annex-remote-rclone
81+
if: matrix.os == 'macos-latest'
82+
83+
- name: Install Libraries on Windows
84+
shell: powershell
85+
run: |
86+
$ProgressPreference = 'SilentlyContinue'
87+
choco install -y winfsp zip
88+
echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
89+
if ($env:GOARCH -eq "386") {
90+
choco install -y mingw --forcex86 --force
91+
echo "C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw32\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
92+
}
93+
# Copy mingw32-make.exe to make.exe so the same command line
94+
# can be used on Windows as on macOS and Linux
95+
$path = (get-command mingw32-make.exe).Path
96+
Copy-Item -Path $path -Destination (Join-Path (Split-Path -Path $path) 'make.exe')
97+
if: matrix.os == 'windows-latest'
98+
99+
- name: Print Go version and environment
100+
shell: bash
101+
run: |
102+
printf "Using go at: $(which go)\n"
103+
printf "Go version: $(go version)\n"
104+
printf "\n\nGo environment:\n\n"
105+
go env
106+
printf "\n\nRclone environment:\n\n"
107+
make vars
108+
printf "\n\nSystem environment:\n\n"
109+
env
110+
111+
- name: Build rclone
112+
shell: bash
113+
run: |
114+
make
115+
116+
- name: Rclone version
117+
shell: bash
118+
run: |
119+
rclone version
120+
121+
- name: Run tests
122+
shell: bash
123+
run: |
124+
make quicktest
125+
if: matrix.quicktest
126+
127+
- name: Race test
128+
shell: bash
129+
run: |
130+
make racequicktest
131+
if: matrix.racequicktest
132+
133+
- name: Run librclone tests
134+
shell: bash
135+
run: |
136+
make -C librclone/ctest test
137+
make -C librclone/ctest clean
138+
librclone/python/test_rclone.py
139+
if: matrix.librclonetest
140+
141+
- name: Compile all architectures test
142+
shell: bash
143+
run: |
144+
make
145+
make compile_all
146+
if: matrix.compile_all
147+
148+
- name: Build binaries for release
149+
shell: bash
150+
run: |
151+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then make release_dep_linux ; fi
152+
make ci_gha
153+
ls -al build/
154+
if: matrix.deploy
155+
156+
- name: Upload artifacts to GitHub
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: build-${{ matrix.job_name }}
160+
path: build
161+
retention-days: 1
162+
if: matrix.deploy
163+
164+
image:
165+
if: inputs.manual || (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)
166+
timeout-minutes: 60
167+
runs-on: ubuntu-latest
168+
needs: [build]
169+
170+
steps:
171+
- name: Checkout
172+
uses: actions/checkout@v4
173+
with:
174+
fetch-depth: 0
175+
176+
- name: Download artifacts
177+
uses: actions/download-artifact@v4
178+
with:
179+
name: build-linux
180+
path: rclone
181+
182+
- name: List downloaded files
183+
run: ls -R rclone
184+
185+
- name: Extract rclone binary - amd64
186+
run: |
187+
unzip "rclone/*-amd64.zip" -d rclone-unzip
188+
ls -R rclone-unzip
189+
mkdir -p linux/amd64
190+
mv rclone-unzip/*/rclone linux/amd64/rclone
191+
- name: Extract rclone binary - arm64
192+
run: |
193+
unzip "rclone/*-arm64.zip" -d rclone-unzip
194+
ls -R rclone-unzip
195+
mkdir -p linux/arm64
196+
mv rclone-unzip/*/rclone linux/arm64/rclone
197+
- name: Docker image metadata
198+
id: meta
199+
uses: docker/metadata-action@v5
200+
with:
201+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
202+
tags: type=sha
203+
204+
- name: Extract Docker image name
205+
id: docker_image
206+
env:
207+
IMAGE_TAGS: ${{ steps.meta.outputs.tags }}
208+
run: |
209+
IMAGE=$(echo "$IMAGE_TAGS" | cut -d" " -f1)
210+
IMAGE_REPOSITORY=$(echo "$IMAGE" | cut -d":" -f1)
211+
IMAGE_TAG=$(echo "$IMAGE" | cut -d":" -f2)
212+
echo "image=$IMAGE" >> "$GITHUB_OUTPUT"
213+
echo "image_repository=$IMAGE_REPOSITORY" >> "$GITHUB_OUTPUT"
214+
echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
215+
- name: Set up Docker buildx
216+
uses: docker/setup-buildx-action@v3
217+
218+
- name: Set up Docker
219+
uses: docker/login-action@v3
220+
with:
221+
registry: ${{ env.REGISTRY }}
222+
username: ${{ github.actor }}
223+
password: ${{ secrets.GITHUB_TOKEN }}
224+
225+
- name: Build and push Docker image
226+
uses: docker/build-push-action@v6
227+
with:
228+
context: .
229+
file: .renku/Dockerfile
230+
platforms: linux/amd64,linux/arm64
231+
push: true
232+
tags: ${{ steps.meta.outputs.tags }}
233+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)