From 8e45e8eeb336f478969975d896232d18fd47d974 Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 16 Dec 2021 13:22:38 +0800 Subject: [PATCH 1/8] [feat] PR with artifact preview --- .github/workflows/CommentPR.yml | 20 ++++++++++++ .github/workflows/PRArtifact.yml | 52 ++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/workflows/CommentPR.yml create mode 100644 .github/workflows/PRArtifact.yml diff --git a/.github/workflows/CommentPR.yml b/.github/workflows/CommentPR.yml new file mode 100644 index 0000000..550b2e7 --- /dev/null +++ b/.github/workflows/CommentPR.yml @@ -0,0 +1,20 @@ +name: Add artifact links to pull request and related issues +on: + workflow_run: + workflows: ["PR artifact"] + types: [completed] + +jobs: + artifacts-url-comments: + name: Add artifact links to PR + runs-on: ubuntu-latest + steps: + - name: Add artifact links to pull request and related issues step + uses: tonyhallett/artifacts-url-comments@v1.1.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + prefix: Here are the Nnotebooks + suffix: Have a nice day. + format: name + addTo: pullandissues \ No newline at end of file diff --git a/.github/workflows/PRArtifact.yml b/.github/workflows/PRArtifact.yml new file mode 100644 index 0000000..fb44033 --- /dev/null +++ b/.github/workflows/PRArtifact.yml @@ -0,0 +1,52 @@ +name: PR artifact +on: + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Julia + uses: julia-actions/setup-julia@v1 + with: + version: 1.7 + + # We set up a folder that Pluto can use to cache exported notebooks. If the notebook file did not change, then Pluto can take the exported file from cache instead of running the notebook. + - name: Set up notebook state cache + uses: actions/cache@v2 + with: + path: pluto_state_cache + key: ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }}-${{ hashFiles('**/*jl') }} + restore-keys: | + ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }} + + + - name: Run & export Pluto notebooks + shell: julia --color=yes --threads=auto {0} + run: | + using Pkg + Pkg.activate(mktempdir()) + Pkg.add([ + Pkg.PackageSpec(name="PlutoSliderServer", version="0.3.2-0.3"), + ]) + + import PlutoSliderServer + + PlutoSliderServer.github_action("."; + Export_cache_dir="pluto_state_cache", + Export_baked_notebookfile=false, + Export_baked_state=false, + # more parameters can go here + ) + + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: pluto-notebooks + path: . + From 264fa07bc568f31a0083a710c35145ec7bcee15d Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 16 Dec 2021 13:34:16 +0800 Subject: [PATCH 2/8] typo --- .github/workflows/CommentPR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CommentPR.yml b/.github/workflows/CommentPR.yml index 550b2e7..6754485 100644 --- a/.github/workflows/CommentPR.yml +++ b/.github/workflows/CommentPR.yml @@ -14,7 +14,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - prefix: Here are the Nnotebooks + prefix: Here are the Notebooks suffix: Have a nice day. format: name addTo: pullandissues \ No newline at end of file From 5119036bc206a540b01dd36d3408b2792f8dd8ac Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 16 Dec 2021 14:09:32 +0800 Subject: [PATCH 3/8] Update CommentPR.yml --- .github/workflows/CommentPR.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CommentPR.yml b/.github/workflows/CommentPR.yml index 6754485..df02e2d 100644 --- a/.github/workflows/CommentPR.yml +++ b/.github/workflows/CommentPR.yml @@ -3,18 +3,19 @@ on: workflow_run: workflows: ["PR artifact"] types: [completed] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: artifacts-url-comments: - name: Add artifact links to PR - runs-on: ubuntu-latest - steps: - - name: Add artifact links to pull request and related issues step - uses: tonyhallett/artifacts-url-comments@v1.1.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - prefix: Here are the Notebooks - suffix: Have a nice day. - format: name - addTo: pullandissues \ No newline at end of file + name: add artifact links to pull request and related issues job + runs-on: ubuntu-latest + steps: + - uses: tonyhallett/artifacts-url-comments@v1.1.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + prefix: Here are the build results + suffix: Artifacts will only be retained for 90 days. + format: name + addTo: pullandissues From 11e36b0238e779f4e177eb470ec75cd68cf1eccc Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 16 Dec 2021 14:58:23 +0800 Subject: [PATCH 4/8] [feat] PR with artifact preview (#2) --- .github/workflows/CommentPR.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CommentPR.yml b/.github/workflows/CommentPR.yml index 550b2e7..df02e2d 100644 --- a/.github/workflows/CommentPR.yml +++ b/.github/workflows/CommentPR.yml @@ -3,18 +3,19 @@ on: workflow_run: workflows: ["PR artifact"] types: [completed] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: artifacts-url-comments: - name: Add artifact links to PR - runs-on: ubuntu-latest - steps: - - name: Add artifact links to pull request and related issues step - uses: tonyhallett/artifacts-url-comments@v1.1.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - prefix: Here are the Nnotebooks - suffix: Have a nice day. - format: name - addTo: pullandissues \ No newline at end of file + name: add artifact links to pull request and related issues job + runs-on: ubuntu-latest + steps: + - uses: tonyhallett/artifacts-url-comments@v1.1.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + prefix: Here are the build results + suffix: Artifacts will only be retained for 90 days. + format: name + addTo: pullandissues From 1f070ccda499cb8b692699c1051f0fc5f0237cdc Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 16 Dec 2021 15:07:19 +0800 Subject: [PATCH 5/8] Pass evne if there is no artifacts --- .github/workflows/CommentPR.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CommentPR.yml b/.github/workflows/CommentPR.yml index df02e2d..4246f83 100644 --- a/.github/workflows/CommentPR.yml +++ b/.github/workflows/CommentPR.yml @@ -19,3 +19,4 @@ jobs: suffix: Artifacts will only be retained for 90 days. format: name addTo: pullandissues + errorNoArtifacts: fails From f0b2afa507500bb8eacb56f5619e3f03e9e5f3f2 Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 16 Dec 2021 15:14:54 +0800 Subject: [PATCH 6/8] merge PR and push workflows --- .github/workflows/CommentPR.yml | 4 +-- .github/workflows/ExportPluto.yaml | 8 +++++ .github/workflows/PRArtifact.yml | 52 ------------------------------ 3 files changed, 10 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/PRArtifact.yml diff --git a/.github/workflows/CommentPR.yml b/.github/workflows/CommentPR.yml index 4246f83..2213717 100644 --- a/.github/workflows/CommentPR.yml +++ b/.github/workflows/CommentPR.yml @@ -1,7 +1,7 @@ name: Add artifact links to pull request and related issues on: workflow_run: - workflows: ["PR artifact"] + workflows: ["Export Pluto notebooks"] types: [completed] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -19,4 +19,4 @@ jobs: suffix: Artifacts will only be retained for 90 days. format: name addTo: pullandissues - errorNoArtifacts: fails + errorNoArtifacts: false diff --git a/.github/workflows/ExportPluto.yaml b/.github/workflows/ExportPluto.yaml index efcf7b8..b033804 100644 --- a/.github/workflows/ExportPluto.yaml +++ b/.github/workflows/ExportPluto.yaml @@ -4,6 +4,7 @@ on: branches: - main - master + pull_request: workflow_dispatch: jobs: @@ -47,9 +48,16 @@ jobs: # more parameters can go here )' + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: pluto-notebooks + path: . + - name: Deploy to gh-pages uses: JamesIves/github-pages-deploy-action@releases/v3 + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages diff --git a/.github/workflows/PRArtifact.yml b/.github/workflows/PRArtifact.yml deleted file mode 100644 index fb44033..0000000 --- a/.github/workflows/PRArtifact.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: PR artifact -on: - pull_request: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Julia - uses: julia-actions/setup-julia@v1 - with: - version: 1.7 - - # We set up a folder that Pluto can use to cache exported notebooks. If the notebook file did not change, then Pluto can take the exported file from cache instead of running the notebook. - - name: Set up notebook state cache - uses: actions/cache@v2 - with: - path: pluto_state_cache - key: ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }}-${{ hashFiles('**/*jl') }} - restore-keys: | - ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }} - - - - name: Run & export Pluto notebooks - shell: julia --color=yes --threads=auto {0} - run: | - using Pkg - Pkg.activate(mktempdir()) - Pkg.add([ - Pkg.PackageSpec(name="PlutoSliderServer", version="0.3.2-0.3"), - ]) - - import PlutoSliderServer - - PlutoSliderServer.github_action("."; - Export_cache_dir="pluto_state_cache", - Export_baked_notebookfile=false, - Export_baked_state=false, - # more parameters can go here - ) - - - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: pluto-notebooks - path: . - From 01d9a03d3aab1508faf436719637ab29271f0985 Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 16 Dec 2021 15:18:46 +0800 Subject: [PATCH 7/8] Merge PR and push workflow (#3) --- .github/workflows/CommentPR.yml | 43 ++++++++++++------------ .github/workflows/ExportPluto.yaml | 8 +++++ .github/workflows/PRArtifact.yml | 52 ------------------------------ 3 files changed, 30 insertions(+), 73 deletions(-) delete mode 100644 .github/workflows/PRArtifact.yml diff --git a/.github/workflows/CommentPR.yml b/.github/workflows/CommentPR.yml index df02e2d..e294a55 100644 --- a/.github/workflows/CommentPR.yml +++ b/.github/workflows/CommentPR.yml @@ -1,21 +1,22 @@ -name: Add artifact links to pull request and related issues -on: - workflow_run: - workflows: ["PR artifact"] - types: [completed] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - artifacts-url-comments: - name: add artifact links to pull request and related issues job - runs-on: ubuntu-latest - steps: - - uses: tonyhallett/artifacts-url-comments@v1.1.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - prefix: Here are the build results - suffix: Artifacts will only be retained for 90 days. - format: name - addTo: pullandissues +name: Add artifact links to pull request and related issues +on: + workflow_run: + workflows: ["Export Pluto notebooks"] + types: [completed] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + artifacts-url-comments: + name: add artifact links to pull request and related issues job + runs-on: ubuntu-latest + steps: + - uses: tonyhallett/artifacts-url-comments@v1.1.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + prefix: Here are the build results + suffix: Artifacts will only be retained for 90 days. + format: name + addTo: pullandissues + errorNoArtifacts: false diff --git a/.github/workflows/ExportPluto.yaml b/.github/workflows/ExportPluto.yaml index efcf7b8..b033804 100644 --- a/.github/workflows/ExportPluto.yaml +++ b/.github/workflows/ExportPluto.yaml @@ -4,6 +4,7 @@ on: branches: - main - master + pull_request: workflow_dispatch: jobs: @@ -47,9 +48,16 @@ jobs: # more parameters can go here )' + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: pluto-notebooks + path: . + - name: Deploy to gh-pages uses: JamesIves/github-pages-deploy-action@releases/v3 + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages diff --git a/.github/workflows/PRArtifact.yml b/.github/workflows/PRArtifact.yml deleted file mode 100644 index fb44033..0000000 --- a/.github/workflows/PRArtifact.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: PR artifact -on: - pull_request: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Julia - uses: julia-actions/setup-julia@v1 - with: - version: 1.7 - - # We set up a folder that Pluto can use to cache exported notebooks. If the notebook file did not change, then Pluto can take the exported file from cache instead of running the notebook. - - name: Set up notebook state cache - uses: actions/cache@v2 - with: - path: pluto_state_cache - key: ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }}-${{ hashFiles('**/*jl') }} - restore-keys: | - ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }} - - - - name: Run & export Pluto notebooks - shell: julia --color=yes --threads=auto {0} - run: | - using Pkg - Pkg.activate(mktempdir()) - Pkg.add([ - Pkg.PackageSpec(name="PlutoSliderServer", version="0.3.2-0.3"), - ]) - - import PlutoSliderServer - - PlutoSliderServer.github_action("."; - Export_cache_dir="pluto_state_cache", - Export_baked_notebookfile=false, - Export_baked_state=false, - # more parameters can go here - ) - - - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: pluto-notebooks - path: . - From 6d8ad8f9a3ad471625f9809e4e74c3d3fbbf2794 Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 16 Dec 2021 15:37:42 +0800 Subject: [PATCH 8/8] continue on error --- .github/workflows/CommentPR.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CommentPR.yml b/.github/workflows/CommentPR.yml index e294a55..dfc96cc 100644 --- a/.github/workflows/CommentPR.yml +++ b/.github/workflows/CommentPR.yml @@ -10,6 +10,7 @@ jobs: artifacts-url-comments: name: add artifact links to pull request and related issues job runs-on: ubuntu-latest + continue-on-error: true steps: - uses: tonyhallett/artifacts-url-comments@v1.1.0 env: @@ -18,5 +19,4 @@ jobs: prefix: Here are the build results suffix: Artifacts will only be retained for 90 days. format: name - addTo: pullandissues - errorNoArtifacts: false + addTo: pull