summaryrefslogtreecommitdiff
path: root/.github/workflows/secondary-umbrella.yaml
blob: 9b964f00cb21aa39d11c1fa0734d56c2ccba0673 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Generate Mixed Version Testing Artifacts (v3.8.x only)
on:
  workflow_dispatch:
  push:
    branches:
    - main
    paths:
    - .github/workflows/secondary-umbrella.yaml
jobs:
  package-generic-unix:
    name: package-generic-unix
    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        # The erlang_major should be the minumum version used across
        # all mixed version tests that utilize that artifact
        include:
        - erlang_major: "23"
          tag: v3.8.27
          patch: |
            diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel
            index 62514c79af..5dc3169c75 100644
            --- a/WORKSPACE.bazel
            +++ b/WORKSPACE.bazel
            @@ -59,8 +59,8 @@ rules_pkg_dependencies()

             http_archive(
                 name = "bazel-erlang",
            -    sha256 = "f37c339711ce05b748688938ad9b1c00a78f0b2ef67d6baa734f5a34e33ad8a3",
            -    strip_prefix = "bazel-erlang-1.4.0",
            +    sha256 = "2ba878df673020ac714c050c0aaf3c66cac2f9cca0aa4259e3c74603c59e0cd0",
            +    strip_prefix = "rules_erlang-1.4.0",
                 urls = ["https://github.com/rabbitmq/bazel-erlang/archive/refs/tags/1.4.0.zip"],
             )

            diff --git a/rabbitmq.bzl b/rabbitmq.bzl
            index f0e7b7470d..f8e18aabb3 100644
            --- a/rabbitmq.bzl
            +++ b/rabbitmq.bzl
            @@ -25,6 +25,8 @@ _LAGER_EXTRA_SINKS = [
             ]

             RABBITMQ_ERLC_OPTS = DEFAULT_ERLC_OPTS + [
            +    "-DTEST=1",
            +    "+nowarn_export_all",
                 "+{parse_transform,lager_transform}",
                 "+{lager_extra_sinks,[" + ",".join(_LAGER_EXTRA_SINKS) + "]}",
             ]
    timeout-minutes: 20
    steps:
    - name: Checkout Repository (Secondary Umbrella tag)
      uses: actions/checkout@v3
      with:
        ref: ${{ matrix.tag }}

    - name: Adjust Project-Wide erlc_opts
      run: |
        set -eux
        PATCH_FILE=secondary-umbrella.patch
        echo '${{ matrix.patch }}' > ${PATCH_FILE}
        cat ${PATCH_FILE}
        patch -p1 < ${PATCH_FILE}
        git diff

    - name: Mount Bazel Cache
      uses: actions/cache@v3.2.2
      with:
        path: "/home/runner/repo-cache/"
        key: repo-cache-secondary-umbrella

    - name: Configure Bazel
      run: |
        if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
        cat << EOF >> user.bazelrc
          build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}
        EOF
        fi
        cat << EOF >> user.bazelrc
          build:buildbuddy --build_metadata=ROLE=CI
          build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
          build:buildbuddy --remote_instance_name=buildbuddy-io/buildbuddy/ci-secondary-umbrella
          build:buildbuddy --repository_cache=/home/runner/repo-cache/
          build:buildbuddy --color=yes
          build:buildbuddy --disk_cache=

          build:buildbuddy --remote_download_toplevel
        EOF

        bazelisk info release

    - name: Build
      run: |
        TAG=${{ matrix.tag }}
        VERSION=${TAG#v}
        sed -i"_orig" -E "/APP_VERSION/ s/3\.[0-9]+\.[0-9]+/${VERSION}/" rabbitmq.bzl
        bazelisk build :package-generic-unix \
          --config=rbe-${{ matrix.erlang_major }} \
          --verbose_failures

    - name: Rename the Artifact
      run: |
        OUTPUT_DIR=${{ github.workspace }}/output
        mkdir ${OUTPUT_DIR}
        cp \
          bazel-bin/package-generic-unix.tar.xz \
          ${OUTPUT_DIR}/package-generic-unix-for-mixed-version-testing-${{ matrix.tag }}.tar.xz

    - name: Upload the archive to S3
      uses: jakejarvis/s3-sync-action@v0.5.1
      with:
        args: --acl public-read --follow-symlinks
      env:
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
        AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
        AWS_REGION: ${{ secrets.AWS_REGION }}
        SOURCE_DIR: output
        DEST_DIR: secondary-umbrellas

    - name: Confirm public access
      run: |
        curl -LO https://rabbitmq-github-actions.s3.eu-west-1.amazonaws.com/secondary-umbrellas/package-generic-unix-for-mixed-version-testing-${{ matrix.tag }}.tar.xz