-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy pipelines from Holochain, expected to be broken
- Loading branch information
1 parent
f5580b8
commit 218faa5
Showing
3 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: command-listener | ||
|
||
on: | ||
issue_comment: | ||
types: ["created"] | ||
|
||
jobs: | ||
action_pr_comment: | ||
name: Action PR comment | ||
if: ${{ github.event.issue.pull_request }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Dispatch | ||
id: dispatch | ||
env: | ||
USER: ${{ github.event.sender.login }} | ||
ALLOWED_USERS: ${{ join(fromJson('["ThetaSinner", "jost-s", "maackle", "thedavidmeister", "steveej", "neonphog", "matthme", "c12i"]'), '\n') }} | ||
COMMENT: ${{ github.event.comment.body }} | ||
run: | | ||
set -euo pipefail | ||
COMMAND="" | ||
if [[ "$COMMENT" == @hra* ]]; then | ||
echo "Comment is a command" | ||
COMMAND=$(echo "$COMMENT" | cut -b 6- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') | ||
else | ||
echo "Comment is not a command" | ||
exit 0 | ||
fi | ||
if echo "$ALLOWED_USERS" | grep -q "${USER}"; then | ||
echo "User $USER is allowed to run commands" | ||
else | ||
echo "User $USER is not allowed to run commands" | ||
exit 1 | ||
fi | ||
echo "Setting command '$COMMAND'" | ||
echo "action=${COMMAND}" >> "$GITHUB_OUTPUT" | ||
outputs: | ||
action: ${{ steps.dispatch.outputs.action }} | ||
holonix_update: | ||
name: Holonix update | ||
runs-on: ubuntu-latest | ||
needs: [action_pr_comment] | ||
if: ${{ startsWith(needs.action_pr_comment.outputs.action, 'holonix_update') }} | ||
steps: | ||
- name: Configure | ||
id: configure | ||
env: | ||
ACTION: ${{ needs.action_pr_comment.outputs.action }} | ||
PR_NUMBER: ${{ github.event.issue.number }} | ||
RUN_ID: ${{ github.run_id }} | ||
GH_TOKEN: ${{ secrets.HRA_GITHUB_TOKEN }} | ||
run: | | ||
set -euo pipefail | ||
HOLONIX_VERSION=$(echo $ACTION | cut -b 16- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') | ||
gh pr comment $PR_NUMBER --repo holochain/holochain --body "Got it, will try to update inputs for Holonix version \`$HOLONIX_VERSION\` - [Workflow](https://github.com/holochain/holochain/actions/runs/$RUN_ID)" | ||
echo "holonix_version=${HOLONIX_VERSION}" >> "$GITHUB_OUTPUT" | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v26 | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
name: holochain-ci | ||
- name: set up git config | ||
run: | | ||
./scripts/ci-git-config.sh | ||
- name: Flake update | ||
env: | ||
PR_NUMBER: ${{ github.event.issue.number }} | ||
HOLONIX_VERSION: ${{ steps.configure.outputs.holonix_version }} | ||
GH_TOKEN: ${{ secrets.HRA_GITHUB_TOKEN }} | ||
run: | | ||
set -euo pipefail | ||
gh pr checkout $PR_NUMBER --repo holochain/holochain | ||
nix run .#scripts-repo-flake-update $HOLONIX_VERSION | ||
git pull --rebase | ||
git push |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: "Holonix cache" | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
inputs: {} | ||
|
||
jobs: | ||
# ensures the cache is regularly updated for the supported versions on multiple platforms | ||
cache-update: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: | ||
- "github:holochain/holochain#packages.{0}.build-holonix-tests-integration" | ||
- "github:holochain/holochain#devShells.{0}.holonix" | ||
extra_args: | ||
- "" | ||
- "--refresh --override-input versions github:holochain/holochain?dir=versions/0_2" | ||
- "--refresh --override-input versions github:holochain/holochain?dir=versions/0_2_rc" | ||
- "--refresh --override-input versions github:holochain/holochain?dir=versions/0_3_rc" | ||
- "--refresh --override-input versions github:holochain/holochain?dir=versions/weekly" | ||
platform: | ||
- x86_64-darwin | ||
- aarch64-darwin | ||
- x86_64-linux | ||
|
||
runs-on: [self-hosted, multi-arch] | ||
steps: | ||
- name: Print matrix | ||
env: | ||
MATRIX: ${{ toJSON(matrix) }} | ||
run: echo ${MATRIX} | ||
|
||
- name: "Cache packages ${{ matrix.extra_args }}" | ||
env: | ||
NIX_CONFIG: "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" | ||
CACHIX_AUTH_TOKEN: "${{ secrets.CACHIX_AUTH_TOKEN_HOLOCHAIN_CI }}" | ||
run: | | ||
set -xe | ||
target=${{ matrix.target }} | ||
# See https://docs.cachix.org/pushing#id1 | ||
nix develop --build -L --profile result-develop \ | ||
${{ matrix.extra_args }} \ | ||
${{ format(matrix.target, matrix.platform) }} | ||
nix build -L --profile result-build \ | ||
${{ matrix.extra_args }} \ | ||
${{ format(matrix.target, matrix.platform) }} | ||
# Don't exit if this fails so we can clean up the profile | ||
for i in result-*; do | ||
cachix push holochain-ci $i || true | ||
done | ||
rm result* | ||
cache-check: | ||
needs: | ||
- cache-update | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: | ||
- "github:holochain/holochain#devShells.{0}.holonix" | ||
- "github:holochain/holochain#packages.{0}.hc-scaffold" | ||
extra_args: | ||
- "" | ||
- "--refresh --override-input versions github:holochain/holochain?dir=versions/0_2" | ||
- "--refresh --override-input versions github:holochain/holochain?dir=versions/0_2_rc" | ||
- "--refresh --override-input versions github:holochain/holochain?dir=versions/0_3_rc" | ||
- "--refresh --override-input versions github:holochain/holochain?dir=versions/weekly" | ||
platform: | ||
- x86_64-darwin | ||
- aarch64-darwin | ||
- x86_64-linux | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: cachix/install-nix-action@v26 | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
name: holochain-ci | ||
- name: Check the Holonix cache | ||
uses: holochain/nix-cache-check@v1 | ||
env: | ||
NIX_CONFIG: "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
derivation: ${{ format(matrix.target, matrix.platform) }} | ||
extra_build_args: ${{ matrix.extra_args }} |