Add license #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Elm | |
| run: | | |
| npm install -g [email protected] | |
| npm install -g [email protected] | |
| npm install -g [email protected] | |
| npm install -g [email protected] | |
| - name: Run elm-test | |
| run: | | |
| cat > tests/DocumentationCodeSnippetTest.elm << 'EOF' | |
| module DocumentationCodeSnippetTest exposing (tests) | |
| import Test | |
| tests : Test.Test | |
| tests = | |
| Test.describe "documentation code snippets" [] | |
| EOF | |
| elm-review --rules Review.Documentation.CodeSnippet --fix-all-without-prompt | |
| elm-test | |
| - name: Run elm-review | |
| run: elm-review | |
| build-docs: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Elm | |
| run: npm install -g [email protected] | |
| - name: Install Sass | |
| run: npm install -g sass | |
| - name: Build docs | |
| run: | | |
| cd docs | |
| sass static/styles.scss:static/styles.css --style=expanded | |
| cp static/index.html static/404.html | |
| elm make src/Main.elm --output=static/main.js | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './docs/static' | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build-docs | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Verify CDN dependencies and API endpoints | |
| run: | | |
| echo "Checking CDN dependencies..." | |
| # Google Fonts | |
| curl -f -s -o /dev/null -w "Google Fonts CSS: %{http_code}\n" \ | |
| "https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic" || exit 1 | |
| # Leaflet CSS | |
| curl -f -s -o /dev/null -w "Leaflet CSS: %{http_code}\n" \ | |
| "https://unpkg.com/[email protected]/dist/leaflet.css" || exit 1 | |
| # Leaflet JS | |
| curl -f -s -o /dev/null -w "Leaflet JS: %{http_code}\n" \ | |
| "https://unpkg.com/[email protected]/dist/leaflet.js" || exit 1 | |
| # Choices.js CSS | |
| curl -f -s -o /dev/null -w "Choices.js CSS: %{http_code}\n" \ | |
| "https://cdn.jsdelivr.net/npm/choices.js/public/assets/styles/choices.min.css" || exit 1 | |
| # Choices.js JS | |
| curl -f -s -o /dev/null -w "Choices.js JS: %{http_code}\n" \ | |
| "https://cdn.jsdelivr.net/npm/choices.js/public/assets/scripts/choices.min.js" || exit 1 | |
| # OpenStreetMap tile server (check one sample tile) | |
| curl -f -s -o /dev/null -w "OpenStreetMap Tiles: %{http_code}\n" \ | |
| "https://a.tile.openstreetmap.org/0/0/0.png" || exit 1 | |
| echo "" | |
| echo "Checking API endpoints..." | |
| # Nominatim reverse geocoding API | |
| curl -f -s -o /dev/null -w "Nominatim API: %{http_code}\n" \ | |
| -H "User-Agent: ElmFormToolkitDemo" \ | |
| "https://nominatim.openstreetmap.org/reverse?format=json&lat=19.4326&lon=-99.1332&addressdetails=1" || exit 1 | |
| # Photon geocoding API | |
| curl -f -s -o /dev/null -w "Photon API: %{http_code}\n" \ | |
| "https://photon.komoot.io/api?q=London&limit=5" || exit 1 | |
| echo "" | |
| echo "All dependencies and API endpoints are responding correctly!" |