add ccache for windows #1
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
name: Reusable - CI | ||
on: | ||
workflow_call: | ||
inputs: | ||
matrix: | ||
type: string | ||
cache_nonce: | ||
default: '0' | ||
description: Allows for easily busting actions/cache caches | ||
required: false | ||
type: string | ||
env: | ||
cache_nonce: ${{ inputs.cache_nonce }} | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
include: ${{ fromJson(inputs.matrix) }} | ||
defaults: | ||
run: | ||
shell: ${{ matrix.shell }} {0} | ||
name: ${{ matrix.os }}-${{ matrix.tests }}-${{ matrix.cpu }}-${{ matrix.nim_version }} | ||
runs-on: ${{ matrix.builder }} | ||
timeout-minutes: 120 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: ccache for Linux/Mac | ||
uses: hendrikmuhs/[email protected] | ||
if: matrix.os == 'linux' || matrix.os == 'macos' | ||
with: | ||
create-symlink: true | ||
key: ${{ matrix.os }}-${{ matrix.builder }}-${{ matrix.cpu }}-${{ matrix.tests }}-${{ matrix.nim_version }} | ||
- name: ccache for Windows | ||
uses: hendrikmuhs/[email protected] | ||
if: matrix.os == 'windows' | ||
with: | ||
key: ${{ matrix.os }}-${{ matrix.builder }}-${{ matrix.cpu }}-${{ matrix.tests }}-${{ matrix.nim_version }} | ||
- name: ccache for Windows: set up path | ||
if: matrix.os == 'windows' | ||
run: | | ||
CCACHE_DIR=$(dirname $(which ccache)) | ||
ln -s $(which ccache) ${CCACHE_DIR}/gcc.exe | ||
ln -s $(which ccache) ${CCACHE_DIR}/g++.exe | ||
ln -s $(which ccache) ${CCACHE_DIR}/cc.exe | ||
ln -s $(which ccache) ${CCACHE_DIR}/c++.exe | ||
# echo "${CCACHE_DIR}" >> ${GITHUB_PATH} # unfortunately not working in msys2, see https://github.com/msys2/setup-msys2/issues/347 | ||
# export PATH=${CCACHE_DIR}:$PATH # works temporarily, but not saving in msys2, might work with shell: msys2 {0} | ||
# echo "PATH=${CCACHE_DIR}:$PATH" >> ${GITHUB_ENV} # preceded by other path items | ||
# echo "export PATH=${CCACHE_DIR}:\$PATH" >> $HOME/.bashrc # not loaded later | ||
echo "export PATH=${CCACHE_DIR}:\$PATH" >> $HOME/.bash_profile | ||
- name: Setup Nimbus Build System | ||
uses: ./.github/actions/nimbus-build-system | ||
with: | ||
os: ${{ matrix.os }} | ||
shell: ${{ matrix.shell }} | ||
nim_version: ${{ matrix.nim_version }} | ||
coverage: false | ||
## Part 1 Tests ## | ||
- name: Unit tests | ||
if: matrix.tests == 'unittest' || matrix.tests == 'all' | ||
run: make -j${ncpu} test | ||
# workaround for https://github.com/NomicFoundation/hardhat/issues/3877 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.15 | ||
- name: Start Ethereum node with Codex contracts | ||
if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'tools' || matrix.tests == 'all' | ||
working-directory: vendor/codex-contracts-eth | ||
env: | ||
MSYS2_PATH_TYPE: inherit | ||
run: | | ||
npm install | ||
npm start & | ||
## Part 2 Tests ## | ||
- name: Contract tests | ||
if: matrix.tests == 'contract' || matrix.tests == 'all' | ||
run: make -j${ncpu} testContracts | ||
## Part 3 Tests ## | ||
- name: Integration tests | ||
if: matrix.tests == 'integration' || matrix.tests == 'all' | ||
run: make -j${ncpu} testIntegration | ||
- name: Upload integration tests log files | ||
uses: actions/upload-artifact@v4 | ||
if: (matrix.tests == 'integration' || matrix.tests == 'all') && always() | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.cpu }}-${{ matrix.nim_version }}-integration-tests-logs | ||
path: tests/integration/logs/ | ||
retention-days: 1 | ||
## Part 4 Tools ## | ||
- name: Tools tests | ||
if: matrix.tests == 'tools' || matrix.tests == 'all' | ||
run: make -j${ncpu} testTools | ||
status: | ||
if: always() | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} | ||
run: exit 1 |