-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create nightly builds #369
Changes from 34 commits
cd78bdf
230d1cd
1bb2f20
7208eae
42531b6
18ca56e
4870454
8e11abe
2cb0822
f3c456d
3e9a8e2
796aaae
ed656e5
7d222b5
f115f93
9acff7e
5ea24dc
5df807b
716ebaf
6e513af
baa201f
a2e8f26
87c0b11
9544654
c239cfb
ef7843a
835df84
1c9b839
00dc19b
e2570b8
947f37d
5277083
843feda
08caa11
dc8b64e
6a29155
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Nightly | ||
|
||
on: | ||
push: | ||
## Allow manual invocation | ||
#workflow_dispatch: | ||
#schedule: | ||
# - cron: '0 5 * * *' # UTC | ||
|
||
env: | ||
DIST_ROOT: '/ipns/dist.ipfs.io' # content root used for calculating diff to build | ||
GO_IPFS_VER: 'v0.9.1' # go-ipfs daemon used for chunking and applying diff | ||
CLUSTER_CTL_VER: 'v0.14.0' # ipfs-cluster-ctl used for pinning | ||
|
||
concurrency: | ||
group: nightly | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
prepare-matrix: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: set-matrix | ||
run: echo "::set-output name=matrix::$(jq -nc '$ARGS.positional' --args $(ls ./dists -1))" | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
|
||
build: | ||
runs-on: "ubuntu-latest" | ||
needs: prepare-matrix | ||
strategy: | ||
max-parallel: 15 # avoid using all workers from the org pool | ||
fail-fast: false | ||
matrix: | ||
dist_name: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup IPFS | ||
run: ./scripts/ci/setup-ipfs.sh | ||
env: | ||
CLUSTER_USER: ${{ secrets.CLUSTER_USER }} | ||
CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }} | ||
timeout-minutes: 5 | ||
- run: cd ./dists/${{ matrix.dist_name }} && make nightly | ||
- run: ./dockerized make publish | ||
- name: Create issue if build failed | ||
uses: actions/github-script@v4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ Third-party turn-key solutions exists, but I decided to give Debugging is a bit painful, but being written in JS could make it more dev friendly than bash+curl, allowing more people to maintain/extend. We may leverage it even more for developer flow automation tailored to our needs. For example, it could automatically create/label issues and add them to specific column in specific project. |
||
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.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.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.issues.createComment({ ...opts, | ||
issue_number: issue.number, | ||
body | ||
}) | ||
console.log('commented on existing open issue', created) | ||
link = created.data.html_url | ||
} | ||
await github.repos.createCommitStatus({ ...opts, | ||
sha: '${{ github.sha }}', | ||
state: 'error', | ||
target_url: link, | ||
context: 'Problem with ${{ matrix.dist_name }}', | ||
description: 'See details in the linked issue' | ||
}) | ||
- 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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ this pins nightly artifacts only for a week |
||
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 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ we will remove
push
and restoreschedule
for cron trigger +workflow_dispatch
for running nightly builds on-demand