File: test.yml

package info (click to toggle)
xrootd-s3-http 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 840 kB
  • sloc: cpp: 10,245; sh: 898; makefile: 14
file content (163 lines) | stat: -rw-r--r-- 5,967 bytes parent folder | download | duplicates (2)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test

on:
  workflow_dispatch:
    branches:
      - main
  pull_request:
    branches:
      - main
  push:
    branches:
      - main

env:
  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  BUILD_TYPE: Debug

jobs:
  build:
    strategy:
      matrix:
        external-gtest: [ YES ]
        os: [ ubuntu-24.04 ]

    runs-on: ${{ matrix.os }}
    name: Build with external_gtest=${{ matrix.external-gtest }} on ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v3
      with:
        submodules: recursive

    - name: Generate cache key
      id: cache_key
      working-directory: ${{runner.workspace}}
      run: |
        git clone https://github.com/xrootd/xrootd.git
        cd xrootd
        git remote add github_pelican https://github.com/PelicanPlatform/xrootd.git
        git fetch github_pelican
        git checkout -b v5.8.4-pelican -t github_pelican/v5.8.4-pelican
        echo "git:$(git rev-parse HEAD)" > key
        echo "os:$(uname -svmo)" >> key
        echo "week:$(date '+%Y-%U')" >> key
        cat key
        echo "key=xrootd-asan-$(sha256sum key | cut -f 1 -d ' ')" >> $GITHUB_OUTPUT

        # Disable auto-update of the manpages during apt installs; saves a few seconds.
        sudo rm -f /var/lib/man-db/auto-update

    - name: Try download from cache
      uses: actions/cache/restore@v4
      id: cache
      with:
        path: ${{ runner.workspace }}/xrootd/build/release_dir
        key: ${{ steps.cache_key.outputs.key }}

    # Only need the go build environment if there was a cache miss
    - uses: actions/setup-go@v5
      if: steps.cache.outputs.cache-hit != 'true'
      with:
        go-version: '1.23.5'

    - name: Install XRootD
      working-directory: ${{runner.workspace}}
      if: steps.cache.outputs.cache-hit != 'true'
      run: |
        # Build deps
        sudo apt update && sudo apt-get install -y cmake libz-dev uuid-dev libcurl4-openssl-dev libcurl4 pkg-config libssl-dev g++ libscitokens-dev libgtest-dev

        # Build our preferred set of patches on xrootd
        rm -rf xrootd
        git clone https://github.com/xrootd/xrootd.git
        cd xrootd
        git remote add github_pelican https://github.com/PelicanPlatform/xrootd.git
        git fetch github_pelican
        git checkout -b v5.8.4-pelican -t github_pelican/v5.8.4-pelican
        mkdir -p build/release_dir
        cd build
        cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/release_dir -DENABLE_ASAN=TRUE
        make -j $(($(nproc) + 2)) install

        # Install the load tester
        go install github.com/bbockelm/go-wrk@92dbe19
        cp ~/go/bin/go-wrk release_dir/bin/

        # Download minio and mc for S3 tests (platform-specific)
        if [[ "$(uname -s)" == "Darwin" ]]; then
          MINIO_OS="darwin"
        else
          MINIO_OS="linux"
        fi
        if [[ "$(uname -m)" == "arm64" || "$(uname -m)" == "aarch64" ]]; then
          MINIO_ARCH="arm64"
        else
          MINIO_ARCH="amd64"
        fi
        curl -o release_dir/bin/minio "https://dl.min.io/server/minio/release/${MINIO_OS}-${MINIO_ARCH}/minio"
        chmod +x release_dir/bin/minio
        curl -o release_dir/bin/mc "https://dl.min.io/client/mc/release/${MINIO_OS}-${MINIO_ARCH}/mc"
        chmod +x release_dir/bin/mc

    - name: Upload XRootD to cache
      uses: actions/cache/save@v4
      if: steps.cache.outputs.cache-hit != 'true'
      id: cache-save
      with:
        path: ${{ runner.workspace }}/xrootd/build/release_dir
        key: ${{ steps.cache_key.outputs.key }}

    - name: Install build deps
      if: steps.cache.outputs.cache-hit == 'true'
      run: |
        sudo apt update && sudo apt-get install -y cmake libcurl4-openssl-dev libcurl4 pkg-config libssl-dev g++ libscitokens-dev libgtest-dev

    - name: Create Build Environment
      # Some projects don't allow in-source building, so create a separate build directory
      # We'll use this as our working directory for all subsequent commands
      run: cmake -E make_directory ${{runner.workspace}}/build

    - name: Configure CMake
      shell: bash
      working-directory: ${{runner.workspace}}/build
      run: CMAKE_PREFIX_PATH=$PWD/../xrootd/build/release_dir/lib/cmake/XRootD cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_TESTS=yes -DENABLE_ASAN=true -DXROOTD_PLUGINS_EXTERNAL_GTEST=${{ matrix.external-gtest }}

    - name: Build
      working-directory: ${{runner.workspace}}/build
      shell: bash
      # Execute the build.  You can specify a specific target with "--target <NAME>"
      run: cmake --build . --config $BUILD_TYPE --parallel $(($(nproc) + 2))

    - name: Unit Tests
      working-directory: ${{runner.workspace}}/build
      shell: bash
      # Execute tests defined by the CMake configuration.
      # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
      run: ctest -C $BUILD_TYPE --verbose

    - name: Start xrootd
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: ASAN_OPTIONS=detect_odr_violation=0 LD_LIBRARY_PATH=$PWD/../xrootd/build/release_dir/lib $PWD/../xrootd/build/release_dir/bin/xrootd -c ${{runner.workspace}}/xrootd-s3-http/test/s3-xrootd-test.cfg &

    - name: Get a file
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: curl -f http://localhost:8080/aws-opendata/2024/wod_apb_2024.nc -o wod_apb_2024.nc

    - name: Fail a file
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: |
        if curl -f http://localhost:8080/aws-opendata/2024/bogus_file_name; then
          echo "Error: Command unexpectedly succeeded."
          exit 1
        else
          echo "Command failed as expected."
        fi

    - name: Get metadata
      working-directory: ${{runner.workspace}}/build
      shell: bash
      run: curl -f -k -X PROPFIND http://localhost:8080/aws-opendata/2024/wod_apb_2024.nc -d prop_query