Skip to content

Merge pull request #110 from paulo-ferraz-oliveira/feature/updated-pl… #53

Merge pull request #110 from paulo-ferraz-oliveira/feature/updated-pl…

Merge pull request #110 from paulo-ferraz-oliveira/feature/updated-pl… #53

Workflow file for this run

---
name: build
on: [push, pull_request]
jobs:
ci:
name: Run checks and tests over ${{matrix.otp_vsn}}
runs-on: ubuntu-22.04
strategy:
matrix:
otp_vsn: ['24', '25', '26']
rebar3_vsn: ['3.22']
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: setup-beam
with:
otp-version: ${{matrix.otp_vsn}}
rebar3-version: ${{matrix.rebar3_vsn}}
- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: "_build-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- run: rebar3 format --verify
- run: |
rm -rf example/_checkouts # Prevent long running analysis
rebar3 test
example:
name: Makes sure our example run over ${{matrix.otp_vsn}}
runs-on: ubuntu-22.04
strategy:
matrix:
otp_vsn: ['24', '25', '26']
rebar3_vsn: ['3.22']
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: setup-beam-example
with:
otp-version: ${{matrix.otp_vsn}}
rebar3-version: ${{matrix.rebar3_vsn}}
- name: Restore _build
uses: actions/cache@v3
with:
path: example/_build
key: "_build-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam-example.outputs.otp-version}}\
-rebar3-${{steps.setup-beam-example.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam-example.outputs.otp-version}}\
-rebar3-${{steps.setup-beam-example.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: test our example
run: |
cd example
rebar3 release
_build/default/rel/example/bin/example daemon
R=$(curl -s -w "%{http_code}" -XPUT "localhost:8080/poor-kv/some-key/some-value" -H "content-type: text/plain")
[[ $R == "some-value201" ]] || exit 1 # This becomes some-value200 after the first PUT
R=$(curl -s -w "%{http_code}" "localhost:8080/poor-kv/some-key" -H "content-type: text/plain")
[[ $R == "some-value200" ]] || exit 1
R=$(curl -s -w "%{http_code}" "localhost:8080/poor-kv/non-existing-key" -H "content-type: text/plain")
[[ $R == "404" ]] || exit 1
R=$(curl -s -w "%{http_code}" -XDELETE "localhost:8080/poor-kv/some-key" -H "content-type: text/plain")
[[ $R == "204" ]] || exit 1
R=$(curl -s -w "%{http_code}" -XDELETE "localhost:8080/poor-kv/some-key" -H "content-type: text/plain")
[[ $R == "404" ]] || exit 1
_build/default/rel/example/bin/example stop
- name: Format check
run: |
cd example
rebar3 format --verify
- name: check our example
run: |
cd example
rebar3 test