Skip to content

Commit

Permalink
feat: implement gh action for running basic tests (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barabazs authored Jun 7, 2024
1 parent 6c14185 commit 8c30dcb
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: test

on:
push:
branches-ignore:
- "main"

permissions:
contents: read

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: setup.py
- name: Install dependencies
run: |
python -m pip install poetry
poetry install
- name: Ubuntu keyring setup
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: t1m0thyj/unlock-keyring@v1
- name: MacOS keychain setup
if: ${{ matrix.os == 'macos-latest' }}
run: |
security create-keychain -p "" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "" build.keychain
- name: Run tests
run: |
poetry run archivooor
poetry run archivooor keys set test_value test_secret
poetry run archivooor keys delete
18 changes: 9 additions & 9 deletions archivooor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ def cli(ctx):
Submit webpages to the Wayback Machine and check the save job status.
"""
credentials = key_utils.get_credentials()

archive = archiver.Archiver(
s3_access_key=credentials[0],
s3_secret_key=credentials[1],
)
if credentials is not None:
archive = archiver.Archiver(
s3_access_key=credentials[0],
s3_secret_key=credentials[1],
)
else:
archive = archiver.Archiver(s3_access_key=None, s3_secret_key=None)
ctx.obj = archive


Expand Down Expand Up @@ -79,10 +81,8 @@ def job(job_id, verbose):
else:
click.echo(f"status: {job_response.get('status')}")
click.echo(f"original_url: {job_response.get('original_url')}")
click.echo(
f"outlinks_saved: {len(job_response.get('outlinks')) if \
job_response.get('outlinks') else 0}"
)
outlinks = job_response.get("outlinks")
click.echo(f"outlinks_saved: {len(outlinks) if outlinks else 0}")


@cli.command(name="stats")
Expand Down

0 comments on commit 8c30dcb

Please sign in to comment.