|
7 | 7 | push: |
8 | 8 | pull_request: |
9 | 9 | branches: |
10 | | - - master |
11 | | - - api-v2 |
12 | | - - 7.x # TODO: This is temporary and will be removed once we merge this branch to master branch |
| 10 | + - master |
| 11 | + - api-v2 |
| 12 | + - 7.x |
13 | 13 |
|
14 | 14 | env: |
15 | 15 | OUTPUT_DIR: $GITHUB_WORKSPACE/build/outputs |
16 | 16 | OUTPUT_ZIP: b2-sdk-build-${GITHUB_RUN_NUMBER}.zip |
17 | 17 | BUILD_NUMBER: ${{ github.run_number }} |
18 | | - # These are stored in Bitwarden |
19 | 18 | B2_ACCOUNT_ID: ${{ secrets.B2_ACCOUNT_ID }} |
20 | 19 | B2_UPLOAD_BUCKET: ${{ secrets.B2_UPLOAD_BUCKET }} |
21 | 20 | B2_APPLICATION_KEY: ${{ secrets.B2_APPLICATION_KEY }} |
22 | 21 |
|
23 | 22 | jobs: |
24 | 23 | build: |
25 | | - runs-on: ${{ github.repository == 'Backblaze/b2-sdk-java-private' && 'self-hosted'|| 'ubuntu-latest' }} |
| 24 | + runs-on: ${{ github.repository == 'Backblaze/b2-sdk-java-private' && 'self-hosted' || 'ubuntu-latest' }} |
| 25 | + |
26 | 26 | steps: |
27 | 27 | - uses: actions/checkout@v4 |
28 | 28 | with: |
29 | 29 | fetch-depth: 0 |
30 | 30 |
|
31 | 31 | - uses: actions/setup-java@v4 |
32 | 32 | with: |
33 | | - distribution: 'temurin' |
| 33 | + distribution: temurin |
34 | 34 | java-version: '11' |
35 | 35 |
|
36 | 36 | - uses: gradle/actions/wrapper-validation@v4 |
37 | | - - name: Setup Gradle |
38 | | - uses: gradle/actions/setup-gradle@v4 |
| 37 | + - uses: gradle/actions/setup-gradle@v4 |
| 38 | + |
| 39 | + # --- uv + Python 3.13, then create a venv in $RUNNER_TEMP --- |
| 40 | + - name: Set up uv |
| 41 | + uses: astral-sh/setup-uv@v5 |
| 42 | + with: |
| 43 | + enable-cache: false |
39 | 44 |
|
40 | | - - name: Set up Python |
| 45 | + - name: Install Python 3.13 and create venv |
| 46 | + shell: bash |
41 | 47 | run: | |
42 | | - python3.8 -m venv env |
43 | | - source env/bin/activate |
44 | | - echo "VIRTUAL ENV:" $VIRTUAL_ENV |
45 | | - # upgrade pip and setuptools so that b2 CLI can be properly installed |
46 | | - pip install --upgrade pip setuptools |
47 | | - pip install b2 pysqlite3 |
| 48 | + set -euxo pipefail |
| 49 | + uv python install 3.13 |
| 50 | + # Create a throwaway venv for this job |
| 51 | + UV_VENV="$RUNNER_TEMP/py313" |
| 52 | + uv venv "$UV_VENV" |
| 53 | + echo "UV_VENV=$UV_VENV" >> "$GITHUB_ENV" |
| 54 | + # Prove it's 3.13 |
| 55 | + "$UV_VENV/bin/python" --version |
| 56 | +
|
| 57 | + - name: Install Python deps into venv (uv) |
| 58 | + shell: bash |
| 59 | + run: | |
| 60 | + uv pip install --python "$UV_VENV/bin/python" --upgrade pip setuptools wheel |
| 61 | + uv pip install --python "$UV_VENV/bin/python" b2 pysqlite3-binary |
48 | 62 |
|
49 | 63 | - name: Build the distribution |
50 | 64 | run: | |
51 | 65 | $GITHUB_WORKSPACE/gradlew build |
52 | | - # |
53 | | - # Prepare the outputs |
54 | | - # |
55 | | -
|
56 | | - # make the directory |
57 | 66 | mkdir -p ${{ env.OUTPUT_DIR }} |
58 | 67 | cp -v */build/libs/b2-sdk-*.{jar,pom,module} ${{ env.OUTPUT_DIR }} |
59 | | -
|
60 | | - # zip up the outputs |
61 | 68 | cd ${{ env.OUTPUT_DIR }} |
62 | 69 | zip -r $GITHUB_WORKSPACE/build/${{ env.OUTPUT_ZIP }} * |
63 | 70 |
|
|
79 | 86 |
|
80 | 87 | - name: Upload to b2 |
81 | 88 | if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/api-v2' || github.ref == 'refs/heads/7.x' |
82 | | - # upload to b2 (if credentials are provided, as they will be for backblaze's builds, but not pull requests) |
83 | | - # This should be using python 3.8 |
84 | 89 | run: | |
85 | | - source $GITHUB_WORKSPACE/env/bin/activate |
86 | | - $GITHUB_WORKSPACE/maybe_upload_build_results ${{ env.OUTPUT_ZIP }} |
| 90 | + export PATH="$UV_VENV/bin:$PATH" |
| 91 | + "$GITHUB_WORKSPACE/maybe_upload_build_results" "${{ env.OUTPUT_ZIP }}" |
87 | 92 |
|
88 | 93 | - name: Check GitHub Pages status |
89 | 94 | if: github.ref == 'refs/heads/master' |
|
92 | 97 | pages_threshold: major_outage |
93 | 98 |
|
94 | 99 | - name: Deploy Javadoc |
95 | | - # note that i'm only uploading the javadocs for b2-sdk-core. |
96 | | - # that's because i'm lame and building separate javadocs for |
97 | | - # each jar and only uploading one set of javadocs. |
98 | 100 | if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/api-v2' || github.ref == 'refs/heads/7.x') && success() |
99 | 101 | uses: crazy-max/ghaction-github-pages@v3 |
100 | 102 | with: |
|
0 commit comments