mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-02 01:18:08 +01:00
Modify GH actions to support mirror
This commit is contained in:
parent
7d50a224c6
commit
ba89224641
2 changed files with 28 additions and 27 deletions
46
.github/workflows/bwrap.yml
vendored
46
.github/workflows/bwrap.yml
vendored
|
|
@ -32,20 +32,24 @@ jobs:
|
|||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
mirror
|
||||
mirror-state
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
restore-keys: |
|
||||
cache-
|
||||
- name: Get sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: ./download-distfiles.sh
|
||||
run: mkdir -p mirror mirror-state && ./mirror.sh mirror mirror-state
|
||||
- name: Cache sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
mirror
|
||||
mirror-state
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
- name: Run bootstrap
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass1
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass1 --mirror file://${PWD}/mirror
|
||||
- name: Archive created packages
|
||||
if: failure() # archive failed builds progress
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
@ -87,18 +91,12 @@ jobs:
|
|||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
- name: Get sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: ./download-distfiles.sh
|
||||
- name: Cache sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
mirror
|
||||
mirror-state
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
fail-on-cache-miss: true
|
||||
- name: Copy distfiles
|
||||
run: ./download-distfiles.sh file:///${PWD}/mirror
|
||||
- name: Run bootstrap
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass2
|
||||
- name: Archive created packages
|
||||
|
|
@ -142,20 +140,14 @@ jobs:
|
|||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
- name: Get sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: ./download-distfiles.sh
|
||||
- name: Cache sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
mirror
|
||||
mirror-state
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
fail-on-cache-miss: true
|
||||
- name: Copy distfiles
|
||||
run: ./download-distfiles.sh file:///${PWD}/mirror
|
||||
- name: Run bootstrap
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass3
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass3 --mirror file://${PWD}/mirror
|
||||
- name: Archive created packages
|
||||
if: always() # archive both failed and successful builds
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
|
|||
|
|
@ -1,13 +1,22 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
This creates a simple "mirror" from a directory
|
||||
"""
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2025 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
import http.server
|
||||
import socketserver
|
||||
|
||||
class SimpleMirror(socketserver.TCPServer):
|
||||
"""Simple HTTP mirror from a directory"""
|
||||
def __init__(self, directory: str):
|
||||
self.directory = directory
|
||||
super().__init__(("localhost", 0), self._handler)
|
||||
|
||||
@property
|
||||
def port(self):
|
||||
"""Port the HTTP server of the mirror is running on"""
|
||||
return self.server_address[1]
|
||||
|
||||
def _handler(self, *args, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue