chore(deps): bump codecov/codecov-action from 5.1.2 to 5.2.0 (#1296) #3339
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, workflow_dispatch] | |
jobs: | |
ci: | |
name: CI | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
# —————————————————————————————————————————————— # | |
# Docker # | |
# —————————————————————————————————————————————— # | |
# Docker Compose is used by "./run --dc-ci dc:*" | |
- name: Add environment variables used by Docker Compose | |
run: | | |
echo "USER_UID=$(id -u)" >> $GITHUB_ENV | |
echo "USER_GID=$(id -g)" >> $GITHUB_ENV | |
- name: Add output parameters used by Docker build | |
id: docker-params | |
run: | | |
image_target="ci" | |
image_repository="aifrak/template-elixir" | |
echo "IMAGE_TARGET=$image_target" >> $GITHUB_OUTPUT | |
echo "IMAGE_TAG=$image_repository:$image_target" >> $GITHUB_OUTPUT | |
echo "CACHE_OLD=/tmp/.buildx-cache" >> $GITHUB_OUTPUT | |
echo "CACHE_NEW=/tmp/.buildx-cache-new" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Cache Docker layers | |
uses: actions/[email protected] | |
with: | |
path: ${{ steps.docker-params.outputs.CACHE_OLD }} | |
key: | | |
${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build Docker image and Docker cache | |
uses: docker/[email protected] | |
with: | |
load: true | |
target: ${{ steps.docker-params.outputs.IMAGE_TARGET }} | |
tags: ${{ steps.docker-params.outputs.IMAGE_TAG }} | |
build-args: | | |
USER_UID=${{ env.USER_UID }} | |
USER_GID=${{ env.USER_GID }} | |
cache-from: type=local,src=${{ steps.docker-params.outputs.CACHE_OLD }} | |
cache-to: type=local,dest=${{ steps.docker-params.outputs.CACHE_NEW }} | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move Docker cache | |
run: | | |
rm -rf ${{ steps.docker-params.outputs.CACHE_OLD }} | |
mv ${{ steps.docker-params.outputs.CACHE_NEW }} ${{ steps.docker-params.outputs.CACHE_OLD }} | |
- name: Starts all docker services | |
run: | | |
./run --dc-ci dc:up | |
# —————————————————————————————————————————————— # | |
# Versions # | |
# —————————————————————————————————————————————— # | |
- name: Get versions | |
id: versions | |
run: | | |
echo "NODE=$(./run --dc-ci dc:exec npm -v)" >> $GITHUB_OUTPUT | |
echo "ELIXIR=$(./run --dc-ci dc:exec ./run version:elixir)" >> $GITHUB_OUTPUT | |
echo "ERLANG=$(./run --dc-ci dc:exec ./run version:erlang)" >> $GITHUB_OUTPUT | |
# —————————————————————————————————————————————— # | |
# Cache # | |
# —————————————————————————————————————————————— # | |
- name: Cache Elixir deps | |
id: elixir-deps-cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
**/deps | |
key: | | |
${{ runner.os }}-elixir-deps-${{ steps.versions.outputs.ELIXIR }}-${{ steps.versions.outputs.ERLANG }}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-elixir-deps-${{ steps.versions.outputs.ELIXIR }}-${{ steps.versions.outputs.ERLANG }}- | |
- name: Cache Elixir build | |
id: elixir-build-cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
**/_build | |
**/.sobelow | |
key: | | |
${{ runner.os }}-elixir-build-${{ steps.versions.outputs.ELIXIR }}-${{ steps.versions.outputs.ERLANG }}-${{ hashFiles('**/mix.lock') }}-${{ hashFiles( '**/lib/**/*.{ex,eex,leex}', '**/config/*.exs', '**/mix.exs' ) }} | |
restore-keys: | | |
${{ runner.os }}-elixir-build-${{ steps.versions.outputs.ELIXIR }}-${{ steps.versions.outputs.ERLANG }}-${{ hashFiles('**/mix.lock') }}- | |
${{ runner.os }}-elixir-build-${{ steps.versions.outputs.ELIXIR }}-${{ steps.versions.outputs.ERLANG }}- | |
- name: Cache Dialyzer PLTs | |
id: dialyzer-plts-cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
**/dialyzer/plts | |
key: | | |
${{ runner.os }}-dialyzer-plts-${{ steps.versions.outputs.ELIXIR }}-${{ steps.versions.outputs.ERLANG }} | |
restore-keys: | | |
${{ runner.os }}-dialyzer-plts-${{ steps.versions.outputs.ELIXIR }}-${{ steps.versions.outputs.ERLANG }} | |
- name: Cache node modules | |
uses: actions/[email protected] | |
id: node-modules-cache | |
with: | |
path: | | |
**/node_modules | |
**/npm_cache | |
**/.cspellcache | |
**/.eslintcache | |
**/.prettier-cache | |
**/.stylelintcache | |
key: | | |
${{ runner.os }}-node-${{ steps.versions.outputs.NODE }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ steps.versions.outputs.NODE }}- | |
# —————————————————————————————————————————————— # | |
# Dependencies # | |
# —————————————————————————————————————————————— # | |
- name: Fetch and compile Elixir dependencies | |
if: steps.elixir-deps-cache.outputs.cache-hit != 'true' | |
run: | | |
./run --dc-ci dc:exec mix setup.deps.ci | |
- name: Install node modules | |
if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
run: | | |
./run --dc-ci dc:exec mix npm.ci | |
# —————————————————————————————————————————————— # | |
# Application # | |
# —————————————————————————————————————————————— # | |
- name: Install npm prepare scripts | |
run: | | |
npm run prepare | |
- name: Set check flag for lint:git:commit | |
id: lint-git-commit | |
run: | | |
is_contributor_dependabot=false | |
run_lint_git_commit=false | |
if ./run is-contributor-dependabot:git:commit; then is_contributor_dependabot=true; fi | |
if [[ github.actor != "dependabot[bot]" && $is_contributor_dependabot = false ]]; then | |
run_lint_git_commit=true; | |
fi | |
echo "FLAG=$run_lint_git_commit" >> $GITHUB_OUTPUT | |
- name: Compile Elixir application and run all checks | |
run: | | |
except_opts= | |
if [[ ${{ steps.lint-git-commit.outputs.FLAG }} = false ]]; then | |
except_opts="--except lint_git_commit" | |
fi | |
./run --dc-ci dc:exec mix check.ci $except_opts | |
- name: Upload Code Coverage report | |
if: >- | |
github.actor != 'dependabot[bot]' | |
&& github.event_name == 'push' | |
&& steps.lint-git-commit.outputs.FLAG == 'false' | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./cover/excoveralls.json | |
fail_ci_if_error: true |