diff --git a/workflow-templates/build.yml b/workflow-templates/build.yml new file mode 100644 index 0000000..e69de29 diff --git a/workflow-templates/docs.yml b/workflow-templates/docs.yml new file mode 100644 index 0000000..e69de29 diff --git a/workflow-templates/downstream.yml b/workflow-templates/downstream.yml new file mode 100644 index 0000000..48013b8 --- /dev/null +++ b/workflow-templates/downstream.yml @@ -0,0 +1,130 @@ +name: "Reusable Downstream Tests Workflow" + +on: + workflow_call: + inputs: + julia-version: + description: "Julia version" + default: 1 + required: false + type: string + julia-arch: + description: "Architecture of Julia to be used" + required: false + type: string + owner: + description: "The owner of the downstream repository that needs to be tested" + required: false + default: "SciML" + type: string + repo: + description: "The name of the downstream repository that needs to be tested" + required: true + type: string + group: + description: "The 'GROUP' of tests that need to be run. This will requires an ENV `GROUP` to be (conditionally) defined within your package tests as well to selectively run groups of tests" + default: "All" + required: false + type: string + self-hosted: + description: "Run the job needs on a self hosted machine" + default: false + required: false + type: boolean + os: + description: "The machine configuration on which the job needs to be run." + default: "ubuntu-latest" + required: false + type: string + cache: + description: "Use the julia-actions/cache action for caching" + default: true + required: false + type: boolean + buildpkg: + description: "Use the julia-actions/buildpkg action to build the package first" + default: true + required: false + type: boolean + coverage: + description: "Collect and generate code coverage-related information" + default: true + required: false + type: boolean + julia-runtest-depwarn: + description: "Value of the --depwarn flag while running Julia" + default: "error" + required: false + type: string + continue-on-error: + description: "Prevent the workflow run from failing if/when the job fails" + required: false + type: boolean + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] + +jobs: + downstream-tests: + name: "Downstream Tests${{ inputs.group != '' && format(' - {0}', inputs.group) || '' }} ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}" + strategy: + fail-fast: false + matrix: + version: + - '1.10' + - '1.11' + continue-on-error: ${{ inputs.continue-on-error || inputs.julia-version == 'nightly' }} + runs-on: "${{ inputs.self-hosted && 'self-hosted' || inputs.os }}" + steps: + - name: "Checkout ${{ github.repository }}" + uses: actions/checkout@v4 + + - name: "Checkout Downstream ${{ inputs.owner }}/${{ inputs.repo }}" + uses: actions/checkout@v4 + with: + repository: "${{ inputs.owner }}/${{ inputs.repo }}" + path: "downstream" + + - name: "Setup Julia ${{ inputs.julia-version }}" + uses: julia-actions/setup-julia@v2 + with: + version: "${{ inputs.julia-version }}" + arch: "${{ inputs.julia-arch || runner.arch }}" + + - uses: julia-actions/cache@v1 + if: "${{ inputs.cache }}" + with: + token: "${{ secrets.GITHUB_TOKEN }}" + + - uses: julia-actions/julia-buildpkg@v1 + if: "${{ inputs.buildpkg }}" + + - name: "Run tests ${{ inputs.self-hosted && '' || format('on {0}', inputs.os) }} with Julia v${{ inputs.julia-version }}" + shell: julia --color=yes --project=downstream {0} + run: | + using Pkg + try + # force it to use this PR's version of the package + Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps + Pkg.update() + Pkg.test(coverage=${{ inputs.coverage }}) # resolver may fail with test time deps + catch err + err isa Pkg.Resolve.ResolverError || rethrow() + + # If we can't resolve that means this is incompatible by SemVer and this is fine + # It means we marked this as a breaking change, so we don't need to worry about + # Mistakenly introducing a breaking change, as we have intentionally made one + @info "Not compatible with this release. No problem." exception=err + exit(0) # Exit immediately, as a success + end + + - uses: julia-actions/julia-processcoverage@v1 + + - name: "Report Coverage with Codecov" + if: "${{ inputs.coverage }}" + uses: codecov/codecov-action@v4 + with: + files: lcov.info + token: "${{ secrets.CODECOV_TOKEN }}" + fail_ci_if_error: true diff --git a/workflow-templates/format.yml b/workflow-templates/format.yml new file mode 100644 index 0000000..e69de29 diff --git a/workflow-templates/test.yml b/workflow-templates/test.yml new file mode 100644 index 0000000..e69de29