Skip to content

Phase out Haskell fpm #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 1 addition & 142 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,138 +13,8 @@ env:
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_GITHUB_API: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
RUST_BACKTRACE: "full" # Make Rust print full backtrace on error

jobs:
stack-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
gcc_v: [9] # Version of GFortran we want to use.
include:
- os: ubuntu-latest
STACK_CACHE: "/home/runner/.stack/"
STACK_CACHE_VERSION: ""
TEST_SCRIPT: ci/run_tests.sh
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
CHECK_VERSION_CMD: grep $(cat fpm_version)
RELEASE_CMD: "cp -- fpm-$(cat fpm_version)-linux-x86_64"
BOOTSTRAP_RELEASE_CMD: cp /home/runner/.local/bin/fpm fpm-haskell-$(cat fpm_version)-linux-x86_64
HASH_CMD: ls fpm-*|xargs -i{} sh -c 'sha256sum $1 > $1.sha256' -- {}
RELEASE_FLAGS: --flag --static --flag -g --flag -fbacktrace --flag -O3

- os: macos-latest
STACK_CACHE: |
/Users/runner/.stack/snapshots
/Users/runner/.stack/setup-exe-src
STACK_CACHE_VERSION: "v2"
TEST_SCRIPT: ci/run_tests.sh
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
CHECK_VERSION_CMD: grep $(cat fpm_version)
RELEASE_CMD: "cp -- fpm-$(cat fpm_version)-macos-x86_64"
BOOTSTRAP_RELEASE_CMD: cp /Users/runner/.local/bin/fpm fpm-haskell-$(cat fpm_version)-macos-x86_64
HASH_CMD: ls fpm-*|xargs -I{} sh -c 'shasum -a 256 $1 > $1.sha256' -- {}
RELEASE_FLAGS: --flag -g --flag -fbacktrace --flag -O3

- os: windows-latest
STACK_CACHE: |
C:\Users\runneradmin\AppData\Roaming\stack
C:\Users\runneradmin\AppData\Local\Programs\stack
STACK_CACHE_VERSION: "v2"
TEST_SCRIPT: ci\run_tests.bat
GET_VERSION_CMD: ("${{ github.ref }}" -Split "v")[1]
CHECK_VERSION_CMD: Select-String -Pattern Version | Where-Object { if ($_ -like -join("*",(Get-Content fpm_version),"*")) {echo $_} else {Throw} }
RELEASE_CMD: copy -- (-join("fpm-",(Get-Content fpm_version),"-windows-x86_64.exe"))
BOOTSTRAP_RELEASE_CMD: copy C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe (-join("fpm-haskell-",(Get-Content fpm_version),"-windows-x86_64.exe"))
HASH_CMD: Get-ChildItem -File -Filter "fpm-*" | Foreach-Object {echo (Get-FileHash -Algorithm SHA256 $PSItem | Select-Object hash | Format-Table -HideTableHeaders | Out-String) > (-join($PSItem,".sha256"))}
RELEASE_FLAGS: --flag --static --flag -g --flag -fbacktrace --flag -O3

env:
FC: gfortran
GCC_V: ${{ matrix.gcc_v }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Install GFortran macOS
if: contains(matrix.os, 'macos')
run: |
ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran
which gfortran-${GCC_V}
which gfortran

- name: Install GFortran Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}

- name: Get Time
id: time
uses: nanzm/[email protected]
with:
format: 'YYYY-MM'

- name: Setup github actions cache
id: cache
uses: actions/cache@v2
with:
path: ${{matrix.STACK_CACHE}}
key: ${{ runner.os }}-${{ steps.time.outputs.time }}${{matrix.STACK_CACHE_VERSION}}

- name: Build Haskell fpm
run: |
stack build
stack install
working-directory: bootstrap

- name: put fpm to PATH (macOS)
if: contains(matrix.os, 'macos')
run: |
cp /Users/runner/.local/bin/fpm /usr/local/bin

- name: put fpm to PATH (Windows)
if: contains(matrix.os, 'windows')
run: |
copy "C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe" "C:\Program Files\Git\usr\bin"

- name: put fpm to PATH (Linux)
if: contains(matrix.os, 'ubuntu')
run: |
sudo cp /home/runner/.local/bin/fpm /usr/local/bin

- name: Run tests on Haskell fpm
run: |
stack test
working-directory: bootstrap

# ----- Upload binaries if creating a release -----
- name: Check that fpm --version matches release tag
if: github.event_name == 'release'
run: |
${{ matrix.GET_VERSION_CMD }} > fpm_version
working-directory: fpm

- name: Stage release files for upload
if: github.event_name == 'release'
run: |
${{ matrix.BOOTSTRAP_RELEASE_CMD }}
${{ matrix.HASH_CMD }}
working-directory: fpm

- name: Upload assets
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: fpm/fpm-*
file_glob: true
tag: ${{ github.ref }}
overwrite: true

build:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -208,27 +78,23 @@ jobs:
shell: bash
run: |
${{ env.BOOTSTRAP }} build
working-directory: fpm

- name: Run Fortran fpm (bootstrap)
shell: bash
run: |
${{ env.BOOTSTRAP }} run
${{ env.BOOTSTRAP }} run -- --version
${{ env.BOOTSTRAP }} run -- --help
working-directory: fpm

- name: Test Fortran fpm (bootstrap)
shell: bash
run: |
${{ env.BOOTSTRAP }} test
working-directory: fpm

- name: Install Fortran fpm (bootstrap)
shell: bash
run: |
${{ env.BOOTSTRAP }} install
working-directory: fpm

