Skip to content

Commit 00e7788

Browse files
first attempt
1 parent 45e2c43 commit 00e7788

2 files changed

Lines changed: 52 additions & 220 deletions

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -10,230 +10,59 @@ 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
51-
cleanup_buckets:
52-
needs: lint
53-
env:
54-
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
55-
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
56-
runs-on: ubuntu-latest
57-
steps:
58-
- uses: actions/checkout@v3
59-
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
60-
with:
61-
fetch-depth: 0
62-
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
63-
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
64-
uses: actions/setup-python@v4
65-
with:
66-
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
67-
cache: "pip"
68-
- name: Install dependencies
69-
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
70-
run: python -m pip install --upgrade nox pip setuptools
71-
- name: Find and remove old buckets
72-
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
73-
run: nox -vs cleanup_buckets
74-
test:
75-
needs: cleanup_buckets
13+
test-paths:
7614
env:
7715
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
7816
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"
17+
runs-on: macos-latest
9118
steps:
9219
- uses: actions/checkout@v3
9320
with:
9421
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:
110-
needs: cleanup_buckets
111-
env:
112-
B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
113-
B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
114-
runs-on: ubuntu-latest
115-
steps:
116-
- uses: actions/checkout@v3
117-
with:
118-
fetch-depth: 0
119-
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
120-
uses: actions/setup-python@v4
121-
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
157-
- name: Install dependencies
158-
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
202-
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"
210-
- name: Run integration tests (with secrets)
211-
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
22+
- run: echo "$PWD"/b2_main.py
23+
# cleanup_buckets:
24+
# env:
25+
# B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
26+
# B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
27+
# runs-on: ubuntu-latest
28+
# steps:
29+
# - uses: actions/checkout@v3
30+
# if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
31+
# with:
32+
# fetch-depth: 0
33+
# - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
34+
# if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
35+
# uses: actions/setup-python@v4
36+
# with:
37+
# python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
38+
# cache: "pip"
39+
# - name: Install dependencies
40+
# if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
41+
# run: python -m pip install --upgrade nox pip setuptools
42+
# - name: Find and remove old buckets
43+
# if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead
44+
# run: nox -vs cleanup_buckets
45+
# test-nuitka:
46+
# needs: cleanup_buckets
47+
# env:
48+
# B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }}
49+
# B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }}
50+
# runs-on: macos-latest
51+
# steps:
52+
# - uses: actions/checkout@v3
53+
# with:
54+
# fetch-depth: 0
55+
# - name: Set up Python 3.11
56+
# uses: actions/setup-python@v4
57+
# with:
58+
# python-version: 3.11
59+
# - name: Install dependencies
60+
# run: |
61+
# python -m pip install --upgrade nox pip setuptools nuitka
62+
# python -m pip install .
63+
# - name: Build
64+
# id: bundle
65+
# run: python -m nuitka --onefile b2_main.py
66+
# - name: Run integration tests (with secrets)
67+
# if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
68+
# run: nox -vs integration -- --sut=`realpath 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)