Skip to content

Commit bca5d55

Browse files
committed
action tests
1 parent 6371dc9 commit bca5d55

File tree

6 files changed

+101
-147
lines changed

6 files changed

+101
-147
lines changed

.github/workflows/build_wheels.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
os: [ macos-12, macos-13-xlarge, macos-14, ubuntu-latest, windows-latest ]
1313

1414
steps:
15-
- uses: fortran-lang/setup-fortran@main
16-
if: matrix.os == 'windows-latest'
17-
id: setup-fortran
18-
with:
19-
compiler: gcc
20-
version: 13
15+
# - uses: fortran-lang/setup-fortran@main
16+
# if: matrix.os == 'windows-latest'
17+
# id: setup-fortran
18+
# with:
19+
# compiler: gcc
20+
# version: 13
2121

2222
- run: ln -s $(which gfortran-14) /usr/local/bin/gfortran
2323
if: matrix.os != 'windows-latest' && matrix.os != 'ubuntu-latest'

.github/workflows/test_fortran.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build and Test Fortran
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'test**'
7+
pull_request:
8+
9+
jobs:
10+
fortran-test:
11+
runs-on: ubuntu-latest
12+
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'cmbant/camb')
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.x"
22+
23+
- name: Run Build and Test Script
24+
run: bash fortran/tests/run_tests.sh
25+
26+
- name: Upload Test Files on Failure
27+
if: failure()
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: test-output-${{ github.sha }}
31+
path: fortran/testfiles/
32+
if-no-files-found: warn

.github/workflows/tests.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
if: >
9+
(matrix.os == 'ubuntu-latest' || !startsWith(github.ref, 'refs/heads/test')) &&
10+
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != 'cmbant/camb')
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- name: "Latest Python 3.12"
16+
os: ubuntu-latest
17+
python-version: 3.12
18+
- name: "OS X Python 3.8"
19+
os: macos-latest
20+
python-version: 3.8
21+
- name: "Windows Python 3.8"
22+
os: windows-latest
23+
python-version: 3.8
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
allow-prereleases: true
35+
36+
- run: ln -s $(which gfortran-14) /usr/local/bin/gfortran
37+
if: matrix.os == 'macos-latest'
38+
39+
- name: flake8 Lint
40+
if: matrix.os == 'ubuntu-latest'
41+
uses: py-actions/flake8@v2
42+
with:
43+
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
44+
path: camb
45+
max-line-length: "120"
46+
47+
- name: Install dependencies
48+
run: |
49+
python --version
50+
gfortran --version
51+
pip install -e .
52+
chmod +x fortran/tests/run_tests.sh
53+
54+
- name: Run tests
55+
run: |
56+
python -c "import camb; print(camb.__version__)"
57+
python -m unittest camb.tests.camb_test
58+
59+
- name: HM code tests
60+
if: matrix.os == 'ubuntu-latest'
61+
run: |
62+
git clone https://github.com/alexander-mead/HMcode_test_outputs.git
63+
python -m unittest camb.tests.hmcode_test

.travis.yml

Lines changed: 0 additions & 94 deletions
This file was deleted.

fortran/tests/run_tests.sh

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
11
set -e
22

3-
gfortran --version
4-
python --version
5-
pip install -e .
6-
python -c "import camb; print(camb.__version__)"
7-
python -m unittest camb.tests.camb_test
8-
rm -Rf HMcode_test_outputs
9-
git clone https://github.com/alexander-mead/HMcode_test_outputs.git
10-
python -m unittest camb.tests.hmcode_test
11-
rm -Rf HMcode_test_outputs
12-
pip uninstall -y camb
13-
rm -Rf dist/*
14-
rm -Rf build/*
15-
rm -f camb/*.so
16-
17-
case "$TRAVIS_BRANCH" in
18-
devel*)
19-
BRANCH="master"
20-
;;
21-
*)
22-
BRANCH="master"
23-
;;
24-
esac
25-
263
pushd fortran
274

285
make clean

fortran/tests/upload_tests.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)