Added support for project documentation #10
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Check out the code | |
| - name: Check out the code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches | |
| ref: main # Ensure main branch is checked out | |
| # Step 2: Set up Elixir | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: '1.17' | |
| otp-version: '27.1.2' | |
| # Step 3: Install dependencies | |
| - name: Install dependencies | |
| run: mix deps.get | |
| # Step 4: Cache dependencies | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: deps | |
| key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-mix- | |
| # Step 5: Cache Dialyzer PLT | |
| - name: Cache Dialyzer PLT | |
| uses: actions/cache@v3 | |
| with: | |
| path: _build/dev/*.plt | |
| key: ${{ runner.os }}-dialyzer-plt-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-dialyzer-plt- | |
| # Step 6: Run formatter check | |
| - name: Run formatter check | |
| run: mix format --check-formatted | |
| # Step 7: Run Credo for linting | |
| - name: Run Credo for linting | |
| run: mix credo --strict | |
| # Step 8: Run Dialyzer for type checking | |
| - name: Run Dialyzer for type checking | |
| run: mix dialyzer | |
| env: | |
| MIX_ENV: dev | |
| # Step 9: Run tests | |
| - name: Run tests | |
| run: mix test | |
| # Step 10: Print Environment (Debugging) | |
| - name: Print Environment | |
| run: env | |
| # Step 11: Print Working Directory (Debugging) | |
| - name: Print Working Directory | |
| run: pwd | |
| # Step 12: List Files (Debugging) | |
| - name: List Files | |
| run: ls -la | |
| # Step 13: Debug Environment | |
| - name: Debug Environment | |
| run: | | |
| cd $GITHUB_WORKSPACE # Ensure we're in the root directory | |
| mix deps.get | |
| mix help docs | |
| ls -la doc/ | |
| env: | |
| MIX_ENV: dev | |
| # Step 14: Generate documentation | |
| - name: Generate documentation | |
| working-directory: ${{ github.workspace }} # Ensure this is run in the root directory | |
| run: mix docs | |
| env: | |
| MIX_ENV: dev | |
| # Step 15: Upload documentation as an artifact | |
| - name: Upload documentation | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: documentation | |
| path: doc/ | |
| # Step 16: Deploy to GitHub Pages | |
| - name: Deploy to GitHub Pages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "[email protected]" | |
| git add doc/ | |
| git commit -m "Update documentation [skip ci]" || echo "No changes to commit" | |
| git push origin main |