Skip to content

Commit

Permalink
Merge pull request #246 from LKedward/release_builds
Browse files Browse the repository at this point in the history
CI: upload binaries when a release is published
  • Loading branch information
LKedward authored Nov 25, 2020
2 parents 2612d9a + 846d4e5 commit 105644c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
49 changes: 48 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: CI

on: [push, pull_request]
on:
push:
pull_request:
release:
types: [published]

env:
CI: "ON" # We can detect this in the build system and other vendors implement it
Expand All @@ -23,16 +27,33 @@ jobs:
- os: ubuntu-latest
STACK_CACHE: "/home/runner/.stack/"
STACK_CACHE_VERSION: ""
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
CHECK_VERSION_CMD: grep $(cat fpm_version)
RELEASE_CMD: "fpm run --flag --static --flag -g --flag -fbacktrace --flag -O3 --runner cp -- fpm-v$(cat fpm_version)-linux-x86_64"
BOOTSTRAP_RELEASE_CMD: cp /home/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-linux-x86_64
HASH_CMD: ls fpm-*|xargs -i{} sh -c 'sha256sum $1 > $1.sha256' -- {}

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

- os: windows-latest
STACK_CACHE: |
C:\Users\runneradmin\AppData\Roaming\stack
C:\Users\runneradmin\AppData\Local\Programs\stack
STACK_CACHE_VERSION: "v2"
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: fpm run --flag --static --flag -g --flag -fbacktrace --flag -O3 --runner copy -- (-join("fpm-v",(Get-Content fpm_version),"-windows-x86_64.exe"))
BOOTSTRAP_RELEASE_CMD: copy C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe (-join("fpm-bootstrap-v",(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"))}

env:
FC: gfortran
Expand Down Expand Up @@ -104,3 +125,29 @@ jobs:
if: contains(matrix.os, 'windows')
run: |
ci\run_tests.bat
# ----- Upload binaries if creating a release -----
- name: Check that fpm --version matches release tag
if: github.event_name == 'release'
run: |
cd fpm
${{ matrix.GET_VERSION_CMD }} > fpm_version
fpm run -- "--version" | ${{ matrix.CHECK_VERSION_CMD }}
- name: Stage release files for upload
if: github.event_name == 'release'
run: |
cd fpm
${{ matrix.RELEASE_CMD }}
${{ matrix.BOOTSTRAP_RELEASE_CMD }}
${{ matrix.HASH_CMD }}
- 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
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,31 @@ To report a bug report or suggest a feature, please read our

## Getting started

### Install Haskell
### Binary download
`x86-64` binaries are available [to download](https://github.com/fortran-lang/fpm/releases) for Windows, MacOS and Linux.

__Note:__ On Linux and MacOS, you will need to enable executable permission before you can use the binary.

_e.g._ `$ chmod u+x fpm-v0.1.0-linux-x86_64`

### Build from source

#### Install Haskell

To install **Haskell Stack**, follow these
[instructions](https://docs.haskellstack.org/en/stable/install_and_upgrade/),
users without superuser (admin) permissions should follow the
[manual installation](https://docs.haskellstack.org/en/stable/install_and_upgrade/#manual-download_2)
procedure.

### Download this repository
#### Download this repository

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

### Build and test fpm
#### Build and test fpm

Bootstrap *fpm* using:

Expand Down

0 comments on commit 105644c

Please sign in to comment.