diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 000000000..b3170539a --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,73 @@ +name: CI +on: + push: + branches: + - main + tags: ['*'] + pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + permissions: # needed for julia-actions/cache delete old caches that it has created + actions: write + contents: read + continue-on-error: ${{ matrix.version == 'pre' }} + strategy: + fail-fast: false + matrix: + version: + - 'lts' # long-term support release + - '1' # latest stable 1.x release + - 'pre' # latest stable prerelease + # - 'nightly' # commented since noisy + 'pre' allows testing upcoming versions + os: + - ubuntu-latest + - macos-latest + - windows-latest + arch: + - x64 + - aarch64 + exclude: + - os: ubuntu-latest + arch: aarch64 + - os: macos-latest + arch: x64 + - os: macos-latest + version: pre + - os: windows-latest + arch: aarch64 + - os: windows-latest + version: pre + steps: + - name: Set JULIA_DEBUG environment variable if applicable + if: ${{ runner.debug == '1' }} + run: echo "JULIA_DEBUG=ModelPredictiveControl" >> $GITHUB_ENV + - uses: actions/checkout@v7 + - uses: julia-actions/setup-julia@v3 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: actions/cache@v6 + env: + cache-name: cache-artifacts + with: + path: ~/.julia/artifacts + key: ${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}- + ${{ runner.os }}-${{ matrix.arch }}-test- + ${{ runner.os }}-${{ matrix.arch }}- + ${{ runner.os }}- + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v7 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false \ No newline at end of file diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml new file mode 100644 index 000000000..752a16dde --- /dev/null +++ b/.github/workflows/Documentation.yml @@ -0,0 +1,25 @@ +name: Documentation + +on: + push: + branches: + - main # update to match your development branch (master, main, dev, trunk, ...) + tags: '*' + pull_request: + +jobs: + build: + name: Documentation + permissions: + contents: write + statuses: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: julia-actions/setup-julia@v3 + with: + version: '1' + - uses: julia-actions/cache@v3 + - uses: julia-actions/julia-docdeploy@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/juliaci.yml b/.github/workflows/juliaci.yml deleted file mode 100644 index c912170c8..000000000 --- a/.github/workflows/juliaci.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Julia CI - -on: - push: {branches: [main,master], tags: ['**']} - pull_request: {types: [opened,synchronize,reopened,ready_for_review,converted_to_draft]} - issue_comment: {types: [created]} - workflow_dispatch: - inputs: - feature: - type: choice - description: What to run - options: [DocDeploy, LintAndTest, TagBot] - -jobs: - julia-ci: - uses: franckgaga/testitem-workflow/.github/workflows/juliaci.yml@patch-1 - with: - include-windows-x86: false # not worth it, windows 32bit is too uncommon - include-macos-x64: false # most mac are aarch64 nowadays - include-linux-x86: false # would like to include it, but too unreliable for now - permissions: write-all - secrets: - codecov_token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 706043774..0b5d8ffa0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # ModelPredictiveControl.jl -[![Build Status](https://github.com/JuliaControl/ModelPredictiveControl.jl/actions/workflows/juliaci.yml/badge.svg?branch=main)](https://github.com/JuliaControl/ModelPredictiveControl.jl/actions/workflows/juliaci.yml?query=branch%3Amain) +[![Build Status](https://github.com/JuliaControl/ModelPredictiveControl.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaControl/ModelPredictiveControl.jl/actions/workflows/juliaci.yml?query=branch%3Amain) [![codecov](https://codecov.io/gh/JuliaControl/ModelPredictiveControl.jl/branch/main/graph/badge.svg?token=K4V0L113M4)](https://codecov.io/gh/JuliaControl/ModelPredictiveControl.jl) [![Aqua QA](https://juliatesting.github.io/Aqua.jl/dev/assets/badge.svg)](https://github.com/JuliaTesting/Aqua.jl) [![doc-stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaControl.github.io/ModelPredictiveControl.jl/stable) diff --git a/test/3_test_predictive_control.jl b/test/3_test_predictive_control.jl index 4475b4404..711b2b878 100644 --- a/test/3_test_predictive_control.jl +++ b/test/3_test_predictive_control.jl @@ -729,7 +729,7 @@ end @testitem "ExplicitMPC autodiff" setup=[SetupMPCtests] begin using .SetupMPCtests, ControlSystemsBase, LinearAlgebra - using ForwardDiff + using Logging, ForwardDiff A = [0.9 0.08; -0.15 0.75] Bu = [0.005, 0.09] @@ -743,7 +743,10 @@ end return moveinput!(mpc, [1.0])[1] end @test_nowarn first_move(0.5) - @test_nowarn ForwardDiff.derivative(first_move, 0.5) + errorlogger = ConsoleLogger(stderr, Logging.Error) + @test_nowarn with_logger(errorlogger) do + ForwardDiff.derivative(first_move, 0.5) + end end