diff --git a/.github/jobs/build_docker_image.sh b/.github/jobs/build_docker_image.sh index 81ce302b44..21384f7824 100755 --- a/.github/jobs/build_docker_image.sh +++ b/.github/jobs/build_docker_image.sh @@ -12,6 +12,7 @@ time_command docker build -t ${DOCKERHUB_TAG} \ --build-arg SOURCE_BRANCH \ --build-arg MET_BASE_REPO \ --build-arg MET_BASE_TAG \ + --build-arg MET_ENABLE_OPTS \ -f $DOCKERFILE_PATH ${GITHUB_WORKSPACE} if [ $? != 0 ]; then cat ${GITHUB_WORKSPACE}/docker_build.log diff --git a/.github/workflows/compiling.yml b/.github/workflows/compiling.yml new file mode 100644 index 0000000000..0c2e1cf82e --- /dev/null +++ b/.github/workflows/compiling.yml @@ -0,0 +1,62 @@ +name: Compiling + +# Test MET configuration options for all tags + +on: + + push: + tags: + - 'v**' + paths-ignore: + - 'docs/**' + - '.github/pull_request_template.md' + - '.github/ISSUE_TEMPLATE/**' + - '.github/labels/**' + - '**/README.md' + - '**/LICENSE.md' + + workflow_dispatch: + +jobs: + + compile: + name: Compile MET enable options + runs-on: ubuntu-latest + strategy: + matrix: + enable_opts: + - '' + - '--enable-all' + - '--enable-grib2' + - '--enable-python' + - '--enable-ugrid' + - '--enable-lidar2nc' + - '--enable-mode_graphics' + - '--enable-modis' + fail-fast: false + steps: + - uses: actions/checkout@v3 + + - name: Create directories to store output + run: mkdir -p ${RUNNER_WORKSPACE}/logs + + - name: Compile MET in Docker + run: .github/jobs/build_docker_image.sh + env: + SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }} + MET_BASE_REPO: ${{ needs.job_control.outputs.met_base_repo }} + MET_BASE_TAG: ${{ needs.job_control.outputs.met_base_tag }} + MET_ENABLE_OPTS: ${{ matrix.enable_opts }} + + - name: Copy all build log files into logs directory + if: always() + run: cp ${GITHUB_WORKSPACE}/*.log ${RUNNER_WORKSPACE}/logs/ + + - name: Upload logs as artifact + if: always() + uses: actions/upload-artifact@v3 + with: + name: logs + path: ${{ runner.workspace }}/logs + if-no-files-found: ignore + diff --git a/internal/scripts/docker/build_met_docker.sh b/internal/scripts/docker/build_met_docker.sh index f8f008f5e1..24ddb07f8c 100755 --- a/internal/scripts/docker/build_met_docker.sh +++ b/internal/scripts/docker/build_met_docker.sh @@ -10,6 +10,12 @@ if [ -z ${MET_GIT_NAME+x} ]; then echo "Setting MET_GIT_NAME=${MET_GIT_NAME} based on the current branch." fi +# Check whether MET_ENABLE_OPTS is defined +if [ -z ${MET_ENABLE_OPTS+x} ]; then + MET_ENABLE_OPTS='--enable-all' + echo "Setting MET_ENABLE_OPTS=${MET_ENABLE_OPTS} to compile all available options." +fi + # Create log directory mkdir -p /met/logs @@ -19,7 +25,7 @@ echo "Running bootstrap for MET ${MET_GIT_NAME} and writing log file ${LOG_FILE} echo "Configuring MET ${MET_GIT_NAME} and appending to log file ${LOG_FILE}" ./configure \ BUFRLIB_NAME=${BUFRLIB_NAME} GRIB2CLIB_NAME=${GRIB2CLIB_NAME} \ - --enable-grib2 --enable-mode_graphics --enable-modis --enable-lidar2nc --enable-python --enable-ugrid \ + ${MET_ENABLE_OPTS} \ CPPFLAGS="-I/usr/local/include -I/usr/local/include/freetype2 -I/usr/local/include/cairo" \ LIBS="-ltirpc" >> ${LOG_FILE} 2>&1 if [ $? != 0 ]; then