mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-17 00:24:26 -04:00
split up workflows more evenly
This commit is contained in:
parent
354fafe8b3
commit
675df49320
3 changed files with 101 additions and 84 deletions
68
.github/workflows/docker.yml
vendored
68
.github/workflows/docker.yml
vendored
|
@ -4,7 +4,64 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE: archivebox-ci
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
recursive: true
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
# TODO: as of 2020-11 this helper layer broke, upgrade and re-enable this once it's usable again
|
||||||
|
# - uses: satackey/action-docker-layer-caching@v0.0.8
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
run: |
|
||||||
|
docker build . -t "$DOCKER_IMAGE"
|
||||||
|
|
||||||
|
- name: Init data dir
|
||||||
|
run: |
|
||||||
|
mkdir data
|
||||||
|
docker run -v "$PWD"/data:/data "$DOCKER_IMAGE" init
|
||||||
|
|
||||||
|
- name: Run test server
|
||||||
|
run: |
|
||||||
|
sudo bash -c 'echo "127.0.0.1 www.test-nginx-1.local www.test-nginx-2.local" >> /etc/hosts'
|
||||||
|
docker run --name www-nginx -p 80:80 -d nginx
|
||||||
|
|
||||||
|
- name: Add link
|
||||||
|
run: |
|
||||||
|
docker run -v "$PWD"/data:/data --network host "$DOCKER_IMAGE" add http://www.test-nginx-1.local
|
||||||
|
|
||||||
|
- name: Add stdin link
|
||||||
|
run: |
|
||||||
|
echo "http://www.test-nginx-2.local" | docker run -i --network host -v "$PWD"/data:/data "$DOCKER_IMAGE" add
|
||||||
|
|
||||||
|
- name: List links
|
||||||
|
run: |
|
||||||
|
docker run -v "$PWD"/data:/data "$DOCKER_IMAGE" list | grep -q "www.test-nginx-1.local" || { echo "The site 1 isn't in the list"; exit 1; }
|
||||||
|
docker run -v "$PWD"/data:/data "$DOCKER_IMAGE" list | grep -q "www.test-nginx-2.local" || { echo "The site 2 isn't in the list"; exit 1; }
|
||||||
|
|
||||||
|
- name: Start docker-compose stack
|
||||||
|
run: |
|
||||||
|
docker-compose run archivebox init
|
||||||
|
docker-compose up -d
|
||||||
|
sleep 5
|
||||||
|
curl --silent --location 'http://127.0.0.1:8000' | grep 'ArchiveBox'
|
||||||
|
curl --silent --location 'http://127.0.0.1:8000/static/admin/js/jquery.init.js' | grep 'window.django'
|
||||||
|
|
||||||
|
- name: Check added urls show up in index
|
||||||
|
run: |
|
||||||
|
docker-compose run archivebox add 'http://example.com/#test_docker' --index-only
|
||||||
|
curl --silent --location 'http://127.0.0.1:8000' | grep 'http://example.com/#test_docker'
|
||||||
|
docker-compose down || true
|
||||||
|
|
||||||
buildx:
|
buildx:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -13,20 +70,29 @@ jobs:
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
recursive: true
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
install: true
|
install: true
|
||||||
|
|
||||||
- name: Builder instance name
|
- name: Builder instance name
|
||||||
run: echo ${{ steps.buildx.outputs.name }}
|
run: echo ${{ steps.buildx.outputs.name }}
|
||||||
|
|
||||||
- name: Available platforms
|
- name: Available platforms
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
|
|
||||||
- name: Cache Docker layers
|
- name: Cache Docker layers
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -34,6 +100,7 @@ jobs:
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
|
@ -50,5 +117,6 @@ jobs:
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
|
31
.github/workflows/lint.yml
vendored
Normal file
31
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
name: 'Lint'
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
env:
|
||||||
|
MAX_LINE_LENGTH: 110
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
recursive: true
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
architecture: x64
|
||||||
|
|
||||||
|
- name: Install flake8
|
||||||
|
run: |
|
||||||
|
pip install flake8
|
||||||
|
|
||||||
|
- name: Lint with flake8
|
||||||
|
run: |
|
||||||
|
# one pass for show-stopper syntax errors or undefined names
|
||||||
|
flake8 archivebox --count --show-source --statistics
|
||||||
|
# one pass for small stylistic things
|
||||||
|
flake8 archivebox --count --max-line-length="$MAX_LINE_LENGTH" --statistics
|
86
.github/workflows/test.yml
vendored
86
.github/workflows/test.yml
vendored
|
@ -1,37 +1,8 @@
|
||||||
name: 'Lint, Test, and Build'
|
name: 'Test'
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
env:
|
|
||||||
MAX_LINE_LENGTH: 110
|
|
||||||
DOCKER_IMAGE: archivebox-ci
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
pytest:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
recursive: true
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: 3.8
|
|
||||||
architecture: x64
|
|
||||||
|
|
||||||
- name: Install flake8
|
|
||||||
run: |
|
|
||||||
pip install flake8
|
|
||||||
|
|
||||||
- name: Lint with flake8
|
|
||||||
run: |
|
|
||||||
# one pass for show-stopper syntax errors or undefined names
|
|
||||||
flake8 archivebox --count --show-source --statistics
|
|
||||||
# one pass for small stylistic things
|
|
||||||
flake8 archivebox --count --max-line-length="$MAX_LINE_LENGTH" --statistics
|
|
||||||
|
|
||||||
test:
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -109,56 +80,3 @@ jobs:
|
||||||
- name: Test built package with pytest
|
- name: Test built package with pytest
|
||||||
run: |
|
run: |
|
||||||
python -m pytest -s
|
python -m pytest -s
|
||||||
|
|
||||||
docker-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
recursive: true
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
# TODO: as of 2020-11 this helper layer broke, upgrade and re-enable this once it's usable again
|
|
||||||
# - uses: satackey/action-docker-layer-caching@v0.0.8
|
|
||||||
|
|
||||||
- name: Build image
|
|
||||||
run: |
|
|
||||||
docker build . -t "$DOCKER_IMAGE"
|
|
||||||
|
|
||||||
- name: Init data dir
|
|
||||||
run: |
|
|
||||||
mkdir data
|
|
||||||
docker run -v "$PWD"/data:/data "$DOCKER_IMAGE" init
|
|
||||||
|
|
||||||
- name: Run test server
|
|
||||||
run: |
|
|
||||||
sudo bash -c 'echo "127.0.0.1 www.test-nginx-1.local www.test-nginx-2.local" >> /etc/hosts'
|
|
||||||
docker run --name www-nginx -p 80:80 -d nginx
|
|
||||||
|
|
||||||
- name: Add link
|
|
||||||
run: |
|
|
||||||
docker run -v "$PWD"/data:/data --network host "$DOCKER_IMAGE" add http://www.test-nginx-1.local
|
|
||||||
|
|
||||||
- name: Add stdin link
|
|
||||||
run: |
|
|
||||||
echo "http://www.test-nginx-2.local" | docker run -i --network host -v "$PWD"/data:/data "$DOCKER_IMAGE" add
|
|
||||||
|
|
||||||
- name: List links
|
|
||||||
run: |
|
|
||||||
docker run -v "$PWD"/data:/data "$DOCKER_IMAGE" list | grep -q "www.test-nginx-1.local" || { echo "The site 1 isn't in the list"; exit 1; }
|
|
||||||
docker run -v "$PWD"/data:/data "$DOCKER_IMAGE" list | grep -q "www.test-nginx-2.local" || { echo "The site 2 isn't in the list"; exit 1; }
|
|
||||||
|
|
||||||
- name: Start docker-compose stack
|
|
||||||
run: |
|
|
||||||
docker-compose run archivebox init
|
|
||||||
docker-compose up -d
|
|
||||||
sleep 5
|
|
||||||
curl --silent --location 'http://127.0.0.1:8000' | grep 'ArchiveBox'
|
|
||||||
curl --silent --location 'http://127.0.0.1:8000/static/admin/js/jquery.init.js' | grep 'window.django'
|
|
||||||
|
|
||||||
- name: Check added urls show up in index
|
|
||||||
run: |
|
|
||||||
docker-compose run archivebox add 'http://example.com/#test_docker' --index-only
|
|
||||||
curl --silent --location 'http://127.0.0.1:8000' | grep 'http://example.com/#test_docker'
|
|
||||||
docker-compose down || true
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue