Repository navigation
ci: manual phone build (static aarch64 binary as a run artifact) #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Builds ratclone for the owner's phone (Ubuntu in proot, aarch64), only when it | ||
| # is started by hand. Nothing is published: the binary is kept as a run | ||
| # artifact for 7 days. | ||
| # | ||
| # Start it (from Termux, or anywhere with gh): | ||
| # gh workflow run phone-build.yml -R SyscallBrain/ratclone --ref <branch> | ||
| # gh workflow run phone-build.yml -R SyscallBrain/ratclone --ref <branch> -f checks=false | ||
| # Follow it and fetch the binary from that same run (the newest run of this | ||
| # workflow; gh run download without a run id would ask which run): | ||
| # run=$(gh run list -R SyscallBrain/ratclone -w phone-build.yml -L 1 --json databaseId -q '.[0].databaseId') | ||
| # gh run watch "$run" -R SyscallBrain/ratclone --exit-status | ||
| # gh run download "$run" -R SyscallBrain/ratclone | ||
| # Artifacts are zips, which drop the executable bit, so then: | ||
| # chmod +x ratclone-*/ratclone | ||
| name: Phone build (manual) | ||
|
|
||
| # The only trigger is "Run workflow" / "gh workflow run": no push, | ||
| # pull_request or schedule, so it never starts on its own. | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| checks: | ||
| description: Run fmt, clippy and the tests before building | ||
| type: boolean | ||
| default: true | ||
|
|
||
| permissions: {} | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_VERSION: 1.99.1 | ||
| # Static (musl) binary: runs on any aarch64 Linux, the proot Ubuntu | ||
| # included, whatever its glibc. | ||
| TARGET: aarch64-unknown-linux-musl | ||
|
|
||
| jobs: | ||
| build: | ||
| # Native ARM runner (free on public repos): builds and tests on the | ||
| # phone's architecture, no cross-compiling. | ||
| runs-on: ubuntu-24.04-arm | ||
| timeout-minutes: 45 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Check out source | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Install the Rust toolchain | ||
| run: | | ||
| rustup toolchain install "$RUST_VERSION" --profile minimal \ | ||
| --component rustfmt --component clippy --target "$TARGET" | ||
| rustup default "$RUST_VERSION" | ||
| sudo apt-get update -qq && sudo apt-get install -y -qq musl-tools | ||
|
|
||
| # Keeps ~/.cargo and target/ between runs, so later builds are faster. | ||
| - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 | ||
|
|
||
| - name: Install the current rclone (the tests call it) | ||
| if: inputs.checks | ||
| run: bash scripts/install-test-rclone.sh latest "$RUNNER_TEMP/rclone" | ||
|
|
||
| - name: Format, lints and tests | ||
| if: inputs.checks | ||
| run: | | ||
| export PATH="$RUNNER_TEMP/rclone:$PATH" | ||
| RATCLONE_TEST_RCLONE_VERSION=$(cat "$RUNNER_TEMP/rclone/version") | ||
| export RATCLONE_TEST_RCLONE_VERSION | ||
| cargo fmt --check | ||
| cargo clippy --locked --all-targets -- -D warnings | ||
| cargo test --locked | ||
|
|
||
| - name: Build the static binary | ||
| run: cargo build --release --locked --target "$TARGET" | ||
|
|
||
| - name: Smoke-test and label the binary | ||
| run: | | ||
| bin="target/$TARGET/release/ratclone" | ||
| "$bin" --version | ||
| mkdir out | ||
| cp "$bin" out/ | ||
| short=$(git rev-parse --short HEAD) | ||
| echo "SHORT_SHA=$short" >> "$GITHUB_ENV" | ||
| { | ||
| echo "repo: $GITHUB_REPOSITORY" | ||
| echo "branch: $GITHUB_REF_NAME" | ||
| echo "commit: $(git rev-parse HEAD)" | ||
| echo "run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | ||
| echo "target: $TARGET" | ||
| } > out/BUILD-INFO.txt | ||
| (cd out && sha256sum ratclone > SHA256SUMS && cat SHA256SUMS BUILD-INFO.txt) | ||
|
|
||
| - name: Upload the binary | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: | ||
| name: ratclone-aarch64-${{ env.SHORT_SHA }} | ||
| path: out/ | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.