Skip to content

Commit

Permalink
action tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Aug 21, 2024
1 parent 6371dc9 commit bca5d55
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 147 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
os: [ macos-12, macos-13-xlarge, macos-14, ubuntu-latest, windows-latest ]

steps:
- uses: fortran-lang/setup-fortran@main
if: matrix.os == 'windows-latest'
id: setup-fortran
with:
compiler: gcc
version: 13
# - uses: fortran-lang/setup-fortran@main
# if: matrix.os == 'windows-latest'
# id: setup-fortran
# with:
# compiler: gcc
# version: 13

- run: ln -s $(which gfortran-14) /usr/local/bin/gfortran
if: matrix.os != 'windows-latest' && matrix.os != 'ubuntu-latest'
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/test_fortran.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Test Fortran

on:
push:
branches-ignore:
- 'test**'
pull_request:

jobs:
fortran-test:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'cmbant/camb')

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Run Build and Test Script
run: bash fortran/tests/run_tests.sh

- name: Upload Test Files on Failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-output-${{ github.sha }}
path: fortran/testfiles/
if-no-files-found: warn
63 changes: 63 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: tests

on: [push, pull_request]

jobs:
tests:
runs-on: ubuntu-latest
if: >
(matrix.os == 'ubuntu-latest' || !startsWith(github.ref, 'refs/heads/test')) &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != 'cmbant/camb')
strategy:
fail-fast: false
matrix:
include:
- name: "Latest Python 3.12"
os: ubuntu-latest
python-version: 3.12
- name: "OS X Python 3.8"
os: macos-latest
python-version: 3.8
- name: "Windows Python 3.8"
os: windows-latest
python-version: 3.8

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- run: ln -s $(which gfortran-14) /usr/local/bin/gfortran
if: matrix.os == 'macos-latest'

- name: flake8 Lint
if: matrix.os == 'ubuntu-latest'
uses: py-actions/flake8@v2
with:
args: --select=E713,E704,E703,E714,E10,E11,E20,E22,E23,E25,E27,E301,E302,E304,E9,F405,F406,F5,F6,F7,F8,W1,W2,W3,W6 --show-source --statistics
path: camb
max-line-length: "120"

- name: Install dependencies
run: |
python --version
gfortran --version
pip install -e .
chmod +x fortran/tests/run_tests.sh
- name: Run tests
run: |
python -c "import camb; print(camb.__version__)"
python -m unittest camb.tests.camb_test
- name: HM code tests
if: matrix.os == 'ubuntu-latest'
run: |
git clone https://github.com/alexander-mead/HMcode_test_outputs.git
python -m unittest camb.tests.hmcode_test
94 changes: 0 additions & 94 deletions .travis.yml

This file was deleted.

23 changes: 0 additions & 23 deletions fortran/tests/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
set -e

gfortran --version
python --version
pip install -e .
python -c "import camb; print(camb.__version__)"
python -m unittest camb.tests.camb_test
rm -Rf HMcode_test_outputs
git clone https://github.com/alexander-mead/HMcode_test_outputs.git
python -m unittest camb.tests.hmcode_test
rm -Rf HMcode_test_outputs
pip uninstall -y camb
rm -Rf dist/*
rm -Rf build/*
rm -f camb/*.so

case "$TRAVIS_BRANCH" in
devel*)
BRANCH="master"
;;
*)
BRANCH="master"
;;
esac

pushd fortran

make clean
Expand Down
24 changes: 0 additions & 24 deletions fortran/tests/upload_tests.sh

This file was deleted.

0 comments on commit bca5d55

Please sign in to comment.