Skip to content

Commit 8ef37bc

Browse files
committed
initial add fpm support.
1 parent 68ec64f commit 8ef37bc

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

.github/workflows/fpm-deployment.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: fpm-deployment
2+
3+
# When a PR occurs, the fpm package of `stdlib` will be generated.
4+
on: [push, pull_request]
5+
env:
6+
GCC_V: "10"
7+
8+
jobs:
9+
Build:
10+
runs-on: ubuntu-latest
11+
12+
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"
20+
21+
- name: Set up Python 3.x
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: 3.x
25+
26+
- name: Install fypp
27+
run: pip install --upgrade fypp
28+
29+
- name: Generate stdlib-fpm package
30+
run: |
31+
ls
32+
sh ./stdlib-master/ci/fpm-deployment.sh
33+
34+
- name: Install GFortran
35+
run: |
36+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 \
37+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} \
38+
--slave /usr/bingcov gcov /usr/bin/gcov-${{ env.GCC_V }}
39+
- name: Install fpm latest release
40+
uses: fortran-lang/setup-fpm@v3
41+
with:
42+
github-token: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Run fpm test
45+
run: |
46+
cp -r stdlib stdlib-fpm-test
47+
cd stdlib-fpm-test
48+
fpm test
49+
- name: Run fpm test (release)
50+
run: |
51+
cd stdlib-fpm-test
52+
fpm test --profile release
53+
# 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
56+
if: github.event_name != 'pull_request'
57+
with:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
BRANCH: stdlib-fpm
60+
FOLDER: stdlib

ci/fpm-deployment.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
#
3+
#
4+
set -ex
5+
6+
SRCDIR="stdlib-master"
7+
DESTDIR="stdlib"
8+
9+
FYFLAGS="-DMAXRANK=4"
10+
11+
mkdir -p $DESTDIR/src
12+
mkdir -p $DESTDIR/test
13+
14+
# Clean destination
15+
rm -rf $DESTDIR/src/*
16+
rm -rf $DESTDIR/test/*
17+
18+
# Preprocess stdlib sources
19+
ls $SRCDIR/src/*.fypp | cut -f1 -d. | xargs -i{} fypp {}.fypp {}.f90 $FYFLAGS
20+
21+
# 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/
26+
27+
# Source file workarounds for fpm
28+
rm $DESTDIR/test/test_always_fail.f90
29+
rm $DESTDIR/test/test_always_skip.f90
30+
rm $DESTDIR/test/test_mean_f03.f90
31+
rm $DESTDIR/src/common.f90
32+
rm $DESTDIR/src/f18estop.f90
33+
34+
# List stdlib-fpm package contents
35+
ls -R $DESTDIR

0 commit comments

Comments
 (0)