Skip to content

Commit fa71be8

Browse files
first attempt
1 parent 45e2c43 commit fa71be8

File tree

2 files changed

+12
-190
lines changed

2 files changed

+12
-190
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,7 @@ env:
1010
PYTHON_DEFAULT_VERSION: "3.12"
1111

1212
jobs:
13-
lint:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
19-
- uses: codespell-project/actions-codespell@2391250ab05295bddd51e36a8c6295edb6343b0e
20-
with:
21-
ignore_words_list: datas re-use
22-
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
23-
uses: actions/setup-python@v4
24-
with:
25-
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
26-
- name: Install dependencies
27-
run: python -m pip install --upgrade nox pip setuptools
28-
- name: Run linters
29-
run: nox -vs lint
30-
- name: Validate new changelog entries
31-
if: (contains(github.event.pull_request.labels.*.name, '-changelog') == false) && (github.event.pull_request.base.ref != '')
32-
run: if [ -z "$(git diff --diff-filter=A --name-only origin/${{ github.event.pull_request.base.ref }} changelog.d)" ];
33-
then echo no changelog item added; exit 1; fi
34-
- name: Changelog validation
35-
run: nox -vs towncrier_check
36-
build:
37-
needs: lint
38-
runs-on: ubuntu-latest
39-
steps:
40-
- uses: actions/checkout@v3
41-
with:
42-
fetch-depth: 0
43-
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
44-
uses: actions/setup-python@v4
45-
with:
46-
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
47-
- name: Install dependencies
48-
run: python -m pip install --upgrade nox pip setuptools
49-
- name: Build the distribution
50-
run: nox -vs build >> $GITHUB_OUTPUT
5113
cleanup_buckets:
52-
needs: lint
5314
env:
5415
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
5516
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
@@ -71,169 +32,27 @@ jobs:
7132
- name: Find and remove old buckets
7233
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
7334
run: nox -vs cleanup_buckets
74-
test:
75-
needs: cleanup_buckets
76-
env:
77-
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
78-
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
79-
runs-on: ${{ matrix.os }}
80-
strategy:
81-
fail-fast: false
82-
matrix:
83-
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
84-
# pypy version pin was required due 7.3.13 being broken https://foss.heptapod.net/pypy/pypy/-/issues/4021
85-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.10-nightly"]
86-
exclude:
87-
- os: "macos-latest"
88-
python-version: "pypy-3.10-nightly"
89-
- os: "windows-latest"
90-
python-version: "pypy-3.10-nightly"
91-
steps:
92-
- uses: actions/checkout@v3
93-
with:
94-
fetch-depth: 0
95-
- name: Set up Python ${{ matrix.python-version }}
96-
uses: actions/setup-python@v4
97-
with:
98-
python-version: ${{ matrix.python-version }}
99-
- name: Install dependencies
100-
run: python -m pip install --upgrade nox pip setuptools
101-
- name: Run unit tests
102-
run: nox -vs unit
103-
- name: Run integration tests (without secrets)
104-
run: nox -vs integration -- -m "not require_secrets"
105-
- name: Run integration tests (with secrets)
106-
# Limit CI workload by running integration tests with secrets only on edge Python versions.
107-
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.7", "pypy-3.10-nightly", "3.12"]'), matrix.python-version) }}
108-
run: nox -vs integration -- -m "require_secrets" --cleanup
109-
test-docker:
35+
test-nuitka:
11036
needs: cleanup_buckets
11137
env:
11238
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
11339
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
114-
runs-on: ubuntu-latest
40+
runs-on: macos-latest
11541
steps:
11642
- uses: actions/checkout@v3
11743
with:
11844
fetch-depth: 0
119-
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
45+
- name: Set up Python 3.11
12046
uses: actions/setup-python@v4
12147
with:
122-
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
123-
- name: setup sudo NOX_PYTHONS
124-
run: echo NOX_PYTHONS=$(sudo python3 --version | cut -d ' ' -f 2) >> "$GITHUB_ENV"
125-
- name: Install dependencies
126-
run: sudo python -m pip install --upgrade nox pip setuptools
127-
- name: Generate Dockerfile
128-
run: nox -vs generate_dockerfile
129-
- name: Set up QEMU
130-
uses: docker/setup-qemu-action@v2
131-
- name: Set up Docker Buildx
132-
uses: docker/setup-buildx-action@v2
133-
- name: Build Docker
134-
uses: docker/build-push-action@v5
135-
with:
136-
context: .
137-
load: true
138-
tags: backblazeit/b2:test
139-
platforms: linux/amd64
140-
- name: Run tests with docker
141-
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
142-
run: sudo NOX_PYTHONS=$NOX_PYTHONS B2_TEST_APPLICATION_KEY=${{ env.B2_TEST_APPLICATION_KEY }} B2_TEST_APPLICATION_KEY_ID=${{ env.B2_TEST_APPLICATION_KEY_ID }} nox -vs docker_test -- backblazeit/b2:test
143-
test-linux-bundle:
144-
needs: cleanup_buckets
145-
env:
146-
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
147-
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
148-
runs-on: ubuntu-latest
149-
container:
150-
image: "python:3.12" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here
151-
env:
152-
DEBIAN_FRONTEND: noninteractive
153-
steps:
154-
- uses: actions/checkout@v3
155-
with:
156-
fetch-depth: 0
48+
python-version: 3.11
15749
- name: Install dependencies
15850
run: |
159-
apt-get -y update
160-
apt-get -y install patchelf
161-
python -m pip install --upgrade nox pip setuptools
162-
git config --global --add safe.directory '*'
163-
- name: Bundle the distribution
164-
id: bundle
165-
run: nox -vs bundle >> $GITHUB_OUTPUT
166-
- name: Generate hashes
167-
id: hashes
168-
run: nox -vs make_dist_digest
169-
- name: Run integration tests (without secrets)
170-
run: nox -vs integration -- -m "not require_secrets"
171-
- name: Run integration tests (with secrets)
172-
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
173-
run: nox -vs integration -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup
174-
- name: Upload assets
175-
if: failure()
176-
uses: actions/upload-artifact@v2
177-
with:
178-
path: ${{ steps.bundle.outputs.asset_path }}
179-
if-no-files-found: warn
180-
retention-days: 7
181-
test-windows-bundle:
182-
needs: cleanup_buckets
183-
env:
184-
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
185-
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
186-
runs-on: ${{ matrix.os }}
187-
strategy:
188-
fail-fast: false
189-
matrix:
190-
os: [windows-2019, windows-latest]
191-
steps:
192-
- uses: actions/checkout@v3
193-
with:
194-
fetch-depth: 0
195-
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
196-
uses: actions/setup-python@v4
197-
with:
198-
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
199-
- name: Install dependencies
200-
run: python -m pip install --upgrade nox pip setuptools
201-
- name: Bundle the distribution
51+
python -m pip install --upgrade nox pip setuptools nuitka
52+
python -m pip install .
53+
- name: Build
20254
id: bundle
203-
shell: bash
204-
run: nox -vs bundle >> $GITHUB_OUTPUT
205-
- name: Generate hashes
206-
id: hashes
207-
run: nox -vs make_dist_digest
208-
- name: Run integration tests (without secrets)
209-
run: nox -vs integration -- -m "not require_secrets"
55+
run: python -m nuitka --assume-yes-for-downloads --onefile b2_main.py
21056
- name: Run integration tests (with secrets)
21157
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
212-
run: nox -vs integration -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup
213-
- name: Upload assets
214-
if: failure()
215-
uses: actions/upload-artifact@v2
216-
with:
217-
path: ${{ steps.bundle.outputs.asset_path }}
218-
if-no-files-found: warn
219-
retention-days: 7
220-
doc:
221-
needs: build
222-
runs-on: ubuntu-latest
223-
steps:
224-
- uses: actions/checkout@v3
225-
with:
226-
fetch-depth: 0
227-
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
228-
uses: actions/setup-python@v4
229-
with:
230-
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
231-
- name: Install dependencies
232-
env:
233-
DEBIAN_FRONTEND: noninteractive
234-
run: |
235-
sudo apt-get update -y
236-
sudo apt-get install -y graphviz plantuml
237-
python -m pip install --upgrade nox pip setuptools
238-
- name: Build the docs
239-
run: nox --non-interactive -vs doc
58+
run: nox -vs integration -- --sut="$PWD"b2_main.bin -m "require_secrets" --cleanup

b2_main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import b2.console_tool
2+
3+
b2.console_tool.main()

0 commit comments

Comments
 (0)