test: streamline installing packages in tests #1058
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: Documentation | |
| permissions: | |
| contents: write # contents permission to update benchmark contents in gh-pages branch | |
| statuses: read | |
| deployments: write # deployments permission to deploy GitHub pages website | |
| pages: write | |
| id-token: write | |
| pull-requests: write | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - "src/**/*" | |
| - "ext/**/*" | |
| - "test/**/*" | |
| - "Project.toml" | |
| - "docs/**/*" | |
| - "examples/**/*" | |
| - ".buildkite/**/*" | |
| - ".github/workflows/Documentation.yml" | |
| - "lib/**/*" | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "*" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
| jobs: | |
| tutorial-cuda: | |
| if: ${{ !contains(github.event.head_commit.message, '[skip docs]') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Trigger CUDA Tutorial Build | |
| id: buildkite-build | |
| uses: buildkite/[email protected] | |
| with: | |
| buildkite_api_access_token: ${{ secrets.BUILDKITE_TOKEN }} | |
| pipeline: "julialang/lux-dot-jl" | |
| commit: ${{ github.event.pull_request.head.sha }} | |
| branch: ${{ github.event.pull_request.head.ref }} | |
| message: | | |
| Triggered from PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }} | |
| send_pull_request: true | |
| pull_request_base_branch: ${{ github.event.pull_request.base.ref }} | |
| build_env_vars: >- | |
| { | |
| "LUX_CUDA_TUTORIALS": "1", | |
| "GITHUB_PR_NUMBER": "${{ github.event.pull_request.number }}" | |
| } | |
| - name: Download CUDA Tutorial Artifacts | |
| uses: EnricoMi/download-buildkite-artifact-action@v1 | |
| with: | |
| buildkite_token: ${{ secrets.BUILDKITE_TOKEN }} | |
| buildkite_build_url: ${{ steps.buildkite-build.outputs.url }} | |
| ignore_build_states: blocked,canceled,skipped,not_run | |
| ignore_job_states: timed_out,failed | |
| output_path: artifacts | |
| poll_interval: 30 | |
| - name: "Combine CUDA Tutorial Artifacts" | |
| run: | | |
| set -e | |
| SOURCE_DIR="artifacts" | |
| OUTPUT_DIR="artifacts_combined" | |
| mkdir -p "$OUTPUT_DIR" | |
| # Check if source directory exists | |
| if [ ! -d "$SOURCE_DIR" ]; then | |
| echo "Error: Source directory '$SOURCE_DIR' not found" | |
| exit 1 | |
| fi | |
| BUILD_DIRS=$(find "$SOURCE_DIR" -mindepth 1 -type d -name "Tutorial-Build-*") | |
| [ -n "$BUILD_DIRS" ] || { echo "Error: No Tutorial-Build directories found"; exit 1; } | |
| echo "$BUILD_DIRS" | while read dir; do | |
| echo "Processing: $dir" | |
| rsync -av --ignore-existing "$dir/" "$OUTPUT_DIR/" | |
| done | |
| # Verify | |
| [ "$(ls -A $OUTPUT_DIR)" ] || { echo "Error: Merge produced empty directory"; exit 1; } | |
| echo "✓ Merge complete!" | |
| shell: bash | |
| - name: Upload Tutorial Artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: "tutorial-cuda" | |
| path: | | |
| artifacts_combined/docs/src/tutorials/beginner/**/* | |
| artifacts_combined/docs/src/tutorials/intermediate/**/* | |
| artifacts_combined/docs/src/tutorials/advanced/**/* | |
| artifacts_combined/tutorial_deps/* | |
| artifacts_combined/**/*.cov | |
| artifacts_combined/docs/src/public/examples/**/* | |
| retention-days: 90 | |
| if-no-files-found: error | |
| tutorial-cpu: | |
| if: ${{ !contains(github.event.head_commit.message, '[skip docs]') }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| group: [0, 1, 2, 3] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Collect Workflow Telemetry | |
| uses: catchpoint/workflow-telemetry-action@v2 | |
| with: | |
| comment_on_pr: false | |
| job_summary: true | |
| - uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: "1.11" | |
| - uses: julia-actions/cache@v2 | |
| with: | |
| cache-name: julia-cache;workflow=tutorial-cpu-${{ matrix.group }}-${{ github.event_name }}-${{ github.event.repository.default_branch }}-${{ github.sha }} | |
| - name: Run Tutorials | |
| run: julia --color=yes --project=docs --threads=auto docs/tutorials.jl | |
| env: | |
| TUTORIAL_BACKEND_GROUP: "CPU" | |
| BUILDKITE_PARALLEL_JOB_COUNT: 4 | |
| BUILDKITE_PARALLEL_JOB: ${{ matrix.group }} | |
| LD_LIBRARY_PATH: "" | |
| - name: Upload Tutorial Artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: "tutorial-cpu-${{ matrix.group }}" | |
| path: | | |
| docs/src/tutorials/beginner/**/* | |
| docs/src/tutorials/intermediate/**/* | |
| docs/src/tutorials/advanced/**/* | |
| tutorial_deps/* | |
| **/*.cov | |
| docs/src/public/examples/**/* | |
| retention-days: 90 | |
| if-no-files-found: error | |
| documentation: | |
| if: ${{ !contains(github.event.head_commit.message, '[skip docs]') }} | |
| runs-on: ubuntu-latest | |
| needs: [tutorial-cpu, tutorial-cuda] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Collect Workflow Telemetry | |
| uses: catchpoint/workflow-telemetry-action@v2 | |
| with: | |
| comment_on_pr: false | |
| job_summary: true | |
| - uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: "1.11" | |
| - uses: julia-actions/cache@v2 | |
| with: | |
| cache-name: julia-cache;workflow=documentation-${{ github.event_name }}-${{ github.event.repository.default_branch }}-${{ github.sha }} | |
| # Download the artifacts from the tutorials | |
| - name: Download Tutorial Artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: "tutorial-*" | |
| path: tutorial_artifacts | |
| merge-multiple: true | |
| - name: Move Documentation Artifacts | |
| run: cp -r tutorial_artifacts/* ./ | |
| - uses: julia-actions/julia-buildpkg@v1 | |
| - uses: julia-actions/julia-docdeploy@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Generate coverage" | |
| run: | | |
| using Pkg | |
| Pkg.activate("coveragetempenv", shared=true) | |
| Pkg.add(PackageSpec(name="CoverageTools")) | |
| using CoverageTools | |
| projectdirs = ["."] | |
| isdir("lib") && append!(projectdirs, readdir("lib/"; join=true)) | |
| directories = [] | |
| for projectdir in projectdirs | |
| if isdir(joinpath(projectdir, "src")) | |
| push!(directories, joinpath(projectdir, "src")) | |
| end | |
| if isdir(joinpath(projectdir, "ext")) | |
| push!(directories, joinpath(projectdir, "ext")) | |
| end | |
| end | |
| filter!(isdir, directories) | |
| pfs = mapreduce(process_folder, vcat, directories) | |
| LCOV.writefile("lcov.info", pfs) | |
| shell: julia --color=yes --threads=auto {0} | |
| - uses: codecov/codecov-action@v5 | |
| with: | |
| files: lcov.info | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| fail_ci_if_error: false | |
| env: | |
| JULIA_DEBUG: "Documenter,Reactant,Reactant_jll,Lux" | |
| DATADEPS_ALWAYS_ACCEPT: true | |
| GKSwstype: "100" # https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988 |