Skip to content

Commit

Permalink
chore(ci): additional pin to scaleway (#107)
Browse files Browse the repository at this point in the history
* chore(ci): pin to scaleway
* fix(scaleway): skip if already pinned
* refactor: smoke-test-http after pins
* fix(scaleway): work around broken --cid filter
  • Loading branch information
lidel authored Mar 13, 2024
1 parent 9ffc72e commit 220e9cb
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 18 deletions.
57 changes: 47 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- '**'
workflow_dispatch:

env:
KUBO_VER: 'v0.27.0' # kubo daemon used for publishing to IPFS
CLUSTER_CTL_VER: 'v1.0.8' # ipfs-cluster-ctl used by publish-to-ipfs

jobs:

Expand Down Expand Up @@ -173,9 +176,6 @@ jobs:
# only one job runs at a time == DNSLinks are updated in-order
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
KUBO_VER: 'v0.26.0' # kubo daemon used for publishing to IPFS
CLUSTER_CTL_VER: 'v1.0.8' # ipfs-cluster-ctl used for pinning
outputs:
cid: ${{ steps.ipfs-import.outputs.cid }}
steps:
Expand Down Expand Up @@ -312,15 +312,52 @@ jobs:
W3_PRINCIPAL: ${{ secrets.W3_AGENT_PRINCIPAL }}
W3CLI_SPACE_DELEGATION_PROOF_BASE64_STRING: ${{ secrets.W3CLI_SPACE_DELEGATION_PROOF_BASE64_STRING }}

smoke-test--http: # basic smoke test that lets us know when eother caching or content routing does not work
pin-to-scaleway:
if: ${{ success() && needs.publish-to-ipfs.outputs.cid }}
needs: publish-to-ipfs
runs-on: ubuntu-latest
environment: Scaleway
steps:
- name: Smoke-test instant (cached) /ipfs-sw-main.js at inbrowser.link
run: curl --retry 3 --retry-delay 61 -s -D - -o /dev/null https://inbrowser.link/ipfs-sw-main.js
- name: Smoke-test instant (cached) /ipfs-sw-main.js at inbrowser.dev
run: curl --retry 3 --retry-delay 61 -s -D - -o /dev/null https://inbrowser.dev/ipfs-sw-main.js
- name: Smoke-test fetching full DAG as CAR from trustless-gateway.link
run: curl --retry 3 --retry-delay 61 -s -D - -o /dev/null "https://trustless-gateway.link/ipfs/${{ needs.publish-to-ipfs.outputs.cid }}?format=car"
- uses: actions/checkout@v4
- uses: ipfs/download-ipfs-distribution-action@v1
with:
name: kubo
version: "${{ env.KUBO_VER }}"
- name: Init IPFS daemon
run: ipfs init --profile flatfs,server,randomports,lowpower
- uses: ipfs/start-ipfs-daemon-action@v1
with:
args: --enable-gc=false
- name: Retrieve CAR produced by publish-to-ipfs job
uses: actions/download-artifact@v4
with:
name: dist_${{ github.sha }}.car
- name: Import CAR to local Kubo
run: ipfs dag import --offline dist_${{ github.sha }}.car
- name: Set up and check Scaleway
id: scaleway
run: |
ipfs pin remote service add scaleway "$SCALEWAY_URL" "$SCALEWAY_SECRET"
echo "existing-pin=$(ipfs pin remote ls --service=scaleway --name=$CID)" >> $GITHUB_OUTPUT # using --name because --cid does not work with Scaleway (2024-Q1)
env:
CID: ${{ needs.publish-to-ipfs.outputs.cid }}
SCALEWAY_SECRET: ${{ secrets.SCALEWAY_SECRET }}
SCALEWAY_URL: ${{ secrets.SCALEWAY_URL }}
- name: Pin to Scaleway
if: ${{ steps.scaleway.outputs.existing-pin == '' }}
run: ipfs pin remote add --service=scaleway --name=$CID $CID # using --name because --cid does not work with Scaleway (2024-Q1)
env:
CID: ${{ needs.publish-to-ipfs.outputs.cid }}

smoke-test-http: # basic smoke test that lets us know when eother caching or content routing does not work
if: ${{ success() && needs.publish-to-ipfs.outputs.cid }}
needs: [ publish-to-ipfs, pin-to-scaleway, pin-to-w3 ]
runs-on: ubuntu-latest
steps:
- name: Smoke-test instant (cached, stale-while-revalidate) /ipfs-sw-main.js at inbrowser.link
run: curl --retry 3 --retry-delay 61 --retry-all-errors -v https://inbrowser.link/ipfs-sw-main.js > /dev/null
- name: Smoke-test instant (cached, stale-while-revalidate) /ipfs-sw-main.js at inbrowser.dev
run: curl --retry 3 --retry-delay 61 --retry-all-errors -v https://inbrowser.dev/ipfs-sw-main.js > /dev/null
- name: Smoke-test fetching the new CID as CAR from trustless-gateway.link
run: curl --retry 3 --retry-delay 61 --retry-all-errors -v "https://trustless-gateway.link/ipfs/${{ needs.publish-to-ipfs.outputs.cid }}?format=car" > /dev/null

24 changes: 17 additions & 7 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!--
This HTML page initializes IPFS Service Worker Gateway.
The HTTP server behind this HTTP URL does not host this website.
Instead, it sends basic website code along with JavaScript. The JS sets
up a tool called IPFS Service Worker Gateway in the user's browser and
uses JavaScript version of IPFS (https://helia.io/) to get IPFS blocks
from content providers.
CID hash verification and data assembly happens in the browser.
Learn more about it here: https://github.com/ipfs-shipyard/helia-service-worker-gateway
-->
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title><%= htmlWebpackPlugin.options.title %></title>

<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/css/tachyons.min.css"
/>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/ipfs.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/tachyons.min.css" integrity="sha256-MgEf5i1a74lVzhT+1R6mBbWCUeUaxC8sQTaN5GY+CoI=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/ipfs.css" integrity="sha256-tlU/gvVvLjSbTOfSZyCzuQxY8QcmHPtJJ1oTXilA9gk=" crossorigin="anonymous">
</head>
<body>
<div id="root" class="montserrat f5"></div>
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const common = {
// Generates deprecation warning: https://github.com/jantimon/html-webpack-plugin/issues/1501
new HtmlWebpackPlugin({
excludeChunks: ['sw'],
title: 'Helia service worker gateway',
title: 'IPFS Service Worker Gateway',
favicon: paths.public + '/favicon.ico',
template: paths.public + '/index.html', // template file
filename: 'index.html', // output file,
Expand Down

0 comments on commit 220e9cb

Please sign in to comment.