Skip to content

v3.0.0

v3.0.0 #389

Workflow file for this run

name: CI
on:
pull_request:
push:
release:
types: [published]
jobs:
build:
name: Build and test the project
strategy:
matrix:
system:
- ubuntu-22.04
node-version:
- 18.x
ocaml-compiler:
- 5.3.x
runs-on: ${{ matrix.system }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y bubblewrap g++-multilib gcc-multilib mercurial musl-tools rsync
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-disable-sandboxing: true
opam-depext: false
env:
OPAM_DEPEXT_PACKAGES: ""
- name: make install
run: make install
- name: make build
run: make build
- name: Run tests
run: make test-coverage
- name: Validate opam file
run: |
echo "🔍 Running opam lint validation..."
opam lint relude.opam
echo "✅ Opam file is valid"
echo "🧪 Testing opam install dry run..."
opam install --dry-run . || {
echo "❌ opam install --dry-run failed - dependency resolution issues detected"
exit 1
}
echo "✅ opam install --dry-run succeeded - dependencies can be resolved"
echo "📦 Testing opam pin dry run..."
opam pin add --dry-run relude . || {
echo "❌ opam pin dry run failed - package cannot be pinned"
exit 1
}
echo "✅ opam pin dry run succeeded - package can be pinned from source"
- name: Install opam-publish plugin
if: github.event_name == 'release' || github.event_name == 'push' || github.event_name == 'pull_request'
run: opam install opam-publish
- name: Publish to opam (dry run)
if: github.event_name != 'release'
run: |
echo "🧪 Running opam publish dry run..."
echo "📝 This validates the publishing process without submitting to opam"
# Verify opam-publish plugin can analyze the package
echo "🔍 Checking if opam-publish can process the package..."
# Test that we can generate the opam file content
if opam show --raw . >/dev/null 2>&1; then
echo "✅ Package metadata can be read successfully"
else
echo "❌ Failed to read package metadata"
exit 1
fi
# Verify required fields are present in opam file
echo "📋 Validating required opam file fields..."
if grep -q "^homepage:" relude.opam && grep -q "^bug-reports:" relude.opam && grep -q "^synopsis:" relude.opam; then
echo "✅ Required opam fields are present"
else
echo "❌ Missing required opam fields for publishing"
exit 1
fi
# Check if we can read the current git state
if git rev-parse --verify HEAD >/dev/null 2>&1; then
echo "✅ Git repository state is valid"
else
echo "❌ Git repository state is invalid"
exit 1
fi
echo "✅ Dry run validation successful - opam publishing should work for a real release"
echo "📋 To publish manually, create a release or run: opam publish --tag=<version> ."
- name: Configure git for GitHub operations
if: github.event_name == 'release'
env:
OPAM_PUBLISH_TOKEN: ${{ secrets.OPAM_PUBLISH_TOKEN }}
run: |
if [ -n "$OPAM_PUBLISH_TOKEN" ]; then
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git config --global credential.helper store
echo "https://github-actions:[email protected]" > ~/.git-credentials
fi
- name: Publish to opam (release)
if: github.event_name == 'release' && github.event.action == 'published'
env:
OPAM_PUBLISH_TOKEN: ${{ secrets.OPAM_PUBLISH_TOKEN }}
run: |
if [ -n "$OPAM_PUBLISH_TOKEN" ]; then
echo "🚀 Publishing relude v${{ github.ref_name }} to opam repository"
mkdir -p ~/.opam/plugins/opam-publish
echo -n "$OPAM_PUBLISH_TOKEN" > ~/.opam/plugins/opam-publish/github-actions.token
# Configure opam-publish to use HTTPS instead of SSH
git config --global url."https://github.com/".insteadOf "[email protected]:"
opam publish --no-confirmation --no-browser --tag=${{ github.ref_name }} .
echo "✅ Successfully published relude v${{ github.ref_name }} to opam"
else
echo "⚠️ OPAM_PUBLISH_TOKEN not found in secrets"
echo "📋 To manually publish this release to opam, run:"
echo " opam publish --tag=${{ github.ref_name }} ."
echo ""
echo "📖 See https://opam.ocaml.org/doc/Packaging.html#Publishing for more details"
echo "🔗 Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
fi