Skip to content

Commit 3a2d503

Browse files
authored
Merge pull request #802 from jalvesz/deployment
fpm deployment enhancement
2 parents c3d8477 + ca8ad40 commit 3a2d503

11 files changed

+244
-176
lines changed

.github/workflows/fpm-deployment.yml

+39-42
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,48 @@
11
name: fpm-deployment
22

33
on: [push, pull_request]
4-
env:
5-
GCC_V: "10"
64

75
jobs:
8-
Build:
9-
runs-on: ubuntu-latest
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
include:
12+
- os: ubuntu-latest
13+
toolchain: {compiler: gcc, version: 13}
1014

1115
steps:
12-
- name: Checkout 🛎️
13-
uses: actions/[email protected]
14-
15-
- name: Set up Python 3.x
16-
uses: actions/setup-python@v1
17-
with:
18-
python-version: 3.x
19-
20-
- name: Install fypp
21-
run: pip install --upgrade fypp
22-
23-
- name: Generate stdlib-fpm package 🔧
24-
run: |
25-
bash ./ci/fpm-deployment.sh
26-
27-
- name: Install GFortran
28-
run: |
29-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 \
30-
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} \
31-
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_V }}
32-
33-
- name: Install fpm latest release
34-
uses: fortran-lang/setup-fpm@v5
35-
with:
36-
fpm-version: 'v0.10.0'
37-
38-
- name: Run fpm test ⚙
39-
run: |
40-
cp -r stdlib-fpm stdlib-fpm-test
41-
cd stdlib-fpm-test
42-
fpm test
43-
fpm test --profile release
16+
- name: Checkout code
17+
uses: actions/[email protected]
18+
19+
- name: Set up Python 3.x
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: 3.x
23+
24+
- name: Install requirements
25+
run: pip install --upgrade -r config/requirements.txt
26+
27+
- uses: fortran-lang/setup-fortran@main
28+
id: setup-fortran
29+
with:
30+
compiler: ${{ matrix.toolchain.compiler }}
31+
version: ${{ matrix.toolchain.version }}
32+
33+
- name: Setup Fortran Package Manager
34+
uses: fortran-lang/setup-fpm@v5
35+
with:
36+
fpm-version: 'v0.10.0'
37+
38+
- run: |
39+
python config/fypp_deployment.py --deploy_stdlib_fpm
40+
fpm test --profile release
4441
4542
# Update and deploy the f90 files generated by github-ci to the `stdlib-fpm` branch.
46-
- name: Deploy 🚀
47-
uses: JamesIves/[email protected]
48-
if: github.event_name != 'pull_request'
49-
with:
50-
BRANCH: stdlib-fpm
51-
FOLDER: stdlib-fpm
43+
- name: Deploy 🚀
44+
uses: JamesIves/[email protected]
45+
if: github.event_name != 'pull_request'
46+
with:
47+
BRANCH: stdlib-fpm
48+
FOLDER: stdlib-fpm

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
build/
2-
2+
**/temp/
33
# FORD generated documentation
44
# !WARNING! This folder gets deleted and overwritten
55
API-doc/

README.md

+33-5
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,47 @@ earlier builds do not affect the new build.
179179
Fortran Package Manager (fpm) is a package manager and build system for Fortran.
180180
You can build `stdlib` using provided `fpm.toml`:
181181

182+
**Option 1**: From root folder
183+
184+
As `fpm` does not currently support `fypp` natively, `stdlib` now proposes a python script to preprocess and build it.
185+
This script enables modification of the different `fypp` macros available in `stdlib`. The preprocessed files will be dumped at `<current_folder>/temp/*.f90` or `*.F90`.
186+
187+
Make sure to install the dependencies from the `requirement.txt`
182188
```sh
183-
git checkout stdlib-fpm
184-
fpm build --profile release
189+
pip install --upgrade -r config/requirements.txt
185190
```
186191

187-
**Alternative**: as `fpm` does not currently support `fypp` natively, building `stdlib` with `fpm` can be done in two steps: a) launch the preprocessor through the `fpm-deployment.sh` script, which creates a subfolder `stdlib-fpm` and b) build the project using the processed files within the latter subfolder. This process can be done with the following commands:
192+
To build, you can use the following command line:
188193

189194
```sh
190-
source ./ci/fpm-deployment.sh
191-
cd stdlib-fpm/
195+
python config/fypp_deployment.py
192196
fpm build --profile release
193197
```
194198

199+
or the short-cut
200+
201+
```sh
202+
python config/fypp_deployment.py --build
203+
```
204+
205+
To modify the `maxrank` macro for instance:
206+
```sh
207+
python config/fypp_deployment.py --maxrank 7 --build
208+
```
209+
210+
To see all the options:
211+
```sh
212+
python config/fypp_deployment.py --help
213+
```
214+
215+
**Note**: If you use a compiler different than GNU compilers, the script will try to catch it from the environment variables `FPM_FC`, `FPM_CC`, `FPM_CXX`.
216+
217+
**Option 2**: From the `stdlib-fpm` branch which has already been preprocessed with default macros:
218+
```sh
219+
git checkout stdlib-fpm
220+
fpm build --profile release
221+
```
222+
#### Runing the examples
195223
You can run the examples with `fpm` as:
196224

197225
```sh

ci/.gitignore

-7
This file was deleted.

ci/fpm-deployment.sh

-99
This file was deleted.

0 commit comments

Comments
 (0)