Skip to content

update TRUNK subsolver usage to new keyword API and add note on allowed subsolvers and tolerances #157

update TRUNK subsolver usage to new keyword API and add note on allowed subsolvers and tolerances

update TRUNK subsolver usage to new keyword API and add note on allowed subsolvers and tolerances #157

name: Deploy internal
on:
pull_request:
branches:
- main
paths:
- "**/*.jmd"
- "**/Project.toml"
jobs:
generate-job-strategy-matrix:
runs-on: ubuntu-latest
outputs:
job-strategy-matrix: ${{ steps.generate.outputs.job-strategy-matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 5
- name: Generate MATRIX
id: generate
run: |
MATRIX=$( (
echo '{ "tutorial": ['
git diff --name-only HEAD HEAD~1 | grep -E "(jmd|Project.toml)" | sed 's/Project.toml/index.jmd/g' | uniq | sed -r 's/(.*)/\"\1\"/g' | sed '$!s/$/,/'
echo ']}'
) | jq -c .)
echo $MATRIX
echo $MATRIX | jq .
echo "::set-output name=job-strategy-matrix::$MATRIX"
build-tutorials:
needs: generate-job-strategy-matrix
runs-on: ubuntu-latest
if: ${{ needs.generate-job-strategy-matrix.outputs.job-strategy-matrix != '[]' }}
strategy:
matrix: ${{ fromJSON(needs.generate-job-strategy-matrix.outputs.job-strategy-matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install Julia
uses: julia-actions/setup-julia@v1
with:
version: 1
- name: Build tutorial
run: |
bash .github/workflows/build_tutorial.sh ${{ matrix.tutorial }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: markdown/*
deploy:
needs: [generate-job-strategy-matrix, build-tutorials]
runs-on: ubuntu-latest
if: ${{ needs.generate-job-strategy-matrix.outputs.job-strategy-matrix != '[]' }}
steps:
- name: Download current gh-pages
run: |
wget https://github.com/JuliaSmoothOptimizers/JSOTutorials.jl/archive/refs/heads/gh-pages.zip
unzip gh-pages.zip
- name: Download artifact
uses: actions/download-artifact@v3
with:
path: .
- name: list
run: ls -R
- name: Merge gh-pages and updates and update index.md
run: |
cp -rf artifact/* JSOTutorials.jl-gh-pages/
cd JSOTutorials.jl-gh-pages
echo "## JSOTutorials preview page
For the complete list of tutorials, go to <https://jso.dev/tutorials/>.
" > index.md
for file in **/*.md; do NAME=$(echo $file | cut -d/ -f 1); TITLE=$(grep "title:" $file | cut -d\" -f2); echo "- [$TITLE]($NAME/)"; done >> index.md
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./JSOTutorials.jl-gh-pages
enable_jekyll: true
pr_comment:
needs: [generate-job-strategy-matrix, build-tutorials, deploy]
runs-on: ubuntu-latest
if: ${{ needs.generate-job-strategy-matrix.outputs.job-strategy-matrix != '[]' }}
steps:
- name: "Comment PR"
uses: actions/[email protected]
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this is a pull request build AND the pull request is NOT made from a fork
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
github.issues.createComment({ issue_number, owner, repo, body: 'Once the build has completed, you can preview your PR at this URL: https://jso.dev/JSOTutorials.jl/' });