Skip to content

CI

CI #1381

Workflow file for this run

---
name: CI
"on":
push:
branches:
- main
pull_request:
branches:
- "*"
workflow_dispatch: {}
merge_group:
schedule:
- cron: 0 18 * * *
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
jobs:
ci:
name: CI
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
id: setup-beam
with:
version-type: strict
version-file: .tool-versions
- name: Restore rebar3's cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
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}}"
- name: Continuous Integration
run: |
rebar3 as test ci
npm run format-lint
- name: Test release
run: |
rebar3 release
_build/default/rel/arizona_example/bin/arizona_example daemon
# Wait for application to be ready
echo "Waiting for application to start..."
success=false
for i in {1..5}; do
sleep 2
if curl -f -s http://127.0.0.1:8080 > /dev/null 2>&1; then
echo "Application ready after $((i * 2)) seconds"
success=true
break
fi
echo "Attempt ${i}/5 failed, retrying..."
done
# If failed, try to get diagnostic info from running daemon first
if [[ "${success}" == false ]]; then
echo "ERROR: Application failed to start after 5 attempts"
echo "Checking daemon status and attempting to fetch page content:"
_build/default/rel/arizona_example/bin/arizona_example ping || \
echo "Daemon not responding to ping"
echo "Attempting to fetch page HTML for debugging:"
curl -v http://127.0.0.1:8080 || echo "HTTP request failed"
echo "Stopping daemon and starting in foreground as fallback:"
_build/default/rel/arizona_example/bin/arizona_example stop || true
echo "Starting in foreground to show startup errors:"
timeout 10s _build/default/rel/arizona_example/bin/arizona_example foreground || true
exit 1
fi
npm run test
_build/default/rel/arizona_example/bin/arizona_example stop
- name: Check if build left artifacts
run: git diff --exit-code
- name: Notify on failed build
uses: jayqi/failed-build-issue-action@1a893bbf43ef1c2a8705e2b115cd4f0fe3c5649b # v1.2.0
if: failure() && github.event.pull_request == null
id: failed-build
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Maybe close failure notification
if: github.event.pull_request == null
run: |
if [[ -z "${{steps.failed-build.outputs.issue-number}}" ]];then
build_failed=$(\
gh search issues\
--label "build failed"\
--json "number"\
--jq ".[0].number"\
--repo "${{github.repository}}"\
)
if [[ "${build_failed}" != "null" ]]; then
gh issue close "${build_failed}"
fi
fi
env:
GH_TOKEN: ${{ github.token }}