Skip to content

Commit

Permalink
Update build-ss3.yml with admb build from source for macos-13 (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-perl-NOAA authored Sep 30, 2024
1 parent 7adcf1b commit 1ad07ba
Showing 1 changed file with 46 additions and 28 deletions.
74 changes: 46 additions & 28 deletions .github/workflows/build-ss3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ on:
- '**.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-12}
- {os: macos-13}
- {os: macos-latest}
- {os: ubuntu-latest}
# Limit run time to 90 min to avoid wasting action minutes.
Expand All @@ -29,8 +31,19 @@ jobs:
# 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
- uses: actions/checkout@v4

- 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
Expand All @@ -42,7 +55,27 @@ jobs:
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'
run: |
cd admb && make clean
- name: See where admb is
if: matrix.config.os == 'macos-13'
run: |
cd admb && ls
- name: Compile admb, macOS
if: matrix.config.os == 'macos-13'
run: |
cd admb && make -j 4
- name: Change permissions of admb and put in path, macOS
if: matrix.config.os == 'macos-13'
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'
Expand All @@ -55,8 +88,6 @@ jobs:
echo "tag_commit=${latest_tag_commit}" >> $env:GITHUB_OUTPUT
echo "commit=${latest_commit}" >> $env:GITHUB_OUTPUT
# uses: actions-ecosystem/action-get-latest-tag@v1 # for linux

- name: Pull the last tag value to use in the Rscript on Windows
id: get-version-win
if: matrix.config.os == 'windows-latest'
Expand All @@ -67,7 +98,7 @@ jobs:
- name: Get the last tag on unix (macOS and linux)
id: get-latest-tag-unix
if: matrix.config.os == 'macos-12' || matrix.config.os == 'macos-latest' || matrix.config.os == 'ubuntu-latest'
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)
Expand All @@ -77,16 +108,14 @@ jobs:
echo "tag_commit=${latest_tag_commit}" >> $GITHUB_OUTPUT
echo "commit=${latest_commit}" >> $GITHUB_OUTPUT
# uses: actions-ecosystem/action-get-latest-tag@v1 # for linux

- 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-12' || matrix.config.os == 'macos-latest' || matrix.config.os == 'ubuntu-latest'
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
Expand Down Expand Up @@ -169,26 +198,15 @@ jobs:
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 docker image
if: matrix.config.os == 'macos-12'
- name: Build stock synthesis for mac with admb from source
if: matrix.config.os == 'macos-13'
run: |
brew install docker
colima start
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
colima stop
# Once macos-12 no longer is kept up by GitHub actions, we will have to
# build from source the macos-13 and the macos-14 x86_64 images to make versions
# compatible with x86_64 machines
/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'
Expand All @@ -207,13 +225,13 @@ jobs:
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -o
- name: Verify binary on mac
if: matrix.config.os == 'macos-12' || matrix.config.os == 'macos-latest'
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-12' || matrix.config.os == 'macos-latest'
if: matrix.config.os == 'macos-13' || matrix.config.os == 'macos-latest'
run: |
cd SS330
rm *.obj *.htp *.cpp ss3_opt.tpl
Expand Down

0 comments on commit 1ad07ba

Please sign in to comment.