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 ENABLE_COVER_COMPILE: 1
run: | run: |
make ensure-rebar3 make ensure-rebar3
make ${PROFILE} make ${PROFILE}-compile test-compile
make test-compile echo "PROFILE=${PROFILE}" | tee -a .env
zip -ryq $PROFILE.zip . echo "PKG_VSN=$(./pkg-vsn.sh ${PROFILE})" | tee -a .env
zip -ryq -x@.github/workflows/.zipignore $PROFILE.zip .
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: ${{ matrix.profile }} name: ${{ matrix.profile }}

View File

@ -149,7 +149,9 @@ jobs:
ENABLE_COVER_COMPILE: 1 ENABLE_COVER_COMPILE: 1
run: | run: |
make $PROFILE 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 - uses: actions/upload-artifact@v3
with: with:
name: ${{ matrix.profile }} name: ${{ matrix.profile }}

View File

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

View File

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

View File

@ -244,19 +244,28 @@ get_param_types(Signatures, {M, F, A}) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dump() -> dump() ->
case RootDir = project_root_dir(),
{ TryRelDir = RootDir ++ "/_build/check/lib",
filelib:wildcard(project_root_dir() ++ "/*_plt"), case {filelib:wildcard(RootDir ++ "/*_plt"), filelib:wildcard(TryRelDir)} of
filelib:wildcard(project_root_dir() ++ "/_build/check/lib")
}
of
{[PLT | _], [RelDir | _]} -> {[PLT | _], [RelDir | _]} ->
dump(#{ dump(#{
plt => PLT, plt => PLT,
reldir => RelDir 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. end.
%% Collect the local BPAPI modules to a dump file %% Collect the local BPAPI modules to a dump file
@ -411,10 +420,19 @@ setnok() ->
put(bpapi_ok, false). put(bpapi_ok, false).
dumps_dir() -> dumps_dir() ->
filename:join(project_root_dir(), "apps/emqx/test/emqx_static_checks_data"). filename:join(emqx_app_dir(), "test/emqx_static_checks_data").
project_root_dir() ->
string:trim(os:cmd("git rev-parse --show-toplevel")).
versions_file() -> 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(RED, "\e[31m").
-define(RESET, "\e[39m"). -define(RESET, "\e[39m").
main([Files0]) -> main(Files) ->
io:format(user, "checking i18n file styles~n", []), io:format(user, "checking i18n file styles~n", []),
_ = put(errors, 0), _ = put(errors, 0),
Files = string:tokens(Files0, "\n"),
ok = load_hocon(), ok = load_hocon(),
ok = lists:foreach(fun check/1, Files), ok = lists:foreach(fun check/1, Files),
case get(errors) of case get(errors) of

View File

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

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
PROJ_DIR="$(git rev-parse --show-toplevel)"
cd -P -- "$(dirname -- "$0")/../.."
PROFILE="${PROFILE:-emqx}" PROFILE="${PROFILE:-emqx}"
DIR_NAME='examples' DIR_NAME='examples'
@ -11,7 +12,7 @@ if [ "${PROFILE}" = 'emqx-enterprise' ]; then
SCHEMA_MOD='emqx_enterprise_schema' SCHEMA_MOD='emqx_enterprise_schema'
fi 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() { prepare_erl_libs() {
local libs_dir="$1" local libs_dir="$1"
@ -30,7 +31,7 @@ prepare_erl_libs() {
} }
# This is needed when checking schema # 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" prepare_erl_libs "_build/$PROFILE/lib"