You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/04/05 10:04:55 UTC

[buildstream-plugins] 40/49: .github/workflows: Adding the ci/merge/release workflows

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/buildstream-plugins.git

commit 1c51f01175b245c3e1d3fb38af3618df0db1a3c7
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Fri Mar 25 14:53:30 2022 +0900

    .github/workflows: Adding the ci/merge/release workflows
---
 .github/workflows/ci.yml    | 81 ++++++++++++++++++++++++++++++++++++++++++++
 .github/workflows/merge.yml | 82 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 163 insertions(+)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..7017a26
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,81 @@
+name: PR Checks
+
+# Pre-merge CI to run on push and pull_request events, even if this seems
+# redundant, we avoid concurrency with the below configuration.
+#
+on:
+  pull_request:
+  workflow_dispatch:
+
+# Use the concurrency feature to ensure we don't run redundant workflows
+#
+concurrency:
+  group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
+  cancel-in-progress: true
+
+# Left to-do:
+# - coverage
+# - publishing docs to gh-pages
+# - persistent artifact cache
+# - overnight jobs
+# - wsl tasks (TODO: Check if GitHub's Windows runners allow WSL)
+#
+# New opportunities:
+# - run tests on mac (GitHub provides MacOS runners)
+# - standardize WSL tasks by using GitHub-provided runners
+
+jobs:
+  tests:
+    runs-on: ubuntu-20.04
+    continue-on-error: ${{ matrix.allow-failure || false }}
+
+    strategy:
+      fail-fast: false
+      matrix:
+
+        # The names here should map to a valid service defined in
+        # "../compose/ci.docker-compose.yml"
+        test-name:
+          - debian-10
+          - fedora-34
+          - fedora-35
+          - fedora-missing-deps
+          - lint
+          - mypy
+
+        include:
+          - test-name: bst-master
+            allow-failure: true
+
+    steps:
+      - name: Check out repository
+        uses: actions/checkout@v2
+        # BuildStream requires tags to be able to find its version.
+        with:
+          fetch-depth: 0
+
+      - name: Run tests with Docker Compose
+        run: |
+          ${GITHUB_WORKSPACE}/.github/run-ci.sh ${{ matrix.test-name }}
+
+  docs:
+    runs-on: ubuntu-20.04
+    steps:
+      - name: Check out repository
+        uses: actions/checkout@v2
+        # BuildStream requires tags to be able to find its version.
+        with:
+          fetch-depth: 0
+
+      - name: Give `testuser` ownership of the source directory
+        run: sudo chown -R 1000:1000 ${GITHUB_WORKSPACE}
+
+      - name: Build documentation using Docker Compose
+        run: |
+          ${GITHUB_WORKSPACE}/.github/run-ci.sh docs
+
+      - name: Upload artifacts
+        uses: actions/upload-artifact@v2
+        with:
+          name: docs
+          path: doc/build/html
diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml
new file mode 100644
index 0000000..8bb492e
--- /dev/null
+++ b/.github/workflows/merge.yml
@@ -0,0 +1,82 @@
+name: Merge actions
+
+on:
+  push:
+    branches:
+    - master
+
+jobs:
+  build:
+    name: Build documentation
+    runs-on: ubuntu-20.04
+    steps:
+    - name: Checkout code
+      uses: actions/checkout@v2
+      # BuildStream requires tags to be able to find its version.
+      with:
+        fetch-depth: 0
+
+    - name: Give `testuser` ownership of the source directory
+      run: sudo chown -R 1000:1000 ${GITHUB_WORKSPACE}
+
+    - name: Build documentation using Docker Compose
+      run: |
+        ${GITHUB_WORKSPACE}/.github/run-ci.sh docs
+
+        # Restore permissions to the current user
+        sudo chown -R ${USER} ${GITHUB_WORKSPACE}
+
+        # Include a tarball in the published docs, allowing for
+        # easy re-publishing of master docs on docs.buildstream.build
+        tar -C doc/build/html -zcf docs.tgz .
+
+    - name: Upload artifacts
+      uses: actions/upload-artifact@v2
+      with:
+        name: docs
+        path: |
+          doc/build/html
+          docs.tgz
+
+  publish:
+    needs: build
+    runs-on: ubuntu-20.04
+    steps:
+
+    - name: Download artifact
+      uses: actions/download-artifact@v2
+      with:
+        name: docs
+        path: docs
+
+    - name: Checkout code
+      uses: actions/checkout@v2
+      with:
+        ref: gh-pages
+        path: pages
+        fetch-depth: 0
+
+    - name: Update repo
+      run: |
+
+        # First reset the branch state to the initial commit, this ensures that
+        # we do not pollute the repository with the history of every docs package
+        # we've ever published (history of docs packages for major releases is
+        # also stored as GitHub release assets)
+        #
+        cd pages/
+        git reset --hard GH_PAGES_FIRST_COMMIT
+
+        # Copy the docs asset over and overwrite the orphan gh-pages branch, ensure
+        # that we disable GitHub's jekyll by creating the .nojekyll file, otherwise
+        # it will interfere with the rendering of the site.
+        #
+        cp -a ../docs/doc/build/html/* .
+        cp -a ../docs/docs.tgz .
+        touch .nojekyll
+
+        git add .
+        git config --local user.email "merge-ci@ponyland"
+        git config --local user.name  "Github Actions Nightly Job"
+        git commit -m "Update repo for docs build $GITHUB_RUN_NUMBER"
+        git push --force "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" gh-pages