Merge pull request #11753 from keynslug/chore/smaller-ci-artifacts

chore(ci): try to reduce CI artifacts footprint
This commit is contained in:
Andrew Mayorov 2023-10-13 16:56:47 +07:00 committed by GitHub
commit 0144ed9981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 29 deletions

3
.github/workflows/.zipignore vendored Normal file
View File

@ -0,0 +1,3 @@
.git/*
*/.git/*
*/.github/*

View File

@ -138,9 +138,10 @@ jobs:
ENABLE_COVER_COMPILE: 1
run: |
make ensure-rebar3
make ${PROFILE}
make test-compile
zip -ryq $PROFILE.zip .
make ${PROFILE}-compile test-compile
echo "PROFILE=${PROFILE}" | tee -a .env
echo "PKG_VSN=$(./pkg-vsn.sh ${PROFILE})" | tee -a .env
zip -ryq -x@.github/workflows/.zipignore $PROFILE.zip .
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.profile }}

View File

@ -149,7 +149,9 @@ jobs:
ENABLE_COVER_COMPILE: 1
run: |
make $PROFILE
zip -ryq $PROFILE.zip .
echo "PROFILE=${PROFILE}" | tee -a .env
echo "PKG_VSN=$(./pkg-vsn.sh ${PROFILE})" | tee -a .env
zip -ryq -x@.github/workflows/.zipignore $PROFILE.zip .
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.profile }}

View File

@ -21,8 +21,6 @@ jobs:
run_conf_tests:
runs-on: ${{ fromJSON(inputs.runner_labels) }}
container: ${{ inputs.builder }}
env:
PROFILE: ${{ matrix.profile }}
strategy:
fail-fast: false
matrix:
@ -37,6 +35,8 @@ jobs:
run: |
unzip -o -q ${{ matrix.profile }}.zip
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- run: cat .env | tee -a $GITHUB_ENV
- run: make ${{ matrix.profile }}
- run: ./scripts/test/check-example-configs.sh
- run: ./scripts/conf-test/run.sh
- name: print erlang log

View File

@ -46,7 +46,6 @@ jobs:
key: rebar3-dialyzer-plt-${{ matrix.profile }}-${{ matrix.otp }}-${{ hashFiles('rebar.*', 'apps/*/rebar.*') }}
restore-keys: |
rebar3-dialyzer-plt-${{ matrix.profile }}-${{ matrix.otp }}-
- run: cat .env | tee -a $GITHUB_ENV
- name: run static checks
env:
PROFILE: ${{ matrix.profile }}
run: make static_checks

View File

@ -244,19 +244,28 @@ get_param_types(Signatures, {M, F, A}) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dump() ->
case
{
filelib:wildcard(project_root_dir() ++ "/*_plt"),
filelib:wildcard(project_root_dir() ++ "/_build/check/lib")
}
of
RootDir = project_root_dir(),
TryRelDir = RootDir ++ "/_build/check/lib",
case {filelib:wildcard(RootDir ++ "/*_plt"), filelib:wildcard(TryRelDir)} of
{[PLT | _], [RelDir | _]} ->
dump(#{
plt => PLT,
reldir => RelDir
});
_ ->
error("failed to guess run options")
{[], _} ->
logger:error(
"No usable PLT files found in \"~s\", abort ~n"
"Try running `rebar3 as check dialyzer` at least once first",
[RootDir]
),
error(run_failed);
{_, []} ->
logger:error(
"No built applications found in \"~s\", abort ~n"
"Try running `rebar3 as check compile` at least once first",
[TryRelDir]
),
error(run_failed)
end.
%% Collect the local BPAPI modules to a dump file
@ -411,10 +420,19 @@ setnok() ->
put(bpapi_ok, false).
dumps_dir() ->
filename:join(project_root_dir(), "apps/emqx/test/emqx_static_checks_data").
project_root_dir() ->
string:trim(os:cmd("git rev-parse --show-toplevel")).
filename:join(emqx_app_dir(), "test/emqx_static_checks_data").
versions_file() ->
filename:join(project_root_dir(), "apps/emqx/priv/bpapi.versions").
filename:join(emqx_app_dir(), "priv/bpapi.versions").
emqx_app_dir() ->
Info = ?MODULE:module_info(compile),
case proplists:get_value(source, Info) of
Source when is_list(Source) ->
filename:dirname(filename:dirname(Source));
undefined ->
"apps/emqx"
end.
project_root_dir() ->
filename:dirname(filename:dirname(emqx_app_dir())).

View File

@ -8,10 +8,9 @@
-define(RED, "\e[31m").
-define(RESET, "\e[39m").
main([Files0]) ->
main(Files) ->
io:format(user, "checking i18n file styles~n", []),
_ = put(errors, 0),
Files = string:tokens(Files0, "\n"),
ok = load_hocon(),
ok = lists:foreach(fun check/1, Files),
case get(errors) of

View File

@ -3,6 +3,4 @@ set -euo pipefail
cd -P -- "$(dirname -- "$0")/.."
all_files="$(git ls-files 'rel/i18n/*.hocon')"
./scripts/check-i18n-style.escript "$all_files"
./scripts/check-i18n-style.escript rel/i18n/*.hocon

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
PROJ_DIR="$(git rev-parse --show-toplevel)"
cd -P -- "$(dirname -- "$0")/../.."
PROFILE="${PROFILE:-emqx}"
DIR_NAME='examples'
@ -11,7 +12,7 @@ if [ "${PROFILE}" = 'emqx-enterprise' ]; then
SCHEMA_MOD='emqx_enterprise_schema'
fi
IFS=$'\n' read -r -d '' -a FILES < <(find "${PROJ_DIR}/rel/config/${DIR_NAME}" -name "*.example" 2>/dev/null | sort && printf '\0')
IFS=$'\n' read -r -d '' -a FILES < <(find "rel/config/${DIR_NAME}" -name "*.example" 2>/dev/null | sort && printf '\0')
prepare_erl_libs() {
local libs_dir="$1"
@ -30,7 +31,7 @@ prepare_erl_libs() {
}
# This is needed when checking schema
export EMQX_ETC_DIR="${PROJ_DIR}/apps/emqx/etc"
export EMQX_ETC_DIR="apps/emqx/etc"
prepare_erl_libs "_build/$PROFILE/lib"