Make Crystal Immutable #2032
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: run-tests | |
| on: | |
| push: | |
| branches: | |
| - '**master**' | |
| - '**_run_ci**' | |
| - '**release**' | |
| pull_request: | |
| types: [opened, reopened, labeled, synchronize] | |
| workflow_dispatch: | |
| inputs: | |
| push_coverage_badge: | |
| description: 'Push coverage badge (even if not running on master)' | |
| required: true | |
| type: boolean | |
| default: false | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/ruff-action@v3 | |
| with: | |
| version: "0.11.0" # It looks like 0.11.1 is bugged | |
| test: | |
| needs: lint | |
| if: | | |
| github.event_name != 'pull_request' || | |
| (github.event.action == 'labeled' && github.event.label.name == 'run_ci') || | |
| (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'no_ci')) | |
| strategy: | |
| matrix: | |
| config: | |
| - os: ubuntu-latest | |
| skip: false | |
| all-python-versions: ${{(github.event_name != 'pull_request')}} | |
| coverage: true | |
| - os: windows-latest | |
| skip: false | |
| all-python-versions: ${{(github.event_name != 'pull_request')}} | |
| coverage: false | |
| - os: macos-latest | |
| skip: false | |
| all-python-versions: ${{(github.event_name != 'pull_request')}} | |
| coverage: false | |
| - os: macos-15-intel | |
| skip: ${{ github.event_name == 'pull_request' }} | |
| all-python-versions: true | |
| coverage: false | |
| fail-fast: false | |
| uses: ./.github/workflows/test_checkout_one_os.yml | |
| with: | |
| os: ${{ matrix.config.os }} | |
| skip: ${{ matrix.config.skip }} | |
| all-python-versions: ${{ matrix.config.all-python-versions }} | |
| coverage: ${{ matrix.config.coverage }} | |
| secrets: inherit | |
| test-gcc14: | |
| needs: lint | |
| uses: ./.github/workflows/test_gcc14.yml | |
| test-docs: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| if: success() || failure() | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Update pip and install dependencies | |
| shell: bash -l {0} | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r tests_and_analysis/ci_requirements.txt | |
| python -m pip install -r doc/requirements.txt | |
| python -m pip install .[matplotlib,phonopy-reader,brille] | |
| - name: Run Sphinx doctests | |
| working-directory: ./doc | |
| shell: bash -l {0} | |
| run: sphinx-build -c source -b doctest source . | |
| - name: Upload docstest results | |
| if: success() || failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Doctest results | |
| path: doc/output.txt | |
| publish-test-results: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: success() || failure() | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Publish test results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: artifacts/**/junit_report*.xml | |
| publish-coverage: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| name: 'Coverage XML (ubuntu-latest)' | |
| - name: Get Coverage | |
| uses: orgoro/coverage@v3.2 | |
| continue-on-error: true | |
| with: | |
| coverageFile: 'artifacts/coverage-combined.xml' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| publish-coverage-badge: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: ${{(github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_dispatch' && inputs.push_coverage_badge)}} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: badges | |
| fetch-depth: 0 | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: . | |
| name: 'Coverage Badge (ubuntu-latest)' | |
| - uses: EndBug/add-and-commit@v9 | |
| with: | |
| add: 'badge_shieldsio_linecoverage_lightgrey.svg' | |
| message: 'Update coverage badge' |