diff --git a/.github/workflows/github-actions-checks.yml b/.github/workflows/github-actions-checks.yml new file mode 100644 index 0000000000..92408b4761 --- /dev/null +++ b/.github/workflows/github-actions-checks.yml @@ -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 ... diff --git a/.github/workflows/github-actions-release.yml b/.github/workflows/github-actions-release.yml new file mode 100644 index 0000000000..19c89ff04a --- /dev/null +++ b/.github/workflows/github-actions-release.yml @@ -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 diff --git a/BUILD.bazel b/BUILD.bazel index 6a5d2382cc..53c153fa4f 100755 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -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") @@ -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", @@ -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", diff --git a/docker/BUILD.bazel b/docker/BUILD.bazel index 02e5f8b110..19fb5cbaf0 100644 --- a/docker/BUILD.bazel +++ b/docker/BUILD.bazel @@ -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"], +# ) diff --git a/e2etests/BUILD.bazel b/e2etests/BUILD.bazel index dd42fdf384..9a02615c56 100644 --- a/e2etests/BUILD.bazel +++ b/e2etests/BUILD.bazel @@ -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", diff --git a/test-oofork-files.sh b/test-oofork-files.sh index 17b1d8d148..86f156d9e6 100755 --- a/test-oofork-files.sh +++ b/test-oofork-files.sh @@ -2,7 +2,7 @@ set -euo pipefail -TGZ_FILE=onlyoffice-editor.tar.gz +TGZ_FILE=onlyoffice-editor.zip CONTENT_FILE=content assert_contains() { @@ -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