-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
198 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
images: | ||
linux-images: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
|
@@ -31,6 +31,8 @@ jobs: | |
- env-archlinux | ||
- env-debian | ||
- env-fedora | ||
- env-flutter:android | ||
- env-flutter:linux | ||
- env-opensuse | ||
- env-sphinx | ||
- env-ubuntu:14.04 | ||
|
@@ -47,7 +49,7 @@ jobs: | |
- toolchain-mips-openwrt-linux-atheros | ||
- toolchain-linux-android | ||
|
||
name: ${{ matrix.image }} | ||
name: linux/${{ matrix.image }} | ||
|
||
env: | ||
CACHE_FROM: /tmp/.buildx-cache | ||
|
@@ -63,7 +65,7 @@ jobs: | |
path: ${{ env.CACHE_FROM }} | ||
key: ${{ matrix.image }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ matrix.image }}- | ||
linux-${{ matrix.image }}- | ||
- name: Setup buildx | ||
run: | | ||
|
@@ -81,20 +83,59 @@ jobs: | |
run: | | ||
if [[ $ENABLE_PUSH = 1 ]]; then \ | ||
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
./make.sh --push ${{ matrix.image }} | ||
./make.py --push ${{ matrix.image }} | ||
else | ||
./make.sh ${{ matrix.image }} | ||
./make.py ${{ matrix.image }} | ||
fi | ||
- name: Move cache | ||
if: always() | ||
run: | | ||
rm -rf ${CACHE_FROM} | ||
mv ${CACHE_TO} ${CACHE_FROM} | ||
if [ -e ${CACHE_TO} ]; then | ||
rm -rf ${CACHE_FROM} | ||
mv ${CACHE_TO} ${CACHE_FROM} | ||
fi | ||
- name: Save cache | ||
uses: actions/cache/save@v4 | ||
if: always() | ||
with: | ||
path: ${{ env.CACHE_FROM }} | ||
key: ${{ matrix.image }}-${{ github.sha }} | ||
key: linux-${{ matrix.image }}-${{ github.sha }} | ||
|
||
windows-images: | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
image: | ||
- env-flutter | ||
|
||
name: windows/${{ matrix.image }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup cache | ||
uses: ScribeMD/[email protected] | ||
with: | ||
key: windows-${{ matrix.image }}-${{ github.sha }} | ||
|
||
- name: Setup env | ||
if: | | ||
github.repository_owner == 'roc-streaming' && | ||
github.event_name == 'push' && | ||
github.ref == 'refs/heads/main' | ||
run: | | ||
echo "ENABLE_PUSH=1" >> $GITHUB_ENV | ||
- name: Run docker | ||
run: | | ||
if ($env:ENABLE_PUSH -eq "1") { | ||
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
python make.py --push ${{ matrix.image }} | ||
} else { | ||
python make.py ${{ matrix.image }} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM ghcr.io/cirruslabs/flutter:stable | ||
|
||
RUN find /sdks -type d -exec chmod a+rwx '{}' ';' | ||
RUN find /sdks -type f -exec chmod a+rw '{}' ';' | ||
|
||
RUN find /opt -type d -exec chmod a+rwx '{}' ';' | ||
RUN find /opt -type f -exec chmod a+rw '{}' ';' | ||
|
||
RUN find /root -type d -exec chmod a+rwx '{}' ';' | ||
RUN find /root -type f -exec chmod a+rw '{}' ';' | ||
|
||
USER root | ||
ENV HOME=/root | ||
|
||
RUN git config --global --add safe.directory /sdks/flutter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM openpriv/flutter-desktop:linux-fstable-3.10.2 | ||
|
||
RUN find /sdks -type d -exec chmod a+rwx '{}' ';' | ||
RUN find /sdks -type f -exec chmod a+rw '{}' ';' | ||
|
||
RUN find /opt -type d -exec chmod a+rwx '{}' ';' | ||
RUN find /opt -type f -exec chmod a+rw '{}' ';' | ||
|
||
RUN find /root -type d -exec chmod a+rwx '{}' ';' | ||
RUN find /root -type f -exec chmod a+rw '{}' ';' | ||
|
||
USER root | ||
ENV HOME=/root | ||
|
||
RUN git config --global --add safe.directory /sdks/flutter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FROM openpriv/flutter-desktop:windows-sdk30-fstable-3.10.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DOCKERFILE;ARGS (comma-separated list);TAG;OS | ||
Dockerfile.android;;android;linux | ||
Dockerfile.linux;;linux;linux | ||
Dockerfile.windows;;windows;windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Requirements file used to install latest, which we then freeze. | ||
Sphinx | ||
breathe | ||
mkdocs | ||
Sphinx | ||
sphinxemoji |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import os | ||
import platform | ||
import subprocess | ||
import sys | ||
|
||
DRY_RUN = False | ||
|
||
def run_cmd(*args): | ||
print(f"-- {' '.join(args)}", file=sys.stderr) | ||
if not DRY_RUN: | ||
subprocess.check_call(args) | ||
|
||
def print_msg(msg): | ||
if platform.system() != 'Windows': | ||
print(f'-- \033[1;35m{msg}\033[0m', file=sys.stderr) | ||
else: | ||
print(msg, file=sys.stderr) | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('-n', '--dry-run', action='store_true', help="don't run commands, just print them") | ||
parser.add_argument('-p', '--push', action='store_true', help="push image after building") | ||
parser.add_argument('-C', '--no-cache', action='store_true', help="pass --no-cache to docker build") | ||
parser.add_argument('-P', '--no-pull', action='store_true', help="don't pass --pull to docker build") | ||
parser.add_argument('image', nargs='*', default=None) | ||
|
||
args = parser.parse_args() | ||
|
||
DRY_RUN = args.dry_run | ||
|
||
os.chdir(os.path.dirname(__file__)) | ||
|
||
if args.image: | ||
images = args.image | ||
else: | ||
images = sorted(os.listdir('images')) | ||
|
||
for image in images: | ||
if ':' in image: | ||
image_shortname, image_tag = image.split(':') | ||
else: | ||
image_shortname = image | ||
image_tag = '' | ||
|
||
image_fullname = f'rocstreaming/{image_shortname}' | ||
image_dir = f'images/{image_shortname}' | ||
|
||
os.chdir(image_dir) | ||
|
||
with open('images.csv') as fp: | ||
for n, line in enumerate(fp.readlines()): | ||
if n == 0: | ||
continue | ||
parts = line.strip().split(';') | ||
if len(parts) == 4: | ||
dockerfile, build_args, tag, osname = parts | ||
else: | ||
dockerfile, build_args, tag = parts | ||
osname = 'linux' | ||
|
||
if not dockerfile: | ||
dockerfile = 'Dockerfile' | ||
if not tag: | ||
tag = dockerfile.split('/')[0] | ||
|
||
if '/' in dockerfile: | ||
context = dockerfile.split('/')[0] | ||
else: | ||
context = '.' | ||
|
||
if image_tag and tag != image_tag: | ||
continue | ||
if osname != platform.system().lower(): | ||
continue | ||
|
||
print_msg(f'processing image {image_fullname}:{tag}') | ||
|
||
if platform.system() != 'Windows': | ||
docker_args = ['buildx', 'build', '--output', 'type=docker'] | ||
else: | ||
docker_args = ['build'] | ||
|
||
if not args.no_pull: | ||
docker_args += ['--pull'] | ||
if args.no_cache: | ||
docker_args += ['--no-cache'] | ||
|
||
docker_args += [ | ||
'-f', dockerfile, | ||
'-t', f'{image_fullname}:{tag}', | ||
] | ||
|
||
if build_args: | ||
for arg in build_args.split(','): | ||
docker_args += ['--build-arg', arg.replace(' ', '_')] | ||
|
||
docker_args += [context] | ||
|
||
run_cmd('docker', *docker_args) | ||
|
||
if args.push: | ||
run_cmd('docker', 'push', f'{image_fullname}:{tag}') | ||
|
||
os.chdir('../..') |
Oops, something went wrong.