1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
name: Compile & test
# Run whenever we push to any branch other than [coverity-scan], or if we
# manually trigger a workflow.
on:
push:
branches:
- '**'
- '!coverity-scan'
workflow_dispatch:
env:
# Shared variables amongst all projects / platforms / compilers.
CFLAGS_ALL: -std=c99 -O2
CFLAGS_CLANG_LIBCPERCIVA: -Wall -Wextra -Werror -Weverything
-Wno-#warnings -Wno-pedantic -Wno-padded
-Wno-format-nonliteral
-Wno-disabled-macro-expansion
-Wno-missing-noreturn -Wno-reserved-id-macro
-Wno-unused-macros
-Wno-documentation-unknown-command
CFLAGS_GCC_LIBCPERCIVA: -Wall -Wextra -Werror -Wpedantic
-pedantic-errors -Wno-clobbered
# Variables for specific projects / platforms / compilers.
LIBARCHIVE_OBJECTS: tar/tarsnap-bsdtar.o tar/tarsnap-getdate.o
tar/tarsnap-read.o tar/tarsnap-subst.o
tar/tarsnap-tree.o tar/tarsnap-util.o
tar/tarsnap-write.o libarchive/libarchive.a
CFLAGS_CLANG_PROJECT: -Wno-undef -Wno-implicit-fallthrough
-Wno-reserved-identifier
CFLAGS_GCC_PROJECT: -Wno-cpp
# Needed for major() / minor() / makedev() thing.
CFLAGS_LIBARCHIVE_GCC: -Wno-error
CFLAGS_OSX: -Wno-poison-system-directories
-Wno-deprecated-declarations
LDFLAGS_OSX:
jobs:
Ubuntu:
name: Ubuntu
runs-on: ubuntu-22.04
steps:
- name: Update apt-get
run: sudo apt-get update
- name: Install software
run: sudo apt-get install --no-install-recommends valgrind e2fslibs-dev
autoconf-archive
- name: Checkout code
uses: actions/checkout@v4
- name: autoreconf
run:
autoreconf -i
- name: configure with clang
env:
CC: clang-13
CFLAGS: ${{ env.CFLAGS_ALL }}
run: ./configure
- name: Compile libarchive with clang
env:
CC: clang-13
# We need to use more permissive CFLAGS for libarchive code.
CFLAGS: ${{ env.CFLAGS_ALL }}
run: make ${{ env.LIBARCHIVE_OBJECTS }}
- name: Compile with clang
env:
CC: clang-13
CFLAGS: ${{ env.CFLAGS_ALL }}
${{ env.CFLAGS_CLANG_LIBCPERCIVA }}
${{ env.CFLAGS_CLANG_PROJECT }}
# make(1) doesn't automatically override the CFLAGS macro set inside
# Makefile with the environment variable.
run: make CFLAGS="${{ env.CFLAGS }}"
- name: Test clang binaries
env:
USE_VALGRIND: 1
run: make test VERBOSE=1
- name: Clean
run: make clean
- name: configure with gcc
env:
CC: gcc-10
CFLAGS: ${{ env.CFLAGS_ALL }}
run: ./configure
- name: Compile libarchive with gcc
env:
CC: gcc-10
# We need to use more permissive CFLAGS for libarchive code.
CFLAGS: ${{ env.CFLAGS_ALL }}
${{ env.CFLAGS_LIBARCHIVE_GCC }}
run: make ${{ env.LIBARCHIVE_OBJECTS }}
- name: Compile with gcc
env:
CC: gcc-10
CFLAGS: ${{ env.CFLAGS_ALL }}
${{ env.CFLAGS_GCC_LIBCPERCIVA }}
${{ env.CFLAGS_GCC_PROJECT }}
# make(1) doesn't automatically override the CFLAGS macro set inside
# Makefile with the environment variable.
run: make CFLAGS="${{ env.CFLAGS }}"
- name: Test gcc binaries
env:
USE_VALGRIND: 1
run: make test VERBOSE=1
- name: Check for untracked files
run: test -z "$(git status --porcelain=v1)"
macOS:
name: macOS
runs-on: macOS-13
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install software
run: brew install automake
- name: autoreconf
run: autoreconf -i
- name: configure with clang
env:
CC: clang
CFLAGS: ${{ env.CFLAGS_ALL }}
${{ env.CFLAGS_OSX }}
LDFLAGS: ${{ env.LDFLAGS_OSX }}
run: ./configure
- name: Compile libarchive with clang
env:
CC: clang
# We need to use more permissive CFLAGS for libarchive code.
CFLAGS: ${{ env.CFLAGS_ALL }}
run: make ${{ env.LIBARCHIVE_OBJECTS }}
- name: Compile with clang
env:
CC: clang
CFLAGS: ${{ env.CFLAGS_ALL }}
${{ env.CFLAGS_CLANG_LIBCPERCIVA }}
${{ env.CFLAGS_CLANG_PROJECT }}
${{ env.CFLAGS_OSX }}
LDFLAGS: ${{ env.LDFLAGS_OSX }}
# make(1) doesn't automatically override the CFLAGS macro set inside
# Makefile with the environment variable.
run: make CFLAGS="${{ env.CFLAGS }}"
- name: Tests clang binaries
run: make test VERBOSE=1
|