try hoisting git out of make #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: C++/make CI | |
on: | |
push: | |
branches: [ main ] | |
tags: [ '*' ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
check: | |
name: Check code | |
runs-on: macos-latest | |
timeout-minutes: 5 | |
steps: | |
- name: install deps | |
run: | | |
brew update | |
brew install --force-bottle bear llvm | |
env: | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: yes | |
HOMEBREW_NO_ENV_HINTS: yes | |
HOMEBREW_NO_ANALYTICS: yes | |
- uses: actions/checkout@v4 | |
with: | |
repository: getargv/getargv | |
path: getargv | |
token: ${{ secrets.GH_PAT }} | |
- name: Build libgetargv | |
run: make dylib | |
working-directory: getargv | |
- name: Install libgetargv | |
run: sudo make install_dylib | |
working-directory: getargv | |
- uses: actions/checkout@v4 | |
with: | |
path: getargv.cpp | |
- name: check | |
run: "make LIBVER=$(sw_vers -ProductVersion) lint" | |
working-directory: getargv.cpp | |
test: | |
name: Test on ${{ matrix.os }} | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: | |
- macos-14 | |
- macos-13 | |
- macos-12 | |
#- macos-11 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: install deps | |
run: | | |
brew update | |
brew install --force-bottle criterion | |
env: | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: yes | |
HOMEBREW_NO_ENV_HINTS: yes | |
HOMEBREW_NO_ANALYTICS: yes | |
- uses: actions/checkout@v4 | |
with: | |
repository: getargv/getargv | |
path: getargv | |
token: ${{ secrets.GH_PAT }} | |
- name: Build libgetargv | |
run: make dylib | |
working-directory: getargv | |
- name: Install libgetargv | |
run: sudo make install_dylib | |
working-directory: getargv | |
- uses: actions/checkout@v4 | |
with: | |
path: getargv.cpp | |
- name: build unit tests | |
run: make lib_unit_tests | |
working-directory: getargv.cpp/test | |
- name: build libtests | |
run: make libtest1 libtest2 | |
working-directory: getargv.cpp/test | |
- name: run tests with coverage | |
run: make run_lib_unit_tests_coverage | |
timeout-minutes: 5 | |
working-directory: getargv.cpp/test | |
build: | |
name: Build on ${{ matrix.os }} | |
timeout-minutes: 5 | |
needs: [ check, test ] | |
strategy: | |
matrix: | |
os: | |
- macos-14 | |
- macos-13 | |
- macos-12 | |
#- macos-11 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: getargv/getargv | |
path: getargv | |
token: ${{ secrets.GH_PAT }} | |
- name: Build libgetargv | |
run: make dylib | |
working-directory: getargv | |
- name: Install libgetargv | |
run: sudo make install_dylib | |
working-directory: getargv | |
- uses: actions/checkout@v4 | |
with: | |
path: getargv.cpp | |
- name: bump version | |
run: make bump | |
working-directory: getargv.cpp | |
- name: make library | |
run: make dylib | |
working-directory: getargv.cpp | |
- name: make installer | |
run: make dmg | |
working-directory: getargv.cpp | |
- name: rename dmg | |
run: mv pkg/*.dmg pkg/libgetargv++-${{ matrix.os }}.dmg | |
working-directory: getargv.cpp | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}.zip | |
path: | | |
getargv.cpp/pkg/*.pkg | |
getargv.cpp/pkg/*.dmg | |
release: | |
needs: [ build ] | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
env: | |
GIT_AUTHOR_NAME: github-actions[bot] | |
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
GIT_COMMITTER_NAME: github-actions[bot] | |
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
MACOS_VER_NUM: 14 | |
CERT_IDENTITY: me | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: getargv.cpp | |
- uses: actions/download-artifact@v4 | |
with: | |
path: pkg | |
- name: bump version | |
id: version | |
run: echo "version=$(make bump)" >> $GITHUB_OUTPUT | |
working-directory: getargv.cpp | |
# do not merge these steps, version is scraped by makefile | |
# at start of run, so needs to be bumped separately | |
- name: tag & commit | |
run: | | |
git commit -am 'release ${{ steps.version.outputs.version }}' | |
git tag '${{ steps.version.outputs.version }}' | |
git push origin tag '${{ steps.version.outputs.version }}' | |
git push origin HEAD:main | |
working-directory: getargv.cpp | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: pkg/*.zip/*.dmg | |
name: ${{ steps.version.ouputs.version }} | |
tag_name: ${{ steps.version.ouputs.version }} |