From 5c1796d3c491a654d2e1e1e732d12e936b4ce3fa Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 14 Dec 2021 15:35:37 +0000 Subject: [PATCH] chore: Use docker for the autotools ci build. This makes it easier to run it locally for testing and ensures the dockerfile continues to work. --- .github/settings.yml | 1 + .github/workflows/ci.yml | 21 ++++++--------------- auto_tests/Makefile.inc | 8 -------- other/docker/autotools/Dockerfile | 25 +++++++++++++++++-------- 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/.github/settings.yml b/.github/settings.yml index 3555e5b648..0eb9cf1fa3 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -12,6 +12,7 @@ branches: protection: required_status_checks: contexts: + - build-nacl - Codacy Static Code Analysis - CodeFactor - "ci/circleci: asan" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56a3d44599..44daeb66ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,18 +10,9 @@ jobs: build-nacl: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: - sudo apt-get update && - sudo apt-get install -y --no-install-recommends - libconfig-dev - libopus-dev - libvpx-dev - pkg-config - - - name: Build NaCl - run: .travis/autotools-linux install - - - name: Build toxcore - run: CC=gcc .travis/autotools-linux script + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Docker Build + uses: docker/build-push-action@v2 + with: + file: other/docker/autotools/Dockerfile diff --git a/auto_tests/Makefile.inc b/auto_tests/Makefile.inc index 42a6694005..efc2975ef5 100644 --- a/auto_tests/Makefile.inc +++ b/auto_tests/Makefile.inc @@ -62,10 +62,6 @@ endif check_PROGRAMS = $(TESTS) -bootstrap_test_SOURCES = ../auto_tests/bootstrap_test.c -bootstrap_test_CFLAGS = $(AUTOTEST_CFLAGS) -bootstrap_test_LDADD = $(AUTOTEST_LDADD) - conference_double_invite_test_SOURCES = ../auto_tests/conference_double_invite_test.c conference_double_invite_test_CFLAGS = $(AUTOTEST_CFLAGS) conference_double_invite_test_LDADD = $(AUTOTEST_LDADD) @@ -190,10 +186,6 @@ skeleton_test_SOURCES = ../auto_tests/skeleton_test.c skeleton_test_CFLAGS = $(AUTOTEST_CFLAGS) skeleton_test_LDADD = $(AUTOTEST_LDADD) -tcp_relay_test_SOURCES = ../auto_tests/tcp_relay_test.c -tcp_relay_test_CFLAGS = $(AUTOTEST_CFLAGS) -tcp_relay_test_LDADD = $(AUTOTEST_LDADD) - TCP_test_SOURCES = ../auto_tests/TCP_test.c TCP_test_CFLAGS = $(AUTOTEST_CFLAGS) TCP_test_LDADD = $(AUTOTEST_LDADD) diff --git a/other/docker/autotools/Dockerfile b/other/docker/autotools/Dockerfile index 9922a62bc6..a2839a06af 100644 --- a/other/docker/autotools/Dockerfile +++ b/other/docker/autotools/Dockerfile @@ -1,23 +1,32 @@ ################################################ # autotools-linux -FROM localbuild/travis:1.0.0 +FROM ubuntu:20.04 -USER root RUN apt-get update && apt-get install --no-install-recommends -y \ autoconf \ automake \ + ca-certificates \ + curl \ + libconfig-dev \ + libopus-dev \ libtool \ + libvpx-dev \ + make \ + pkg-config \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -USER travis + +RUN groupadd -r -g 1000 builder \ + && useradd -m --no-log-init -r -g builder -u 1000 builder +USER builder # Copy minimal files to run "autotools-linux install", so we can avoid # rebuilding nacl and other things when only source files change. -RUN mkdir -p /home/travis/build/c-toxcore /home/travis/cache -WORKDIR /home/travis/build/c-toxcore -COPY --chown=travis:travis c-toxcore/.travis/ /home/travis/build/c-toxcore/.travis/ +RUN mkdir -p /home/builder/build/c-toxcore /home/builder/cache +WORKDIR /home/builder/build/c-toxcore +COPY --chown=builder:builder .travis/ /home/builder/build/c-toxcore/.travis/ RUN .travis/autotools-linux install # Now copy the rest of the sources and run the build. -COPY --chown=travis:travis . /home/travis/build/ -RUN .travis/autotools-linux script +COPY --chown=builder:builder . /home/builder/build/c-toxcore/ +RUN CC=gcc .travis/autotools-linux script