Skip to content

Commit

Permalink
use latest github folder
Browse files Browse the repository at this point in the history
  • Loading branch information
divagant-martian committed Jul 26, 2024
1 parent b88dfa5 commit f908c26
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 20 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Keep GitHub Actions up to date with GitHub's Dependabot...
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
version: 2
updates:
- package-ecosystem: github-actions
directory: /
groups:
github-actions:
patterns:
- "*" # Group all Actions updates into a single larger pull request
schedule:
interval: weekly
27 changes: 17 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- armv7-linux-androideabi
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
Expand All @@ -92,13 +92,13 @@ jobs:
run: rustup target add ${{ matrix.target }}

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3

- name: Setup Android NDK
uses: arqu/setup-ndk@main
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
with:
fetch-depth: 0
- name: Install sccache
uses: mozilla-actions/[email protected].4
uses: mozilla-actions/[email protected].5

- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:
components: rustfmt

- name: Install sccache
uses: mozilla-actions/[email protected].4
uses: mozilla-actions/[email protected].5

- name: fmt
run: cargo fmt --all -- --check
Expand All @@ -226,7 +226,7 @@ jobs:
with:
toolchain: nightly-2024-05-02
- name: Install sccache
uses: mozilla-actions/[email protected].4
uses: mozilla-actions/[email protected].5

- name: Docs
run: cargo doc --workspace --all-features --no-deps --document-private-items
Expand All @@ -245,7 +245,7 @@ jobs:
with:
components: clippy
- name: Install sccache
uses: mozilla-actions/[email protected].4
uses: mozilla-actions/[email protected].5

# TODO: We have a bunch of platform-dependent code so should
# probably run this job on the full platform matrix
Expand Down Expand Up @@ -286,7 +286,7 @@ jobs:
with:
toolchain: ${{ env.MSRV }}
- name: Install sccache
uses: mozilla-actions/[email protected].4
uses: mozilla-actions/[email protected].5

- name: Check MSRV all features
run: |
Expand Down Expand Up @@ -425,7 +425,7 @@ jobs:
toolchain: stable

- name: Install sccache
uses: mozilla-actions/[email protected].4
uses: mozilla-actions/[email protected].5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -449,4 +449,11 @@ jobs:
- name: Cleanup Docker
continue-on-error: true
run: |
docker kill $(docker ps -q)
docker kill $(docker ps -q)
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: pip install --user codespell[toml]
- run: codespell --ignore-words-list=ans,crate,inout,ratatui,ser,stayin,swarmin,worl --skip=CHANGELOG.md
2 changes: 1 addition & 1 deletion .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
steps:
- name: check-for-cc
id: check-for-cc
uses: agenthunt/conventional-commit-checker-action@v1.0.0
uses: agenthunt/conventional-commit-checker-action@v2.0.0
with:
pr-title-regex: "^(.+)(?:(([^)s]+)))?!?: (.+)"
112 changes: 112 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Docker

on:
workflow_dispatch:
inputs:
release_version:
description: "Release version"
required: true
type: string
default: ""
base_hash:
description: "Commit hash from which to build"
required: true
type: string
default: ""
publish:
description: "Publish to Docker Hub"
required: true
type: boolean
default: false
workflow_call:
inputs:
release_version:
description: "Release version"
required: true
type: string
default: ""
base_hash:
description: "Commit hash from which to build"
required: true
type: string
default: ""
publish:
description: "Publish to Docker Hub"
required: true
type: boolean
default: false

jobs:
build_and_publish:
timeout-minutes: 30
name: Docker
runs-on: [self-hosted, linux, X64]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Prep dirs
run: |
mkdir -p bins/linux/amd64
mkdir -p bins/linux/arm64
- name: Setup awscli on linux
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
- name: Set aws credentials
run: |
echo "AWS_ACCESS_KEY_ID=${{secrets.S3_ACCESS_KEY_ID}}" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=${{secrets.S3_ACCESS_KEY}}" >> $GITHUB_ENV
echo "AWS_DEFAULT_REGION=us-west-2" >> $GITHUB_ENV
- name: Fetch release binaries
run: |
aws s3 cp s3://vorc/iroh-linux-amd64-${{ github.event.inputs.base_hash }} bins/linux/amd64/iroh
aws s3 cp s3://vorc/iroh-relay-linux-amd64-${{ github.event.inputs.base_hash }} bins/linux/amd64/iroh-relay
aws s3 cp s3://vorc/iroh-dns-server-linux-amd64-${{ github.event.inputs.base_hash }} bins/linux/amd64/iroh-dns-server
aws s3 cp s3://vorc/iroh-linux-aarch64-${{ github.event.inputs.base_hash }} bins/linux/arm64/iroh
aws s3 cp s3://vorc/iroh-relay-linux-aarch64-${{ github.event.inputs.base_hash }} bins/linux/arm64/iroh-relay
aws s3 cp s3://vorc/iroh-dns-server-linux-aarch64-${{ github.event.inputs.base_hash }} bins/linux/arm64/iroh-dns-server
- name: Build Docker image (iroh)
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: n0computer/iroh:latest,n0computer/iroh:${{ github.event.inputs.release_version }}
target: iroh
platforms: linux/amd64,linux/arm64/v8
file: docker/Dockerfile.ci

- name: Build Docker image (iroh-relay)
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: n0computer/iroh-relay:latest,n0computer/iroh-relay:${{ github.event.inputs.release_version }}
target: iroh-relay
platforms: linux/amd64,linux/arm64/v8
file: docker/Dockerfile.ci

