Nightly #1089
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly | |
on: | |
workflow_dispatch: | |
inputs: | |
dist_root: | |
description: 'DIST_ROOT' | |
required: true | |
default: '/ipns/dist.ipfs.tech' | |
schedule: | |
- cron: '0 1 * * 1' # every monday morning, so we catch regressions during weekly triage | |
env: | |
DIST_ROOT: ${{ github.event.inputs.custom_dist_root || '/ipns/dist.ipfs.tech' }} # content root used for calculating diff to build | |
KUBO_VER: 'v0.28.0' # kubo daemon used for chunking and applying diff | |
CLUSTER_CTL_VER: 'v1.0.8' # ipfs-cluster-ctl used for pinning | |
concurrency: | |
group: nightly | |
cancel-in-progress: true | |
jobs: | |
prepare-matrix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: awk 'NR == FNR {f1[$0] = 1; next}; !($0 in f1)' ignored-during-nightly <(ls ./dists -1) > nightlies-to-run | |
- id: set-matrix | |
run: echo "::set-output name=matrix::$(jq -nc '$ARGS.positional' --args $(cat nightlies-to-run))" | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
build: | |
runs-on: "ubuntu-latest" | |
needs: prepare-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
dist_name: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- env: | |
CLUSTER_USER: ${{ secrets.CLUSTER_USER }} | |
CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }} | |
uses: ./.github/actions/setup-ipfs | |
timeout-minutes: 30 | |
- run: cd ./dists/${{ matrix.dist_name }} && make nightly | |
- run: ./dockerized make publish | |
- name: Create issue if build failed | |
uses: actions/github-script@v6 | |
if: ${{ failure() }} | |
with: | |
script: | | |
const title = 'Nightly build failed for ${{ matrix.dist_name }}' | |
const body = '${{ matrix.dist_name }} failed to build from the latest commit: https://github.com/ipfs/distributions/actions/runs/${{ github.run_id }}' | |
const opts = { owner: context.repo.owner, repo: context.repo.repo } | |
const response = await github.rest.search.issuesAndPullRequests({ | |
q: `repo:ipfs/distributions is:issue is:open in:title ${title}` | |
}) | |
console.log('github.issuesAndPullRequests', response) | |
let link | |
if (response.data.items.length === 0) { | |
const created = await github.rest.issues.create({ ...opts, title, body, | |
labels: ['kind/bug', 'need/triage'] | |
}) | |
console.log('no open issues, created a new one', created) | |
link = created.data.html_url | |
} | |
for (const issue of response.data.items) { | |
if (issue.title !== title) continue | |
console.log('found existing open issue', issue) | |
const created = await github.rest.issues.createComment({ ...opts, | |
issue_number: issue.number, | |
body | |
}) | |
console.log('commented on existing open issue', created) | |
link = created.data.html_url | |
} | |
- name: Inspect git status and contents of ./releases | |
run: git status && ls -Rhl ./releases | |
- name: Read CID of updated DAG | |
id: cid-reader | |
run: echo "::set-output name=CID::$(tail -1 ./versions)" | |
- name: Pin new website to ipfs-websites.collab.ipfscluster.io | |
run: ./scripts/ci/pin-to-cluster.sh | |
env: | |
PIN_CID: ${{ steps.cid-reader.outputs.CID }} | |
PIN_NAME: "ipfs/distributions/nightly/${{ matrix.dist_name }}" | |
PIN_ADD_EXTRA_ARGS: "--expire-in 168h" | |
CLUSTER_USER: ${{ secrets.CLUSTER_USER }} | |
CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }} | |
timeout-minutes: 60 | |
- name: Update PR status with preview link | |
run: ./scripts/ci/github-preview-link.sh | |
env: | |
GITHUB_TITLE: "Preview for ${{ matrix.dist_name }}" | |
CONTENT_PATH: "/ipfs/${{ steps.cid-reader.outputs.CID }}/${{ matrix.dist_name }}" | |
GIT_REVISION: ${{ github.sha }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Close any open issues about broken build | |
uses: actions/github-script@v6 | |
if: ${{ success() }} | |
with: | |
script: | | |
const title = 'Nightly build failed for ${{ matrix.dist_name }}' | |
const body = 'Fixed! ${{ matrix.dist_name }} got successfully built from the latest commit: https://github.com/ipfs/distributions/actions/runs/${{ github.run_id }}' | |
const opts = { owner: context.repo.owner, repo: context.repo.repo } | |
const response = await github.rest.search.issuesAndPullRequests({ | |
q: `repo:ipfs/distributions is:issue is:open in:title ${title}` | |
}) | |
console.log('github.issuesAndPullRequests', response) | |
for (const issue of response.data.items) { | |
if (issue.title !== title) continue | |
console.log('found existing open issue', issue) | |
const created = await github.rest.issues.createComment({ ...opts, | |
issue_number: issue.number, | |
body | |
}) | |
await github.rest.issues.update({ ...opts, | |
issue_number: issue.number, | |
state: 'closed', | |
assignees: [] | |
}) | |
console.log('commented and closed existing open issue', created) | |
} |