Merge pull request #35 from 'Certseeds/dev' for v0.11.1 #64
Workflow file for this run
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
# This is a basic workflow to help you get started with Actions | |
name: test and release | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
tags-ignore: | |
- '*-release' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
test: | |
name: test for release | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-20.04, ubuntu-22.04 ] | |
env: | |
CC: gcc-10 | |
CXX: g++-10 | |
# 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 code | |
uses: actions/checkout@v3 | |
- name: hardwares - cpu | |
run: nproc; cat /proc/cpuinfo | |
- name: Install ccache, check gcc version | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update && sudo apt-get install -y ccache | |
gcc --version | |
g++ --version | |
- name: prepare libopencv ccache | |
run: | | |
sudo apt-get install libopencv-dev ccache | |
- name: Use cmake | |
run: cmake --version | |
- name: cmake prepare for compile | |
run: cmake -S . -B ./CMAKE_DEBUG_PATH -DCMAKE_BUILD_TYPE=DEBUG | |
- name: cmake compile lab_00 | |
working-directory: ./CMAKE_DEBUG_PATH/lab_00 | |
run: cmake --build . --config DEBUG --parallel | |
- name: cmake compile algorithm/2021F | |
working-directory: ./CMAKE_DEBUG_PATH/algorithm/2021F | |
run: cmake --build . --config DEBUG --parallel | |
- name: cmake compile algorithm/matrix | |
working-directory: ./CMAKE_DEBUG_PATH/algorithm/matrix | |
run: cmake --build . --config DEBUG --parallel | |
- name: cmake compile algorithm | |
working-directory: ./CMAKE_DEBUG_PATH/algorithm/ | |
run: cmake --build . | |
- name: cmake compile basic | |
working-directory: ./CMAKE_DEBUG_PATH/basic | |
run: cmake --build . --config DEBUG --parallel | |
- name: cmake compile | |
working-directory: ./CMAKE_DEBUG_PATH | |
run: cmake --build . --config DEBUG --parallel | |
- name: cmake test | |
working-directory: ./CMAKE_DEBUG_PATH | |
run: ctest --parallel $(nproc) | |
# This workflow contains a single job called "build" | |
build: | |
name: publish release | |
if: github.repository == 'Certseeds/CS203_DSAA_template' | |
needs: test | |
# The type of runner that the job will run on | |
runs-on: ubuntu-22.04 | |
# 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 code | |
uses: actions/checkout@v3 | |
- name: Branch name | |
id: branch_name | |
run: | | |
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: tag name output | |
run: | | |
echo ${SOURCE_NAME};echo ${SOURCE_BRANCH};echo ${SOURCE_TAG} | |
env: | |
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }} | |
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }} | |
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }} | |
- name: prepare libopencv | |
run: | | |
sudo apt-get update && sudo apt-get install libopencv-dev | |
# ensure the path and files of project | |
- name: ensure the path and files of project | |
run: sudo apt-get install tree; tree; mkdir -p ./cmake_build_release | |
- name: cmake install dependencies | |
run: | | |
cmake -S . -B ./cmake_build_release -DCMAKE_BUILD_TYPE=Debug | |
rm -rf ./cmake_build_release | |
- name: move cmake-fetchcontent to folder | |
working-directory: ./third_party | |
run: | | |
rm ./CMakeLists.txt | |
mv ./CMakeLists.release.txt ./CMakeLists.txt | |
- name: run script | |
working-directory: ./script | |
run: python3 file_template.py | |
- name: zip the packet | |
working-directory: ./../ | |
run: | | |
zip -r script_no_need.zip ./CS203_DSAA_template -x "*/.git/*" | |
tree | |
- name: release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ./../script_no_need.zip | |
prerelease: false | |
generate_release_notes: true | |
- name: tree | |
run: tree | |
release-branch: | |
name: publish release-branch | |
if: github.repository == 'Certseeds/CS203_DSAA_template' | |
needs: [ test, build ] | |
# The type of runner that the job will run on | |
runs-on: ubuntu-22.04 | |
env: | |
GCC_V: 11 | |
# 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 code | |
uses: actions/checkout@v3 | |
- name: Branch name | |
id: branch_name | |
run: | | |
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: tag name output | |
run: | | |
echo ${SOURCE_NAME}; | |
env: | |
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }} | |
- name: git operations | |
run: | | |
git config --global user.name 'Certseeds' | |
git config --global user.email '[email protected]' | |
git checkout -b release | |
mkdir cmake_build_release | |
- name: prepare libopencv | |
run: | | |
sudo apt-get update && sudo apt-get install libopencv-dev | |
- name: cmake install dependencies | |
run: | | |
cmake -S . -B ./cmake_build_release -DCMAKE_BUILD_TYPE=Debug | |
rm -rf ./cmake_build_release | |
- name: move cmake-fetchcontent to folder | |
working-directory: ./third_party | |
run: | | |
echo '**/.github/*' > ./.gitignore | |
rm ./CMakeLists.txt | |
mv ./CMakeLists.release.txt ./CMakeLists.txt | |
git add . | |
git commit -am "dependencies: add dependencies to release branch" | |
- name: run script | |
working-directory: ./script | |
run: python3 file_template.py | |
- name: git operations | |
working-directory: ./ | |
run: | | |
git add . | |
git commit -am "release ${{ steps.branch_name.outputs.SOURCE_NAME }}" | |
git push --set-upstream origin release --force |