-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init: create an example repo using GitHub actions
- Loading branch information
0 parents
commit 08036b4
Showing
8 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build and Test | ||
|
||
on: [push, pull_request] | ||
|
||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, macOS-latest, windows-latest] | ||
env: | ||
GCC_V: 12 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- uses: fortran-lang/setup-fpm@v5 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install Dependencies Ubuntu | ||
if: contains(matrix.os, 'ubuntu') | ||
run: | | ||
sudo apt-get update | ||
sudo apt install -y gfortran-${GCC_V} | ||
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} 100 | ||
- name: Install Dependencies MacOS | ||
if: contains(matrix.os, 'macos') | ||
run: | | ||
brew install gcc@${GCC_V} | ||
sudo ln -s $(which gfortran-${GCC_V}) $(dirname $(which gfortran-${GCC_V}))/gfortran | ||
- name: Install Dependencies Windows | ||
if: contains(matrix.os, 'windows') | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
update: true | ||
path-type: inherit | ||
install: >- | ||
mingw-w64-x86_64-gcc-fortran | ||
- name: Build and Test Linux and MacOS | ||
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | ||
run: | | ||
which gfortran | ||
gfortran --version | ||
fpm test | ||
- name: Build and Test Windows | ||
if: contains(matrix.os, 'windows') | ||
shell: msys2 {0} | ||
run: | | ||
which gfortran | ||
gfortran --version | ||
fpm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Build and Deploy Documentation | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
documentation: | ||
runs-on: ubuntu-22.04 | ||
|
||
env: | ||
FC: gfortran | ||
GCC_V: 12 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Dependencies Ubuntu | ||
run: | | ||
sudo apt-get update | ||
sudo apt install -y gfortran-${GCC_V} python3-dev graphviz | ||
sudo pip install ford markdown==3.3.4 | ||
- name: Build Developer Documenation | ||
run: | | ||
ford doc/ford-front-matter.md | ||
- name: Upload Documentation | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: documentation | ||
path: doc/ford_site | ||
if-no-files-found: error | ||
|
||
- name: Broken Link Check | ||
if: ${{ github.ref == 'refs/heads/main'}} | ||
uses: technote-space/broken-link-checker-action@v1 | ||
with: | ||
TARGET: file://${{ github.workspace }}/ford_site/index.html | ||
RECURSIVE: true | ||
ASSIGNEES: ${{ github.actor }} | ||
|
||
- name: Deploy API Documentation | ||
uses: JamesIves/[email protected] | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
with: | ||
branch: gh-pages | ||
folder: doc/ford_site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
doc/ford_site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ci-example | ||
|
||
A simple, contrived project for demonstrating use of the GitHub CI features for a Fortran project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
project: CI-Example | ||
summary: A simple, contrived project for demonstrating use of the GitHub CI features for a Fortran project. | ||
email: [email protected] | ||
src_dir: ../src | ||
exclude_dir: ../doc | ||
preprocessor: gfortran -E | ||
display: public | ||
protected | ||
private | ||
sort: permission-alpha | ||
output_dir: ../doc/ford_site | ||
graph: true | ||
md_extensions: markdown.extensions.toc | ||
... | ||
|
||
Welcome to the Fortran CI Example. | ||
|
||
## How to Read This Documentation | ||
|
||
The listings below are not exhaustive. | ||
To see the full listings use the links at the top of the page. | ||
Also, if you know what you're looking for, there is a search bar in the top right. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name = "ci-example" | ||
version = "0.1.0" | ||
license = "MIT" | ||
author = "Brad Richardson" | ||
maintainer = "[email protected]" | ||
copyright = "Copyright 2022, Brad Richardson" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module ci_example | ||
implicit none | ||
private | ||
|
||
public :: create_greeting | ||
contains | ||
pure function create_greeting(name) result(greeting) | ||
!! Given a [name], construct a [greeting] for them | ||
character(len=*), intent(in) :: name | ||
character(len=:), allocatable :: greeting | ||
|
||
greeting = "Hello, " // name // "!" | ||
end function | ||
end module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
program test | ||
use ci_example, only: create_greeting | ||
|
||
implicit none | ||
|
||
character(len=*), parameter :: name = "World" | ||
character(len=*), parameter :: expected = "Hello, " // name // "!" | ||
character(len=:), allocatable :: greeting | ||
|
||
greeting = create_greeting(name) | ||
if (greeting == expected) then | ||
print *, "Test passed!" | ||
else | ||
error stop "Test failed! Expected '" // expected // "' but got '" // greeting // "'" | ||
end if | ||
end program |