mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-16 21:53:17 +00:00
add ci pipeline
This commit is contained in:
parent
d369e05082
commit
1073447e73
33
.drone.yml
33
.drone.yml
|
@ -1,18 +1,21 @@
|
|||
#kind: pipeline
|
||||
#type: exec
|
||||
#name: Continuous Integration
|
||||
#
|
||||
#steps:
|
||||
#
|
||||
#trigger:
|
||||
# event:
|
||||
# - push
|
||||
# - pull_request
|
||||
#
|
||||
#node:
|
||||
# server: builder
|
||||
#
|
||||
#---
|
||||
kind: pipeline
|
||||
type: exec
|
||||
name: Continuous Integration
|
||||
|
||||
steps:
|
||||
- name: Build
|
||||
commands:
|
||||
- ./ci.py --run-ci-build
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
node:
|
||||
server: builder
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: exec
|
||||
|
|
23
ci.py
23
ci.py
|
@ -35,6 +35,12 @@ def podman_online(dir, *args):
|
|||
CONTAINER_IMAGE, "bash", "-c", ' '.join(args)
|
||||
])
|
||||
|
||||
def podman_ci(dir, *args):
|
||||
subprocess.run(["podman", "run", "-it", "--rm", "--privileged", f"--workdir={dir}",
|
||||
"-v", os.getcwd() + f":{CONTAINER_HOME}/src:U",
|
||||
CONTAINER_IMAGE, "bash", "-c", ' '.join(args)
|
||||
])
|
||||
|
||||
# Targets
|
||||
|
||||
def build_linux():
|
||||
|
@ -85,12 +91,14 @@ def deploy_gitea_release():
|
|||
"--asset", f"{HOST_MOUNTED_VOLUME}/{APP_NAME}-{APP_SEMVER}.tar.zstd"])
|
||||
|
||||
def deploy_fdroid_repo():
|
||||
# subprocess.run(["eval $(ssh-agent -s)"], shell=True)
|
||||
# subprocess.run(["echo \"$SSH_PRIVATE_KEY\" | tr -d '\r' | ssh-add -"], shell=True)
|
||||
# subprocess.run(["scp", "-oStrictHostKeyChecking=no", "-oUserKnownHostsFile=/dev/null",
|
||||
# "-r", f"{HOST_HOME}/fdroid/repo/*",
|
||||
# "deployer@selfprivacy.org:/var/www/fdroid.selfprivacy.org"])
|
||||
subprocess.run([f"eval $(ssh-agent -s) && echo \"$SSH_PRIVATE_KEY\" | tr -d '\r' | ssh-add - && scp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -r {HOST_HOME}/fdroid/repo/* deployer@selfprivacy.org:/var/www/fdroid.selfprivacy.org"], shell=True)
|
||||
subprocess.run([f"""eval $(ssh-agent -s) &&
|
||||
echo \"$SSH_PRIVATE_KEY\" | tr -d '\r' | ssh-add - &&
|
||||
scp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -r {HOST_HOME}/fdroid/repo/* deployer@selfprivacy.org:/var/www/fdroid.selfprivacy.org
|
||||
"""], shell=True)
|
||||
|
||||
def run_ci_build():
|
||||
podman_ci(f"{CONTAINER_HOME}/src", "flutter build linux --debug")
|
||||
podman_ci(f"{CONTAINER_HOME}/src", "flutter build apk --debug")
|
||||
|
||||
# Arguments
|
||||
|
||||
|
@ -106,6 +114,7 @@ if __name__ == "__main__":
|
|||
group.add_argument("--package-linux-archive", action="store_true")
|
||||
group.add_argument("--deploy-gitea-release", action="store_true")
|
||||
group.add_argument("--deploy-fdroid-repo", action="store_true")
|
||||
group.add_argument("--run-ci-build", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.build_linux:
|
||||
|
@ -126,3 +135,5 @@ elif args.deploy_gitea_release:
|
|||
deploy_gitea_release()
|
||||
elif args.deploy_fdroid_repo:
|
||||
deploy_fdroid_repo()
|
||||
elif args.run_ci_build:
|
||||
run_ci_build()
|
||||
|
|
Loading…
Reference in a new issue