| name: CI |
| |
| on: |
| push: |
| branches: [ main ] |
| pull_request: |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| |
| build_on_linux: |
| strategy: |
| matrix: |
| fdb-version: ['6.2.30', '6.3.22'] |
| runs-on: ubuntu-latest |
| steps: |
| - name: Check out repository code |
| uses: actions/checkout@v2 |
| with: |
| persist-credentials: false |
| submodules: recursive |
| - name: Install FoundationDB |
| env: |
| FDB_VERSION: ${{ matrix.fdb-version }} |
| run: | |
| wget https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers/foundationdb-clients_${FDB_VERSION}-1_amd64.deb |
| wget https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers/foundationdb-server_${FDB_VERSION}-1_amd64.deb |
| sudo dpkg -i foundationdb-clients_${FDB_VERSION}-1_amd64.deb |
| sudo dpkg -i foundationdb-server_${FDB_VERSION}-1_amd64.deb |
| - name: Setup Erlang |
| uses: ./.github/actions/setup-beam |
| with: |
| otp-version: '24' |
| rebar3-version: '3.17' |
| - name: Enforce coding style |
| run: rebar3 fmt --check |
| - name: Compile |
| run: rebar3 compile |
| - name: EUnit tests |
| run: rebar3 eunit |
| - name: Setup tmate session on job failure |
| uses: ./.github/actions/tmate |
| if: ${{ failure() }} |
| with: |
| limit-access-to-actor: true |
| |
| build_on_windows: |
| strategy: |
| matrix: |
| # Windows builds are not being published beyond 6.3.9 right now |
| fdb-version: ['6.2.30', '6.3.9'] |
| runs-on: windows-latest |
| env: |
| # Set to 1 for verbose rebar3 logging |
| DEBUG: 0 |
| # Set to 1 for even more verbose rebar3 logging |
| DIAGNOSTIC: 0 |
| steps: |
| - name: Check out repository code |
| uses: actions/checkout@v2 |
| with: |
| persist-credentials: false |
| submodules: recursive |
| - name: Install FoundationDB |
| env: |
| FDB_VERSION: ${{ matrix.fdb-version }} |
| # Download FDB .msi, install it, and add FDB to the $env:Path for all future steps |
| run: | |
| Set-PSDebug -Trace 1 |
| Invoke-WebRequest -Uri https://www.foundationdb.org/downloads/$env:FDB_VERSION/windows/installers/foundationdb-$env:FDB_VERSION-x64.msi -OutFile foundationdb-$env:FDB_VERSION-x64.msi |
| msiexec /i foundationdb-$env:FDB_VERSION-x64.msi /passive |
| echo "c:/Program Files/foundationdb/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| - name: Setup Erlang |
| uses: ./.github/actions/setup-beam |
| with: |
| otp-version: '24' |
| rebar3-version: '3.17' |
| - name: Setup MSVC toolchain |
| uses: ./.github/actions/msvc-dev-cmd |
| - name: Compile |
| run: rebar3 compile |
| - name: EUnit tests |
| env: |
| # This profile uses the FDB server started in the "Install FoundationDB" step |
| # instead of starting another one (the code that manages the "local" FDB in the |
| # test suite is not designed with x-platform compatibility in mind) |
| REBAR_PROFILE: win32_external_fdbserver |
| run: rebar3 eunit |
| - name: Setup tmate session on job failure |
| uses: ./.github/actions/tmate |
| if: ${{ failure() }} |
| with: |
| limit-access-to-actor: true |
| |
| binding_tester: |
| runs-on: ubuntu-latest |
| strategy: |
| matrix: |
| test-name: [api, directory, directory_hca, tuple] |
| api-version: [610, 620, 630] |
| include: |
| # The `scripted` test only supports the latest API version |
| - test-name: scripted |
| api-version: 630 |
| container: |
| image: apache/couchdbci-debian:erlfdb-erlang-24.1.5.0-fdb-6.3.18-1 |
| services: |
| foundationdb: |
| image: foundationdb/foundationdb:6.3.18 |
| env: |
| # We could create a different profile that looks for fdb.cluster in the |
| # default /etc/foundationdb/ location, but for now we can just specify the |
| # custom location here |
| FDB_CLUSTER_FILE: /usr/local/etc/foundationdb/fdb.cluster |
| # This profile just ensures we use the FDB server in the service container |
| REBAR_PROFILE: devcontainer |
| DIAGNOSTIC: 1 |
| steps: |
| - name: Create FDB cluster file |
| env: |
| # This needs to match the name of the service above so the script can do |
| # a DNS lookup to write down the coordinator IP in the fdb.cluster file |
| FDB_COORDINATOR: foundationdb |
| shell: bash |
| run: /usr/local/bin/create_cluster_file.bash |
| - name: Initialize FDB database |
| run: fdbcli --exec "configure new single ssd" |
| - name: Check out repository code |
| uses: actions/checkout@v2 |
| with: |
| persist-credentials: false |
| - name: Compile erlfdb |
| run: rebar3 compile |
| - name: Execute unit tests |
| run: rebar3 eunit |
| - name: Execute binding test |
| env: |
| TEST_NAME: ${{ matrix.test-name }} |
| API_VERSION: ${{ matrix.api-version }} |
| COVER_ENABLED: true |
| ERL_LIBS: _build/devcontainer+test/lib/erlfdb/ |
| run: | |
| mkdir -p /usr/src/erlfdb/test/ |
| ln -s $GITHUB_WORKSPACE/test/tester.es /usr/src/erlfdb/test/tester.es |
| /usr/src/foundationdb/bindings/bindingtester/bindingtester.py erlang \ |
| --test-name $TEST_NAME \ |
| --api-version $API_VERSION \ |
| --instruction-prefix $TEST_NAME \ |
| --num-ops 10000 |
| - name: Upload results to Coveralls |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| COVERALLS_FLAG_NAME: bindingtest-${{ matrix.test-name }}-${{ matrix.api-version }} |
| run: rebar3 as test coveralls send |
| |
| |
| finish: |
| needs: [build_on_linux, build_on_windows, binding_tester] |
| runs-on: ubuntu-latest |
| steps: |
| - name: Finalize Coveralls report |
| run: | |
| curl https://coveralls.io/webhook \ |
| --header 'Content-Type: application/json' \ |
| --data '{ |
| "repo_name": "${{ github.repository }}", |
| "repo_token": "${{ secrets.GITHUB_TOKEN }}", |
| "payload": { |
| "build_num": ${{ github.run_number }}, |
| "status": "done" |
| } |
| }' |