Skip to content

Generate Results and Store as Artifact #154

Generate Results and Store as Artifact

Generate Results and Store as Artifact #154

name: Generate Results and Store as Artifact
on:
# Run every month on the first day
schedule:
- cron: '0 0 1 * *'
# Allow manual triggering
workflow_dispatch:
# Check if github runner is updated
workflow_run:
workflows: ["Detect Runner Change"]
types:
- completed
jobs:
generate-secret:
# It runs only if the runner is updated or if manually triggered
if: ${{ github.event.workflow_run.conclusion == 'failure' || github.event_name == 'workflow_dispatch' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest']
python-version: ['3.12']
gcc-version: ['12']
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
id: cache-virtualenv
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-2-${{ hashFiles('pyproject.toml') }}-${{ matrix.os }}-${{ matrix.python-version }}
- name: Install Fortran compiler on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y gfortran-${{ matrix.gcc-version }}
- name: Install Fortran compiler on macOS
if: matrix.os == 'macos-latest'
run: |
brew install gcc@${{ matrix.gcc-version }}
echo "FC=gfortran-${{ matrix.gcc-version }}" >> "$GITHUB_ENV"
echo "CC=gcc-${{ matrix.gcc-version }}" >> "$GITHUB_ENV"
- name: Install dependencies
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
python -m pip install -e .[develop]
- name: Train the ResNet
run: |
python examples/example_train.py tests/test_data/conf_resnet.yaml
python examples/example_post.py tests/test_data/conf_resnet.yaml
- name: Upload ResNet results
uses: actions/upload-artifact@v4
with:
name: ResNet-results-${{ matrix.python-version }}-${{ matrix.os }}
path: tests/test_data/speckles/Model_test_resnet_score
retention-days: 31
- name: Upload ResNet weights
uses: actions/upload-artifact@v4
with:
name: ResNet-weights-${{ matrix.python-version }}-${{ matrix.os }}
path: tests/test_data/speckles/Model_test_resnet_states
retention-days: 31
- name: Train the SCNN
run: |
python examples/example_train.py tests/test_data/conf_scnn.yaml
python examples/example_post.py tests/test_data/conf_scnn.yaml
- name: Upload SCNN results
uses: actions/upload-artifact@v4
with:
name: SCNN-results-${{ matrix.python-version }}-${{ matrix.os }}
path: tests/test_data/speckles/Model_test_scnn_score
retention-days: 31
- name: Upload SCNN weights
uses: actions/upload-artifact@v4
with:
name: SCNN-weights-${{ matrix.python-version }}-${{ matrix.os }}
path: tests/test_data/speckles/Model_test_scnn_states
retention-days: 31