Skip to content

Commit

Permalink
Change working directory for Docker build
Browse files Browse the repository at this point in the history
An attempt to use learnings from here:

actions/runner#1009
  • Loading branch information
Scott Harrison Moeller committed Mar 13, 2021
1 parent fcaf522 commit 45a056f
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 8 deletions.
93 changes: 85 additions & 8 deletions .github/workflows/gcc-problems.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#######
# This pipeline runs various static analysis (e.g. GCC warnings) against the c / c++ pull requests.
#
# TODO: Move Docker container caching / storage to a repository
#
# TODO: Reduce workflow description duplication across jobs
# - Option: by use of Workflow Templates per gcc-build-target (need to move docker build to another workflow and requires container repo)
# - Option: by improving our build system and enabling faster build-all-targets
#######
name: "GCC Warnings & Errors"
on:
Expand Down Expand Up @@ -59,11 +65,14 @@ jobs:
name: build_container
path: /tmp/mme_builder.tar

# TODO: Output build log file as artifact (copy out of docker, cache artifact)
build_oai:
runs-on: ubuntu-latest
needs: gen_build_container
steps:
-
# This is necessary for overlays into the Docker container below?
name: Check Out Repo
uses: actions/checkout@v2
-
# I am using mmagician fork of get-changed-files (forked from jitterbit/get-changed-files)
# Rationale: our workflow (merge branch into upstream master) is incompatible
Expand All @@ -74,8 +83,65 @@ jobs:
with:
format: 'space-delimited'
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
name: Download docker image from generate_container_for_build
uses: actions/download-artifact@v2
with:
name: build_container
path: /tmp
-
name: Load Docker image
run: |
docker load --input /tmp/mme_builder.tar
docker image ls -a
-
# If needed https://github.com/microsoft/vscode-cpptools/issues/2266 for path fixups
#
# Additional GH Issues regarding paths for monorepos without root build.
# - https://github.com/actions/runner/issues/659
# - https://github.com/actions/runner/issues/765
#
# Paths emitted on warnings must be relative to the repository (e.g. lte/gateway/...),
# Therefore below I use `xo` to fixup our path emissions on gcc warnings.
uses: electronjoe/gcc-problem-matcher@v1
-
name: Build and Apply GCC Problem Matcher
uses: addnab/docker-run-action@v2
with:
image: magma/mme_builder:latest
# TODO: Remove work-around mount to /work (https://github.com/addnab/docker-run-action/issues/11)
options: -v ${{ github.workspace }}:/work -e ABC=123
run: |
echo "Github Workspace SHM: $GITHUB_WORKSPACE"
ls -R /github/
cd /work/lte/gateway/
make build_oai 2>&1 > /work/compile.log
for file in ${{ steps.changed_files.outputs.all }};
do grep $file /work/compile.log | xo '/\/magma\/((.*):(\d+):(\d+):\s+(?:fatal\s)?(warning|error):\s+(.*))/$1/' || true;
done;
-
name: Store build_logs_oai Artifact
uses: actions/upload-artifact@v2
with:
name: build_logs_oai
path: ${{ github.workspace }}/compile.log

build_session_manager:
runs-on: ubuntu-latest
needs: gen_build_container
steps:
-
# This is necessary for overlays into the Docker container below?
name: Check Out Repo
uses: actions/checkout@v2
-
# I am using mmagician fork of get-changed-files (forked from jitterbit/get-changed-files)
# Rationale: our workflow (merge branch into upstream master) is incompatible
# See long list of GH Issues on https://github.com/jitterbit/get-changed-files w.r.t. head ahead of base
name: Fetch list of changed files
id: changed_files
uses: mmagician/get-changed-files@v2
with:
format: 'space-delimited'
-
name: Download docker image from generate_container_for_build
uses: actions/download-artifact@v2
Expand All @@ -93,17 +159,28 @@ jobs:
# Additional GH Issues regarding paths for monorepos without root build.
# - https://github.com/actions/runner/issues/659
# - https://github.com/actions/runner/issues/765
#
# Paths emitted on warnings must be relative to the repository (e.g. lte/gateway/...),
# Therefore below I use `xo` to fixup our path emissions on gcc warnings.
uses: electronjoe/gcc-problem-matcher@v1
-
name: Build and Apply GCC Problem Matcher
uses: addnab/docker-run-action@v2
with:
image: magma/mme_builder:latest
# TODO: Break up this long line (can I use '\' at end of each line?)
run: cd /magma/lte/gateway;make build_oai 2>&1 > /compile.log;for file in ${{ steps.changed_files.outputs.all }}; do grep $file /compile.log | xo '/\/magma\/((.*):(\d+):(\d+):\s+(?:fatal\s)?(warning|error):\s+(.*))/$1/' || true; done;
# TODO: Remove work-around mount to /work (https://github.com/addnab/docker-run-action/issues/11)
options: -v ${{ github.workspace }}:/work -e ABC=123
run: |
echo "Github Workspace SHM: $GITHUB_WORKSPACE"
ls -R /github/
cd /work/lte/gateway/
make build_session_manager 2>&1 > /work/compile.log
for file in ${{ steps.changed_files.outputs.all }};
do grep $file /work/compile.log | xo '/\/magma\/((.*):(\d+):(\d+):\s+(?:fatal\s)?(warning|error):\s+(.*))/$1/' || true;
done;
-
name: Store oai_build_logs artifact
name: Store build_logs_session_manager Artifact
uses: actions/upload-artifact@v2
with:
name: oai_build_logs
path: /compile.log
name: build_logs_session_manager
path: ${{ github.workspace }}/compile.log
1 change: 1 addition & 0 deletions lte/gateway/c/session_manager/AAAClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace { // anonymous

aaa::terminate_session_request create_deactivate_req(
const std::string& radius_session_id, const std::string& imsi) {
int yet_another_unused_variable = 2;
aaa::terminate_session_request req;
req.set_radius_session_id(radius_session_id);
req.set_imsi(imsi);
Expand Down

0 comments on commit 45a056f

Please sign in to comment.