Skip to content

fix output error in Index_2, plus two minor output tweaks (#647) #431

fix output error in Index_2, plus two minor output tweaks (#647)

fix output error in Index_2, plus two minor output tweaks (#647) #431

Workflow file for this run

# Builds the stock synthesis executables for testing and distribution using the admb docker image.
# for macOS 12, and macos-14 (arm64 architecture), linux, Windows
# Runs on every push and PR (even draft PRs)
name: build-ss3
on:
push:
paths:
- '**.tpl'
- '**.sh'
workflow_dispatch:
jobs:
build-ss3:
if: ${{ github.event_name == 'workflow_dispatch' || github.event == 'push' || github.event.workflow_run.conclusion == 'failure' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest}
- {os: macos-13}
- {os: macos-latest}
- {os: ubuntu-latest}
# Limit run time to 90 min to avoid wasting action minutes.
# was set to 15 and then 30 minutes previously, but compiling admb
# on mac took too long
timeout-minutes: 90
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout ss3 repo
uses: actions/checkout@v4
with:
repository: 'nmfs-ost/ss3-source-code'
# Checkout ADMB repository
- name: Checkout admb for macos-13 build
uses: actions/checkout@v4
with:
repository: admb-project/admb
path: admb
ref: admb-13.2
- name: Update Ubuntu packages
if: matrix.config.os == 'ubuntu-latest'
run: sudo apt-get update
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Fetch git tags
run: |
git fetch --tags
git fetch --prune --unshallow || true
# Build ADMB for macos-13
- name: Build ADMB for macos-13 and put in path
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest'
run: |
cd admb && make clean
- name: See where admb is
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest'
run: |
cd admb && ls
- name: Compile admb, macOS
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest'
run: |
cd admb && make -j 4
- name: Change permissions of admb and put in path, macOS
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest'
run: |
sudo mv admb /usr/local/bin
sudo chmod 755 /usr/local/bin/admb
echo "/usr/local/bin/admb" >> $GITHUB_PATH
- name: Get the last tag on Windows
id: get-latest-tag-win
if: matrix.config.os == 'windows-latest'
run: |
git tag
$latest_tag = (git describe --abbrev=0 --tags)
$latest_tag_commit = ( git rev-list -n 1 $latest_tag)
$latest_commit = (git rev-list HEAD -n 1)
echo "tag=${latest_tag}" >> $env:GITHUB_OUTPUT
echo "tag_commit=${latest_tag_commit}" >> $env:GITHUB_OUTPUT
echo "commit=${latest_commit}" >> $env:GITHUB_OUTPUT
- name: Pull the last tag value to use in the Rscript on Windows
id: get-version-win
if: matrix.config.os == 'windows-latest'
run: |
Out-File -InputObject ${{ steps.get-latest-tag-win.outputs.tag }} -FilePath .github/last_tag.txt
Out-File -InputObject ${{ steps.get-latest-tag-win.outputs.tag_commit }} -FilePath .github/last_tag_commit.txt
Out-File -InputObject ${{ steps.get-latest-tag-win.outputs.commit}} -FilePath .github/last_commit.txt
- name: Get the last tag on unix (macOS and linux)
id: get-latest-tag-unix
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest' || matrix.config.os == 'ubuntu-latest'
run: |
git tag
latest_tag=$(git describe --abbrev=0 --tags)
latest_tag_commit=$(git rev-list -n 1 $latest_tag)
latest_commit=$(git rev-list HEAD -n 1)
echo "tag=${latest_tag}" >> $GITHUB_OUTPUT
echo "tag_commit=${latest_tag_commit}" >> $GITHUB_OUTPUT
echo "commit=${latest_commit}" >> $GITHUB_OUTPUT
- name: Pull the last tag value to use in the Rscript on unix (macOS and linux)
id: get-version-unix
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest' || matrix.config.os == 'ubuntu-latest'
run: |
echo "${{ steps.get-latest-tag-unix.outputs.tag }}" > .github/last_tag.txt
echo "${{ steps.get-latest-tag-unix.outputs.tag_commit }}" > .github/last_tag_commit.txt
echo "${{ steps.get-latest-tag-unix.outputs.commit }}" > .github/last_commit.txt
- name: Edit the version info for safe version using R code
run: |
# Get the version
# get the last tag from the repository
tag_label <- readLines(".github/last_tag.txt")
# get commits from from the repository
tag_commit <- readLines(".github/last_tag_commit.txt")
last_commit <- readLines(".github/last_commit.txt")
message("The tag_label is ", tag_label)
if (substr(tag_label, start = 1, stop = 6) == "v3.30.") {
ver_num_full <- strsplit(tag_label, split = "v3.30", fixed = TRUE)[[1]][2]
ver_num <- strsplit(ver_num_full, split = ".", fixed = TRUE)[[1]][2]
if(length(grep("-", ver_num)) > 0) {
ver_num <- strsplit(ver_num, split = "-", fixed = TRUE)[[1]][1]
}
} else {
ver_num <- "unknown"
}
message("tag commit: ", tag_commit)
message("last commit: ", last_commit)
if(tag_commit == last_commit) {
# figure out the version using the tag
if(ver_num == "unknown") {
fix_ver_num <- "unknown"
} else {
ver_num_full_split <- strsplit(ver_num_full, split = ".", fixed = TRUE)[[1]]
if(length(ver_num_full_split) == 3) {
fix_ver_num <- ver_num_full_split[3]
} else if(length(ver_num_full_split) == 2) {
if(length(grep("-", ver_num_full_split, fixed = TRUE)) > 0) {
fix_ver_num <- strsplit(ver_num_full_split[2], split = "-", fixed = TRUE)[[1]][2]
fix_ver_num <- paste0("00-", fix_ver_num)
} else {
fix_ver_num <- "00"
}
} else {
fix_ver_num <- "unknown"
}
}
} else {
fix_ver_num <- "beta: not an official version of SS"
}
message("The minor version label is ", ver_num)
message("The patch version label is ", fix_ver_num)
# add version numbers to files
# safe file
ver_info <- readLines("SS_versioninfo_330safe.tpl")
ver_info_start <- grep('Create string with version info', ver_info, fixed = TRUE)
ver_info[ver_info_start + 1] <-
gsub('\\.xx', paste0('\\.', ver_num), ver_info[ver_info_start + 1])
ver_info[ver_info_start + 1] <-
gsub('\\.yy', paste0('\\.', fix_ver_num), ver_info[ver_info_start+1])
writeLines(ver_info, "SS_versioninfo_330safe.tpl")
#opt file
ver_info <- readLines("SS_versioninfo_330opt.tpl")
ver_info_start <- grep('Create string with version info', ver_info, fixed = TRUE)
ver_info[ver_info_start + 1] <-
gsub('\\.xx', paste0('\\.', ver_num), ver_info[ver_info_start + 1])
ver_info[ver_info_start + 1] <-
gsub('\\.yy', paste0('\\.', fix_ver_num), ver_info[ver_info_start+1])
writeLines(ver_info, "SS_versioninfo_330opt.tpl")
shell: Rscript {0}
- name: Build stock synthesis for windows with admb docker image
if: matrix.config.os == 'windows-latest'
run: |
cd Compile
./Make_SS_fast.bat || true
./Make_SS_safe.bat || true
cd ..
- name: Move exes to a new folder on windows
if: matrix.config.os == 'windows-latest'
run: |
mkdir SS330
chmod 777 SS330
mv Compile/ss3.exe SS330/
mv Compile/ss3_opt.exe SS330/
mv SS330/ss3.exe SS330/ss3_win.exe
mv SS330/ss3_opt.exe SS330/ss3_opt_win.exe
- name: Build stock synthesis for mac with admb from source
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest'
run: |
rm -rf SS330
rm -rf ss3_osx.tar
mkdir SS330
chmod 777 SS330
/bin/bash ./Make_SS_330_new.sh -b SS330
/bin/bash ./Make_SS_330_new.sh -b SS330 -o
# - name: Build stock synthesis for mac m2 with admb docker image
# if: matrix.config.os == 'macos-latest'
# run: |
# brew update
# brew install docker
# brew install --head colima
# colima start --arch x86_64
# docker pull johnoel/admb-13.2:linux
# rm -rf SS330
# rm -rf ss3_osx.tar
# mkdir SS330
# chmod 777 SS330
# /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330
# /bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -o
- name: Verify binary on mac
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest'
run: |
shasum -a 256 SS330/ss3
shasum -a 256 SS330/ss3_opt
- name: Delete unneeded files and change exe names on mac
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest'
run: |
cd SS330
rm *.obj *.htp *.cpp ss3_opt.tpl ss3.tpl
mv ss3 ss3_osx
mv ss3_opt ss3_opt_osx
- name: Build stock synthesis for linux with p flag and admb docker image
if: matrix.config.os == 'ubuntu-latest'
run: |
rm -rf SS330
rm -rf ss3_osx.tar
mkdir SS330
chmod 777 SS330
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -p
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -o -p
- name: Verify binary on linux
if: matrix.config.os == 'ubuntu-latest'
run: |
sha256sum SS330/ss3
sha256sum SS330/ss3_opt
- name: Delete unneeded files and change exe names on linux
if: matrix.config.os == 'ubuntu-latest'
run: |
cd SS330
rm *.obj *.htp *.cpp ss3_opt.tpl ss3.tpl
mv ss3 ss3_linux
mv ss3_opt ss3_opt_linux
- name: Archive binaries
if: success()
uses: actions/upload-artifact@main
with:
name: ss3-${{ matrix.config.os }}
path: SS330/