Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub actions #12

Merged
merged 8 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/github-actions-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Checks
run-name: Checking ${{ github.ref }}
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel

- name: bazel build
run: |
bazel build ...

- name: bazel test
run: |
bazel test ...
51 changes: 51 additions & 0 deletions .github/workflows/github-actions-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release
run-name: Releasing ${{ github.ref }}

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel

- name: bazel test
run: |
bazel test ...

- name: bazel build :oofork
run: |
bazel build :oofork

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./bazel-bin/onlyoffice-editor.tar.gz
asset_name: onlyoffice-editor.tar.gz
asset_content_type: application/zip
12 changes: 4 additions & 8 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
load("@rules_gzip//gzip/compress:defs.bzl", "gzip_compress")

Expand All @@ -25,9 +26,9 @@ pkg_files(
strip_prefix = strip_prefix.from_pkg("make"),
)

pkg_tar(
name = "oofork-tar",
package_file_name = "onlyoffice-editor.tar",
pkg_zip(
name = "oofork",
package_file_name = "onlyoffice-editor.zip",
srcs = [
"//:editor-in-fork",
"//:client-in-fork",
Expand All @@ -37,11 +38,6 @@ pkg_tar(
visibility = ["//visibility:public"],
)

gzip_compress(
name = "oofork",
src = "//:oofork-tar",
)

sh_test( # TODO can I use this here? https://docs.aspect.build/rulesets/aspect_bazel_lib/docs/testing#assert_directory_contains
name = "oofork-files-test",
size = "small",
Expand Down
77 changes: 39 additions & 38 deletions docker/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_pkg//pkg:mappings.bzl", "strip_prefix")
load("@rules_tar//tar/unpack:defs.bzl", "tar_unpack")

tar_unpack(
name = "oofork-tar-files",
src = "//:oofork-tar",
)

pkg_tar(
name = "oofork-docker-tar",
package_file_name = "onlyoffice-editor-docker.tar",
srcs = [
":oofork-tar-files",
],
strip_prefix = strip_prefix.from_pkg("oofork-tar-files"),
package_dir = "var/www/onlyoffice/documentserver/"
)

oci_image(
name = "image",
base = "@onlyoffice-documentserver",
tars = [ ":oofork-docker-tar" ],
)

oci_load(
name = "load",
image = ":image",
repo_tags = ["cp-documentserver:latest"],
)

filegroup(
name = "image-tarball",
srcs=[':load'],
output_group = 'tarball',
visibility = ["//visibility:public"],
)
# TODO remove this when we are sure we do not need to build docker images
# load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
# load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
# load("@rules_pkg//pkg:mappings.bzl", "strip_prefix")
# load("@rules_tar//tar/unpack:defs.bzl", "tar_unpack")
#
# tar_unpack(
# name = "oofork-tar-files",
# src = "//:oofork-tar",
# )
#
# pkg_tar(
# name = "oofork-docker-tar",
# package_file_name = "onlyoffice-editor-docker.tar",
# srcs = [
# ":oofork-tar-files",
# ],
# strip_prefix = strip_prefix.from_pkg("oofork-tar-files"),
# package_dir = "var/www/onlyoffice/documentserver/"
# )
#
# oci_image(
# name = "image",
# base = "@onlyoffice-documentserver",
# tars = [ ":oofork-docker-tar" ],
# )
#
# oci_load(
# name = "load",
# image = ":image",
# repo_tags = ["cp-documentserver:latest"],
# )
#
# filegroup(
# name = "image-tarball",
# srcs=[':load'],
# output_group = 'tarball',
# visibility = ["//visibility:public"],
# )
39 changes: 20 additions & 19 deletions e2etests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,26 @@ js_binary(
],
)

js_test(
name = "playwright-test",
entry_point = "playwright-test.mjs",
include_npm = True,
env = {
#"BROWSERS_PATH": "@(location :cache-ms-playwright)",
"BROWSERS_PATH": "@(location playwright-test.mjs)",
},
expand_env = True,
data =
glob(["tests/**/*.spec.js"]) + [
"playwright.config.cjs",
":node_modules/playwright",
":node_modules/@playwright/test",
":node_modules/testcontainers",
":cache-ms-playwright",
"//docker:image-tarball",
],
)
# Disabled, since we do not plan to use the fork together with the OO documentserver right now
# js_test(
# name = "playwright-test",
# entry_point = "playwright-test.mjs",
# include_npm = True,
# env = {
# #"BROWSERS_PATH": "@(location :cache-ms-playwright)",
# "BROWSERS_PATH": "@(location playwright-test.mjs)",
# },
# expand_env = True,
# data =
# glob(["tests/**/*.spec.js"]) + [
# "playwright.config.cjs",
# ":node_modules/playwright",
# ":node_modules/@playwright/test",
# ":node_modules/testcontainers",
# ":cache-ms-playwright",
# "//docker:image-tarball",
# ],
# )

js_run_binary(
name = "cache-ms-playwright",
Expand Down
4 changes: 2 additions & 2 deletions test-oofork-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euo pipefail

TGZ_FILE=onlyoffice-editor.tar.gz
TGZ_FILE=onlyoffice-editor.zip
CONTENT_FILE=content

assert_contains() {
Expand All @@ -12,7 +12,7 @@ assert_contains() {
fi
}

tar tfz $TGZ_FILE > $CONTENT_FILE
unzip -l $TGZ_FILE | sed -e 's/^[^a-z]*//' > $CONTENT_FILE

assert_contains web-apps/apps/api/documents/api.js
assert_contains web-apps/apps/api/documents/api-orig.js
Expand Down
Loading