diff options
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/build.yml | 84 | ||||
| -rw-r--r-- | .github/workflows/depends.yml | 33 | ||||
| -rw-r--r-- | .github/workflows/gitian.yml | 36 |
3 files changed, 119 insertions, 34 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7132adc9c..a7c722c8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,9 @@ jobs: - uses: actions/checkout@v5 with: submodules: recursive - - uses: actions/cache@v5 + - name: restore ccache + uses: actions/cache/restore@v5 + id: ccache-restore with: path: /Users/runner/Library/Caches/ccache key: ccache-${{ runner.os }}-build-${{ github.sha }} @@ -45,11 +47,17 @@ jobs: run: | brew uninstall cmake brew update - brew install --quiet cmake boost hidapi openssl zmq libpgm expat libunwind-headers protobuf ccache + brew install --quiet cmake boost hidapi openssl zmq libpgm unbound libunwind-headers protobuf ccache - name: build run: | ${{env.CCACHE_SETTINGS}} make -j${{env.MAKE_JOB_COUNT}} + - name: save ccache + uses: actions/cache/save@v5 + if: github.event_name != 'pull_request' && steps.ccache-restore.outputs.cache-hit != 'true' + with: + path: /Users/runner/Library/Caches/ccache + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} build-windows: name: 'Windows (MSYS2)' @@ -64,7 +72,9 @@ jobs: - uses: actions/checkout@v5 with: submodules: recursive - - uses: actions/cache@v5 + - name: restore ccache + uses: actions/cache/restore@v5 + id: ccache-restore with: path: C:\Users\runneradmin\.ccache key: ccache-${{ runner.os }}-build-${{ github.sha }} @@ -72,12 +82,19 @@ jobs: - uses: msys2/setup-msys2@v2 with: update: true + cache: false install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb mingw-w64-x86_64-unbound git - uses: ./.github/actions/set-make-job-count - name: build run: | ${{env.CCACHE_SETTINGS}} make release-static-win64 -j${{env.MAKE_JOB_COUNT}} + - name: save ccache + uses: actions/cache/save@v5 + if: github.event_name != 'pull_request' && steps.ccache-restore.outputs.cache-hit != 'true' + with: + path: C:\Users\runneradmin\.ccache + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} build-arch: name: 'Arch Linux' @@ -86,17 +103,32 @@ jobs: image: archlinux:latest steps: - name: install dependencies - run: pacman -Syyu --noconfirm base-devel git cmake boost boost-libs openssl zeromq unbound libsodium readline expat gtest python3 doxygen graphviz hidapi libusb protobuf + run: pacman -Syyu --noconfirm base-devel git cmake boost boost-libs openssl zeromq unbound libsodium readline expat gtest python3 doxygen graphviz hidapi libusb protobuf ccache - name: configure git run: git config --global --add safe.directory '*' - uses: actions/checkout@v5 with: submodules: recursive + - name: restore ccache + uses: actions/cache/restore@v5 + id: ccache-restore + with: + path: ~/.cache/ccache + key: ccache-arch-build-${{ github.sha }} + restore-keys: ccache-arch-build- - uses: ./.github/actions/set-make-job-count - name: build env: CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}} - run: ${{env.BUILD_DEFAULT_LINUX}} + run: | + ${{ env.CCACHE_SETTINGS }} + ${{ env.BUILD_DEFAULT_LINUX }} + - name: save ccache + uses: actions/cache/save@v5 + if: github.event_name != 'pull_request' && steps.ccache-restore.outputs.cache-hit != 'true' + with: + path: ~/.cache/ccache + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} build-debian: # Oldest supported Debian version @@ -118,11 +150,26 @@ jobs: - uses: actions/checkout@v5 with: submodules: recursive + - name: restore ccache + uses: actions/cache/restore@v5 + id: ccache-restore + with: + path: ~/.cache/ccache + key: ccache-debian-11-build-${{ github.sha }} + restore-keys: ccache-debian-11-build- - uses: ./.github/actions/set-make-job-count - name: build env: CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}} - run: ${{env.BUILD_DEFAULT_LINUX}} + run: | + ${{ env.CCACHE_SETTINGS }} + ${{ env.BUILD_DEFAULT_LINUX }} + - name: save ccache + uses: actions/cache/save@v5 + if: github.event_name != 'pull_request' && steps.ccache-restore.outputs.cache-hit != 'true' + with: + path: ~/.cache/ccache + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} build-ubuntu: name: ${{ matrix.name }} @@ -131,10 +178,6 @@ jobs: fail-fast: false matrix: include: - # Oldest supported Ubuntu LTS version - - name: Ubuntu 20.04 - container: ubuntu:20.04 - # Most popular Ubuntu LTS version - name: Ubuntu 22.04 container: ubuntu:22.04 @@ -156,7 +199,9 @@ jobs: - uses: actions/checkout@v5 with: submodules: recursive - - uses: actions/cache@v5 + - name: restore ccache + uses: actions/cache/restore@v5 + id: ccache-restore with: path: ~/.ccache key: ccache-${{ matrix.container }}-build-${{ github.sha }} @@ -168,10 +213,15 @@ jobs: run: | ${{env.CCACHE_SETTINGS}} ${{env.BUILD_DEFAULT_LINUX}} + - name: save ccache + uses: actions/cache/save@v5 + if: github.event_name != 'pull_request' && steps.ccache-restore.outputs.cache-hit != 'true' + with: + path: ~/.ccache + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} test-ubuntu: name: "${{ matrix.name }} (tests)" - needs: build-ubuntu runs-on: ubuntu-latest strategy: matrix: @@ -203,7 +253,9 @@ jobs: - uses: actions/checkout@v5 with: submodules: recursive - - uses: actions/cache@v5 + - name: restore ccache + uses: actions/cache/restore@v5 + id: ccache-restore with: path: ~/.ccache key: ccache-${{ matrix.container }}-build-${{ github.sha }} @@ -220,6 +272,12 @@ jobs: ${{env.CCACHE_SETTINGS}} ${{env.BUILD_DEFAULT_LINUX}} cmake --build build --target test + - name: save ccache + uses: actions/cache/save@v5 + if: github.event_name != 'pull_request' && steps.ccache-restore.outputs.cache-hit != 'true' + with: + path: ~/.ccache + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} source-archive: name: "source archive" diff --git a/.github/workflows/depends.yml b/.github/workflows/depends.yml index 2be2a60e5..92345d831 100644 --- a/.github/workflows/depends.yml +++ b/.github/workflows/depends.yml @@ -73,28 +73,21 @@ jobs: fetch-depth: 0 submodules: recursive # Most volatile cache - - name: ccache - uses: actions/cache@v5 + - name: restore ccache + uses: actions/cache/restore@v5 + id: ccache-restore with: path: ~/.ccache key: ccache-${{ matrix.toolchain.host }}-${{ github.sha }} restore-keys: ccache-${{ matrix.toolchain.host }}- # Less volatile cache - - name: depends cache - uses: actions/cache@v5 + - name: restore depends cache + uses: actions/cache/restore@v5 + id: depends-restore with: path: contrib/depends/built key: depends-${{ matrix.toolchain.host }}-${{ hashFiles('contrib/depends/packages/*') }} - restore-keys: | - depends-${{ matrix.toolchain.host }}-${{ hashFiles('contrib/depends/packages/*') }} - depends-${{ matrix.toolchain.host }}- -# Static cache - - name: OSX SDK cache - uses: actions/cache@v5 - with: - path: contrib/depends/sdk-sources - key: sdk-${{ matrix.toolchain.host }}-${{ matrix.toolchain.osx_sdk }} - restore-keys: sdk-${{ matrix.toolchain.host }}-${{ matrix.toolchain.osx_sdk }} + restore-keys: depends-${{ matrix.toolchain.host }}- - name: prepare w64-mingw32 if: ${{ matrix.toolchain.host == 'x86_64-w64-mingw32' || matrix.toolchain.host == 'i686-w64-mingw32' }} run: | @@ -104,6 +97,18 @@ jobs: run: | ${{env.CCACHE_SETTINGS}} make depends target=${{ matrix.toolchain.host }} -j4 + - name: save ccache + uses: actions/cache/save@v5 + if: github.event_name != 'pull_request' && steps.ccache-restore.outputs.cache-hit != 'true' + with: + path: ~/.ccache + key: ${{ steps.ccache-restore.outputs.cache-primary-key }} + - name: save depends cache + uses: actions/cache/save@v5 + if: github.event_name != 'pull_request' && steps.depends-restore.outputs.cache-hit != 'true' + with: + path: contrib/depends/built + key: ${{ steps.depends-restore.outputs.cache-primary-key }} - uses: actions/upload-artifact@v7 if: ${{ matrix.toolchain.host == 'x86_64-w64-mingw32' || matrix.toolchain.host == 'x86_64-apple-darwin11' || matrix.toolchain.host == 'x86_64-unknown-linux-gnu' }} with: diff --git a/.github/workflows/gitian.yml b/.github/workflows/gitian.yml index 2d2af5799..d3999eff4 100644 --- a/.github/workflows/gitian.yml +++ b/.github/workflows/gitian.yml @@ -2,8 +2,17 @@ name: ci/gh-actions/gitian on: push: - tags: - - '*' + paths: + - 'contrib/depends/**' + - 'contrib/gitian/**' + - '!contrib/**.md' + - '.github/workflows/gitian.yml' + pull_request: + paths: + - 'contrib/depends/**' + - 'contrib/gitian/**' + - '!contrib/**.md' + - '.github/workflows/gitian.yml' jobs: build-gitian: @@ -24,20 +33,33 @@ jobs: option: "m" name: ${{ matrix.operating-system.name }} steps: + - uses: actions/checkout@v5 + with: + submodules: recursive - name: prepare run: | sudo apt update - curl -O https://raw.githubusercontent.com/monero-project/monero/${{ github.ref_name }}/contrib/gitian/gitian-build.py + cp contrib/gitian/gitian-build.py . chmod +x gitian-build.py + - name: set env + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + echo "GITIAN_VERSION=${{ github.event.pull_request.number }}" >> $GITHUB_ENV + echo "GITIAN_OUTDIR=pull-${{ github.event.pull_request.number }}" >> $GITHUB_ENV + echo "GITIAN_EXTRA_FLAGS=--pull" >> $GITHUB_ENV + else + echo "GITIAN_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV + echo "GITIAN_OUTDIR=${{ github.ref_name }}" >> $GITHUB_ENV + fi - name: setup run: | - ./gitian-build.py --setup --docker github-actions ${{ github.ref_name }} + ./gitian-build.py --setup --docker --url https://github.com/${{ github.repository }} ${{ env.GITIAN_EXTRA_FLAGS }} github-actions ${{ env.GITIAN_VERSION }} - name: build run: | - ./gitian-build.py --docker --detach-sign --no-commit --build -j 3 -o ${{ matrix.operating-system.option }} github-actions ${{ github.ref_name }} + ./gitian-build.py --docker --url https://github.com/${{ github.repository }} --detach-sign --no-commit --build -j 3 -o ${{ matrix.operating-system.option }} ${{ env.GITIAN_EXTRA_FLAGS }} github-actions ${{ env.GITIAN_VERSION }} - name: post build run: | - cd out/${{ github.ref_name }} + cd out/${{ env.GITIAN_OUTDIR }} shasum -a256 * echo \`\`\` >> $GITHUB_STEP_SUMMARY shasum -a256 * >> $GITHUB_STEP_SUMMARY @@ -46,4 +68,4 @@ jobs: with: name: ${{ matrix.operating-system.name }} path: | - out/${{ github.ref_name }}/* + out/${{ env.GITIAN_OUTDIR }}/* |
