-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #6171: feat: implement GitHub Actions based starter CI
acf1315 Merge bitcoin/bitcoin#25091: test: Remove extended lint (cppcheck) (MacroFake) 4dbdecd refactor: rename builder-image -> build-image and builder as image name to dashcore-ci-runner (pasta) ed8ffa7 feat: have cppcheck linter respect CACHE_DIR env variable (pasta) d1addb2 fix: change fallback download path to be an s3 link which includes a few packages (pasta) 35c7670 feat: implement basic Github Actions based CI, which reuses underlying logic from GitLab CI (pasta) Pull request description: ## Issue being fixed or feature implemented We currently rely on GitLab for running CI, and while it has worked quite well, I am worried about having all of our eggs in one basket! As such, I've long wanted to explore implemeenting Github Actions based CI, but was too lazy! Well I finally spent some 60 commits trying to figure everything out, and this PR is the result of it. As a result, we will now have two semi-redunant CI systems, the primary one on GitLab, and this one on Github Actions. Currently the GA based CI will only do one host, and does linting. Be aware this GA based CI does not actually run the tests, it does build depends, src and run linters on 1 host. In the future, we should expand it from simply arm32 builds to having feature parity to GitLab. While it appears the GA default runners are a bit slower than what we have on GitLab, there's a big difference, the GA runners are free :D If we decide to make the GA based CI primary, we'll probably want to setup some custom runners to have improved build speeds. Even still, a heavily cached build doing all linters took around 5 minutes if I recall correctly. Without caches I think it took maybe an hour, so defenitely not bad. ## What was done? See the individual commits, they're pretty self explanatory ## How Has This Been Tested? Lots of CI runs on my prior branch :) CI should run on this PR, and we should see how long it'll take w/o cache :D ## Breaking Changes N/A - CI only ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ Top commit has no ACKs. Tree-SHA512: fef41d1b73fdeac29e5096ffa7fa26660efc44ac274376d5880b5fabf6b0e760aeda4a4ae9c24656ee0e3adb760459f0d45b955cefffc9d0eeb5384afbc9d473
- Loading branch information
Showing
6 changed files
with
184 additions
and
116 deletions.
There are no files selected for viewing
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,176 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request_target: | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
env: | ||
DOCKER_DRIVER: overlay2 | ||
FAST_MODE: false | ||
|
||
jobs: | ||
build-image: | ||
name: Build Image | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
image-tag: ${{ steps.prepare.outputs.image-tag }} | ||
repo-name: ${{ steps.prepare.outputs.repo-name }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare | ||
id: prepare | ||
run: | | ||
BRANCH_NAME=$(echo "${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]') | ||
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | ||
echo "::set-output name=image-tag::${BRANCH_NAME}" | ||
echo "::set-output name=repo-name::${REPO_NAME}" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./contrib/containers/ci | ||
file: ./contrib/containers/ci/Dockerfile | ||
push: true | ||
tags: | | ||
ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:${{ steps.prepare.outputs.image-tag }} | ||
ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:latest | ||
cache-from: type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:latest | ||
cache-to: type=inline | ||
|
||
build-depends: | ||
name: Build Dependencies | ||
needs: build-image | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
include: | ||
- build_target: arm-linux | ||
host: arm-linux-gnueabihf | ||
container: | ||
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }} | ||
options: --user root | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
depends/built | ||
depends/${{ matrix.host }} | ||
depends/sdk-sources | ||
# We don't care about no specific key as depends system will handle that for us | ||
key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} | ||
${{ runner.os }}-depends-${{ matrix.host }} | ||
${{ runner.os }}-depends | ||
- name: Build dependencies | ||
run: make -j$(nproc) -C depends HOST=${{ matrix.host }} | ||
|
||
build: | ||
name: Build | ||
needs: [build-image, build-depends] | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
include: | ||
- build_target: arm-linux | ||
host: arm-linux-gnueabihf | ||
dep_opts: DEBUG=1 | ||
container: | ||
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }} | ||
options: --user root | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore Cache dependencies | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
depends/built | ||
depends/${{ matrix.host }} | ||
depends/sdk-sources | ||
# We don't care about no specific key as depends system will handle that for us | ||
key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} | ||
${{ runner.os }}-depends-${{ matrix.host }} | ||
${{ runner.os }}-depends | ||
- name: CCache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
/cache | ||
key: ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} | ||
${{ runner.os }}-${{ matrix.host }} | ||
${{ runner.os }} | ||
- name: Build source and run tests | ||
run: | | ||
git config --global --add safe.directory "$PWD" | ||
CCACHE_SIZE="400M" | ||
CACHE_DIR="/cache" | ||
mkdir /output | ||
BASE_OUTDIR="/output" | ||
BUILD_TARGET="${{ matrix.build_target }}" | ||
source ./ci/dash/matrix.sh | ||
./ci/dash/build_src.sh | ||
./ci/dash/test_unittests.sh | ||
shell: bash | ||
|
||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
path: | | ||
/output | ||
# Come back to this later and implement tests :) | ||
# test: | ||
# name: Test | ||
# needs: [build-image, build] | ||
# runs-on: ubuntu-20.04 | ||
# container: | ||
# image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }} | ||
# options: --user root | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
# | ||
# - name: Download build artifacts | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: build-artifacts | ||
# path: src/ | ||
# | ||
## - name: Setup environment | ||
## run: | | ||
## echo "BUILD_TARGET=${{ needs.build.matrix.build_target }}" | ||
## source ./ci/dash/matrix.sh | ||
# | ||
# - name: Run integration tests | ||
# run: ./ci/dash/test_integrationtests.sh --extended --exclude feature_pruning,feature_dbcrash |
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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