- name: Build Docker image (iroh-dns-server)
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: n0computer/iroh-dns-server:latest,n0computer/iroh-dns-server:${{ github.event.inputs.release_version }}
target: iroh-dns-server
platforms: linux/amd64,linux/arm64/v8
file: docker/Dockerfile.ci
56 changes: 56 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Docs Preview

on:
pull_request:

jobs:
preview_docs:
timeout-minutes: 30
name: Docs preview
if: "github.event_name == 'pull_request'"
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
SCCACHE_CACHE_SIZE: "50G"
PREVIEW_PATH: pr/${{ github.event.pull_request.number }}/docs

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-05-02
- name: Install sccache
uses: mozilla-actions/[email protected]

- name: Generate Docs
run: cargo doc --workspace --all-features --no-deps
env:
RUSTDOCFLAGS: --cfg docsrs

- name: Deploy Docs to Preview Branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc/
destination_dir: ${{ env.PREVIEW_PATH }}
publish_branch: generated-docs-preview

- name: Find Docs Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Documentation for this PR has been generated

- name: Create or Update Docs Comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
Documentation for this PR has been generated and is available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PREVIEW_PATH }}/iroh/
Last updated: ${{ github.event.pull_request.updated_at }}
edit-mode: replace
32 changes: 31 additions & 1 deletion .github/workflows/flaky.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,42 @@ jobs:
result=$(echo '${{ toJSON(needs) }}' | jq -r .tests.result)
echo TESTS_RESULT=$result
echo "TESTS_RESULT=$result" >>"$GITHUB_ENV"
- name: download nextest reports
uses: actions/download-artifact@v4
with:
pattern: libtest_run_${{ github.run_number }}-${{ github.run_attempt }}-*
merge-multiple: true
path: nextest-results
- name: create summary report
id: make_summary
run: |
# prevent the glob expression in the loop to match on itself when the dir is empty
shopt -s nullglob
# to deal with multiline outputs it's recommended to use a random EOF, the syntax is based on
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
EOF=aP51VriWCxNJ1JjvmO9i
echo "summary<<$EOF" >> $GITHUB_OUTPUT
for report in nextest-results/*.json; do
# remove the name prefix and extension, and split the parts
name=$(echo ${report:16:-5} | tr _ ' ')
echo $name
echo "- **$name**" >> $GITHUB_OUTPUT
# select the failed tests
# the tests have this format "crate::module$test_name", the sed expressions remove the quotes and replace $ for ::
failure=$(jq --slurp '.[] | select(.["type"] == "test" and .["event"] == "failed" ) | .["name"]' $report | sed -e 's/^"//g' -e 's/\$/::/' -e 's/"//')
echo "$failure"
echo "$failure" >> $GITHUB_OUTPUT
done
echo "$EOF" >> $GITHUB_OUTPUT
- name: Notify discord on failure
uses: n0-computer/discord-webhook-notify@v1
if: ${{ env.TESTS_RESULT == 'failure' }}
with:
severity: warn
details: |
Flaky tests failed again, why don't you go fix them?
Flaky tests failure:
${{ steps.make_summary.outputs.summary }}
See https://github.com/n0-computer/iroh/actions/workflows/flaky.yaml
webhookUrl: ${{ secrets.DISCORD_N0_GITHUB_CHANNEL_WEBHOOK_URL }}
6 changes: 3 additions & 3 deletions .github/workflows/netsim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable

- name: Run sccache-cache
uses: mozilla-actions/[email protected].4
uses: mozilla-actions/[email protected].5

- name: Build iroh
run: |
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
echo "HEAD_REF=${{ github.ref }}" >> ${GITHUB_ENV}
- name: Respond Issue
uses: peter-evans/create-or-update-comment@v2
uses: peter-evans/create-or-update-comment@v4
if: github.event_name == 'issue_comment'
with:
issue-number: ${{ github.event.issue.number }}
Expand All @@ -183,7 +183,7 @@ jobs:
${{ steps.generate_report.outputs.NETSIM_REPORT }}
- name: Respond PR
uses: peter-evans/create-or-update-comment@v2
uses: peter-evans/create-or-update-comment@v4
if: github.event.pull_request
with:
issue-number: ${{ github.event.pull_request.number }}
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ jobs:
name: Build release binaries
needs: create-release
runs-on: ${{ matrix.runner }}
outputs:
release_version: ${{ needs.create-release.outputs.release_version }}
base_hash: ${{ steps.define_hash.outputs.base_hash }}
continue-on-error: false
strategy:
fail-fast: false
Expand Down Expand Up @@ -126,6 +129,12 @@ jobs:
run: |
echo "RELEASE_ARCH=${{ matrix.release-arch }}" >> $GITHUB_ENV
echo "RELEASE_OS=${{ matrix.release-os }}" >> $GITHUB_ENV
- name: Define hash
if: matrix.os == 'ubuntu-latest'
id: define_hash
run: |
echo "base_hash=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Ensure musl support
if: ${{ contains(matrix.cargo_targets, '-musl') }}
Expand Down Expand Up @@ -253,3 +262,12 @@ jobs:
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}

docker:
needs: build_release
uses: './.github/workflows/docker.yaml'
with:
release_version: ${{ needs.build_release.outputs.release_version }}
base_hash: ${{ needs.build_release.outputs.base_hash }}
publish: true

Loading

0 comments on commit f908c26

Please sign in to comment.