# Phase 2: Bootstrap fpm with itself
- name: Replace bootstrapping version
Expand All @@ -237,7 +103,6 @@ jobs:
${{ env.BOOTSTRAP }} run --runner cp -- fpm-debug${{ matrix.exe }}
rm -v ${{ env.BOOTSTRAP }}
echo "FPM=$PWD/fpm-debug" | cat >> $GITHUB_ENV
working-directory: fpm

- name: Get version (normal)
if: github.event_name != 'release'
Expand Down Expand Up @@ -266,35 +131,30 @@ jobs:
shell: bash
run: |
${{ env.FPM }} build ${{ matrix.release-flags }}
working-directory: fpm

- name: Run Fortran fpm
shell: bash
run: |
${{ env.FPM }} run ${{ matrix.release-flags }}
${{ env.FPM }} run ${{ matrix.release-flags }} -- --version
${{ env.FPM }} run ${{ matrix.release-flags }} -- --help
working-directory: fpm

- name: Test Fortran fpm
shell: bash
run: |
${{ env.FPM }} test ${{ matrix.release-flags }}
working-directory: fpm

- name: Install Fortran fpm
shell: bash
run: |
${{ env.FPM }} install ${{ matrix.release-flags }}
working-directory: fpm

- name: Package release version
shell: bash
run: |
${{ env.FPM }} run ${{ matrix.release-flags }} --runner cp -- ${{ env.EXE }}
rm -v ${{ env.FPM }}
echo "FPM_RELEASE=$PWD/${{ env.EXE }}" | cat >> $GITHUB_ENV
working-directory: fpm
env:
EXE: fpm-${{ env.VERSION }}-${{ matrix.os-arch }}${{ matrix.exe }}

Expand All @@ -308,14 +168,13 @@ jobs:
shell: bash
run: |
${{ matrix.sha256sum }} ${{ env.FPM_RELEASE }} > ${{ env.FPM_RELEASE }}.sha256
working-directory: fpm

- name: Upload assets
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: fpm/fpm-*
file: fpm-*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.stack-work/
fpm.cabal
*~
build/*
48 changes: 20 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ matures and we enter production, we will aim to stay backwards compatible.
Please follow the [issues](https://github.com/fortran-lang/fpm/issues) to
contribute and/or stay up to date with the development.
Before opening a bug report or a feature suggestion, please read our
[Contributor Guide](CONTRIBUTING.md). You can also discuss your ideas and queries with the community in [fpm discussions](https://github.com/fortran-lang/fpm/discussions), or more broadly on [Fortran-Lang Discourse](https://fortran-lang.discourse.group/)
[Contributor Guide](CONTRIBUTING.md). You can also discuss your ideas and
queries with the community in
[fpm discussions](https://github.com/fortran-lang/fpm/discussions),
or more broadly on [Fortran-Lang Discourse](https://fortran-lang.discourse.group/).

Fortran Package Manager is not to be confused with
[Jordan Sissel's fpm](https://github.com/jordansissel/fpm), a more general,
Expand Down Expand Up @@ -71,8 +74,8 @@ with the following contents and initialized as a git repository.
* `README.md` – with your project’s name
* `.gitignore`
* `src/project_name.f90` – with a simple hello world subroutine
* `app/main.f90` (if `--with-executable` flag used) – a program that calls the subroutine
* `test/main.f90` (if `--with-test` flag used) – an empty test program
* `app/main.f90` (if `--app` flag used) – a program that calls the subroutine
* `test/main.f90` (if `--test` flag used) – an empty test program

### Building your Fortran project with fpm

Expand All @@ -81,6 +84,7 @@ with the following contents and initialized as a git repository.
* `fpm build` – build your library, executables and tests
* `fpm run` – run executables
* `fpm test` – run tests
* `fpm install` - installs the executables locally

The command `fpm run` can optionally accept the name of the specific executable
to run, as can `fpm test`; like `fpm run specific_executable`. Command line
Expand All @@ -94,36 +98,24 @@ the [manifest reference](manifest-reference.md).
### Bootstrapping instructions

This guide explains the process of building *fpm* on a platform for the first time.
If your platform and architecture are already supported, download the binary from the [release page](https://github.com/fortran-lang/fpm/releases) instead.
To build *fpm* without a prior *fpm* version a single source file version is available
at each release.

#### Download this repository
To build manually using the single source distribution use

```bash
$ git clone https://github.com/fortran-lang/fpm
$ cd fpm/
```

#### Build a bootstrap version of fpm

You can use the install script to bootstrap and install *fpm*:

```bash
$ ./install.sh
mkdir _tmp
curl -LJ https://github.com/fortran-lang/fpm/releases/download/v0.2.0/fpm-0.2.0.f90 > _tmp/fpm.f90
gfortran -J _tmp _tmp/fpm.f90 -o _tmp/fpm
_tmp/fpm install --flag "-g -fbacktrace -O3"
rm -r _tmp
```

By default, the above command installs `fpm` to `${HOME}/.local/bin/`.
To specify an alternative destination use the `--prefix=` flag, for example:
To automatically bootstrap using this appoach run the install script

```bash
$ ./install.sh --prefix=/usr/local
```

which will install *fpm* to `/usr/local/bin`.

To test that everything is working as expected you can now build *fpm*
with itself and run the tests with:

```bash
$ cd fpm
$ fpm test
./install.sh
```

You can set your Fortran compiler and the compiler flags with the ``FC`` and ``FFLAGS``
environment variables.
File renamed without changes.
2 changes: 0 additions & 2 deletions bootstrap/Setup.hs

This file was deleted.

8 changes: 0 additions & 8 deletions bootstrap/app/Main.hs

This file was deleted.

72 changes: 0 additions & 72 deletions bootstrap/package.yaml

This file was deleted.

Loading