Skip to content

Commit 8b3cd2c

Browse files
committed
Move duplication to separate steps
1 parent 5192e96 commit 8b3cd2c

File tree

1 file changed

+35
-46
lines changed

1 file changed

+35
-46
lines changed

.github/workflows/cmake.yml

Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -79,81 +79,71 @@ jobs:
7979
omp: "on"
8080

8181
steps:
82-
- uses: actions/checkout@v3
83-
with:
84-
submodules: recursive
82+
- uses: actions/checkout@v4
8583

8684
# Enable tmate debugging of manually-triggered workflows if the input option was provided
8785
- name: Setup tmate session
8886
uses: mxschmitt/action-tmate@v3
8987
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
9088

89+
- name: Prepare ccache timestamp
90+
id: ccache_cache_timestamp
91+
run: echo "{date_and_time}={$(date +'%Y-%m-%d-%H;%M;%S')}" >> $GITHUB_OUTPUT
92+
- name: Set ccache cache directory
93+
shell: bash
94+
run: echo "CCACHE_DIR=${{runner.workspace}}/.ccache" >> "${GITHUB_ENV}"
95+
- name: Cache ccache files
96+
uses: actions/cache@v3
97+
with:
98+
path: ${{runner.workspace}}/.ccache
99+
key: ${{matrix.os}}-${{matrix.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.date_and_time }}
100+
restore-keys: |
101+
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}
102+
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}
103+
${{ matrix.os }}-${{ matrix.cxx }}
104+
${{ matrix.os }}
105+
106+
# - name: Clear ccache
107+
# run: ccache --clear
108+
91109
- name: Install Dependencies on Ubunutu
92110
if: ${{ contains(matrix.os, 'ubuntu') }}
93111
run: |
94112
sudo apt update
95113
sudo apt install openmpi-bin libopenmpi-dev ccache graphviz libeigen3-dev libspdlog-dev libtiff-dev libcfitsio-dev libbenchmark-dev libboost-all-dev libyaml-cpp-dev
96-
git clone https://github.com/catchorg/Catch2.git -b v3.4.0
97-
mkdir Catch2/build
98-
cd Catch2/build
99-
cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local
100-
make -j$(nproc --ignore 1) install
101-
cd -
102-
wget --no-check-certificate --no-verbose http://www.fftw.org/fftw-3.3.10.tar.gz -O- | tar --no-same-owner -xz;
103-
cd fftw-3.3.10
104-
./configure --prefix=${{github.workspace}}/local --enable-shared
105-
make -j$(nproc --ignore 1) install CFLAGS=-fPIC
106-
# Fix bug in FFT3 (cf. https://github.com/FFTW/fftw3/issues/332)
107-
sed -i -e 's/^.*FFTW3LibraryDepends.cmake.*$//1' ${{github.workspace}}/local/lib*/cmake/*/FFTW3Config.cmake
108-
cd -
109114
110115
- name: Install Dependencies on MacOS
111116
if: ${{ contains(matrix.os, 'macos') }}
112117
run: |
113118
brew install gcc libtiff open-mpi libomp eigen libyaml ccache cfitsio boost yaml-cpp
114119
echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
115120
echo "/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
116-
git clone https://github.com/catchorg/Catch2.git -b v3.4.0
121+
122+
- name: Checkout Catch2
123+
uses: actions/checkout@v4
124+
with:
125+
repository: catchorg/Catch2.git
126+
path: Catch2
127+
ref: v3.4.0
128+
129+
- name: Build Catch2
130+
run: |
117131
mkdir Catch2/build
118132
cd Catch2/build
119133
cmake .. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local
120134
make -j$(nproc --ignore 1) install
121-
cd -
135+
136+
- name: Install FFTW
137+
run: |
122138
wget --no-check-certificate --no-verbose http://www.fftw.org/fftw-3.3.10.tar.gz -O- | tar --no-same-owner -xz;
123139
cd fftw-3.3.10
124140
./configure --prefix=${{github.workspace}}/local --enable-shared
125141
make -j$(nproc --ignore 1) install CFLAGS=-fPIC
126142
# Fix bug in FFT3 (cf. https://github.com/FFTW/fftw3/issues/332)
127143
sed -i -e 's/^.*FFTW3LibraryDepends.cmake.*$//1' ${{github.workspace}}/local/lib*/cmake/*/FFTW3Config.cmake
128-
cd -
129-
130-
- name: Select Python 3.10
131-
uses: actions/setup-python@v4
132-
with:
133-
python-version: '3.10'
134-
135-
- name: Prepare ccache timestamp
136-
id: ccache_cache_timestamp
137-
run: echo "{date_and_time}={$(date +'%Y-%m-%d-%H;%M;%S')}" >> $GITHUB_OUTPUT
138-
- name: Set ccache cache directory
139-
shell: bash
140-
run: echo "CCACHE_DIR=${{runner.workspace}}/.ccache" >> "${GITHUB_ENV}"
141-
- name: Cache ccache files
142-
uses: actions/cache@v3
143-
with:
144-
path: ${{runner.workspace}}/.ccache
145-
key: ${{matrix.os}}-${{matrix.cxx}}-${{matrix.mpi}}-${{matrix.omp}}-${{ steps.ccache_cache_timestamp.outputs.date_and_time }}
146-
restore-keys: |
147-
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}-${{ matrix.omp }}
148-
${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.mpi }}
149-
${{ matrix.os }}-${{ matrix.cxx }}
150-
${{ matrix.os }}
151-
152-
# - name: Clear ccache
153-
# run: ccache --clear
154144
155145
- name: Checkout SOPT
156-
uses: actions/checkout@v3
146+
uses: actions/checkout@v4
157147
with:
158148
repository: astro-informatics/sopt.git
159149
path: sopt
@@ -168,7 +158,6 @@ jobs:
168158
cmake .. --fresh -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -Ddompi=${{matrix.mpi}} -Dopenmp=${{matrix.omp}}
169159
make -j$(nproc --ignore 1) install
170160
171-
172161
- name: Install
173162
# Build your program with the given configuration
174163
run: |

0 commit comments

Comments
 (0)