Skip to content

Commit b81199e

Browse files
committed
add ./ci/fpm.toml and update README.md .
1 parent 8ef37bc commit b81199e

File tree

4 files changed

+39
-32
lines changed

4 files changed

+39
-32
lines changed

.github/workflows/fpm-deployment.yml

+11-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: fpm-deployment
22

3-
# When a PR occurs, the fpm package of `stdlib` will be generated.
43
on: [push, pull_request]
54
env:
65
GCC_V: "10"
@@ -10,13 +9,8 @@ jobs:
109
runs-on: ubuntu-latest
1110

1211
steps:
13-
- name: Git clone fpm branch (stdlib-fpm)
14-
run: git clone -b stdlib-fpm https://github.com/fortran-lang/stdlib.git
15-
16-
- name: Checkout stdlib code (master)
17-
uses: actions/checkout@v2
18-
with:
19-
path: "stdlib-master"
12+
- name: Checkout 🛎️
13+
uses: actions/[email protected]
2014

2115
- name: Set up Python 3.x
2216
uses: actions/setup-python@v1
@@ -26,35 +20,32 @@ jobs:
2620
- name: Install fypp
2721
run: pip install --upgrade fypp
2822

29-
- name: Generate stdlib-fpm package
23+
- name: Generate stdlib-fpm package 🔧
3024
run: |
31-
ls
32-
sh ./stdlib-master/ci/fpm-deployment.sh
25+
sh ./ci/fpm-deployment.sh
3326
3427
- name: Install GFortran
3528
run: |
3629
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 \
3730
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} \
3831
--slave /usr/bingcov gcov /usr/bin/gcov-${{ env.GCC_V }}
32+
3933
- name: Install fpm latest release
4034
uses: fortran-lang/setup-fpm@v3
4135
with:
4236
github-token: ${{ secrets.GITHUB_TOKEN }}
4337

44-
- name: Run fpm test
38+
- name: Run fpm test
4539
run: |
46-
cp -r stdlib stdlib-fpm-test
40+
cp -r stdlib-fpm stdlib-fpm-test
4741
cd stdlib-fpm-test
4842
fpm test
49-
- name: Run fpm test (release)
50-
run: |
51-
cd stdlib-fpm-test
5243
fpm test --profile release
44+
5345
# Update and deploy the f90 files generated by github-ci to the `stdlib-fpm` branch.
54-
- name: Deploy
55-
uses: JamesIves/github-pages-deploy-action@releases/v3
46+
- name: Deploy 🚀
47+
uses: JamesIves/github-pages-deploy-action@4.1.5
5648
if: github.event_name != 'pull_request'
5749
with:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5950
BRANCH: stdlib-fpm
60-
FOLDER: stdlib
51+
FOLDER: stdlib-fpm

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Supported compilers](#supported-compilers)
1212
- [Build with CMake](#build-with-cmake)
1313
- [Build with make](#build-with-make)
14+
- [Build with fortran-lang/fpm](#build-with-fortran-langfpm)
1415
* [Using stdlib in your project](#using-stdlib-in-your-project)
1516
* [Documentation](#documentation)
1617
* [Contributing](#contributing)
@@ -176,7 +177,21 @@ You can limit the maximum rank by setting ``-DMAXRANK=<num>`` in the ``FYPPFLAGS
176177
make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4
177178
```
178179

180+
### Build with [fortran-lang/fpm](https://github.com/fortran-lang/fpm)
179181

182+
Fortran Package Manager (fpm) is a great package manager and build system for Fortran.
183+
You can build using provided `fpm.toml`:
184+
185+
```sh
186+
git checkout stdlib-fpm
187+
fpm build --profile release
188+
```
189+
190+
To use `stdlib` within your `fpm` project, add the following to your `fpm.toml` file:
191+
```toml
192+
[dependencies]
193+
stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm" }
194+
```
180195

181196
## Using stdlib in your project
182197

ci/fpm-deployment.sh

+8-12
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,22 @@
33
#
44
set -ex
55

6-
SRCDIR="stdlib-master"
7-
DESTDIR="stdlib"
6+
DESTDIR="stdlib-fpm"
87

98
FYFLAGS="-DMAXRANK=4"
109

1110
mkdir -p $DESTDIR/src
1211
mkdir -p $DESTDIR/test
1312

14-
# Clean destination
15-
rm -rf $DESTDIR/src/*
16-
rm -rf $DESTDIR/test/*
17-
1813
# Preprocess stdlib sources
19-
ls $SRCDIR/src/*.fypp | cut -f1 -d. | xargs -i{} fypp {}.fypp {}.f90 $FYFLAGS
14+
ls src/*.fypp | cut -f1 -d. | xargs -i{} fypp {}.fypp {}.f90 $FYFLAGS
2015

2116
# Collect stdlib files
22-
find $SRCDIR/src -maxdepth 1 -iname "*.f90" -exec cp {} $DESTDIR/src/ \;
23-
find $SRCDIR/src/tests -name "test_*.f90" -exec cp {} $DESTDIR/test/ \;
24-
find $SRCDIR/src/tests -name "*.dat" -exec cp {} $DESTDIR/ \;
25-
cp $SRCDIR/LICENSE $DESTDIR/
17+
find src -maxdepth 1 -iname "*.f90" -exec cp {} $DESTDIR/src/ \;
18+
find src/tests -name "test_*.f90" -exec cp {} $DESTDIR/test/ \;
19+
find src/tests -name "*.dat" -exec cp {} $DESTDIR/ \;
20+
cp LICENSE $DESTDIR/
21+
cp ci/fpm.toml $DESTDIR/
2622

2723
# Source file workarounds for fpm
2824
rm $DESTDIR/test/test_always_fail.f90
@@ -32,4 +28,4 @@ rm $DESTDIR/src/common.f90
3228
rm $DESTDIR/src/f18estop.f90
3329

3430
# List stdlib-fpm package contents
35-
ls -R $DESTDIR
31+
ls -R $DESTDIR

ci/fpm.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name = "stdlib"
2+
version = "0.0.0"
3+
license = "MIT"
4+
author = "stdlib contributors"
5+
copyright = "2019-2021 stdlib contributors"

0 commit comments

Comments
 (0)