Skip to content

Commit

Permalink
Lets try by adding a few env_keep values (#2644)
Browse files Browse the repository at this point in the history
This ensures that test steps that use `sudo` will inherit the environment variables that are set.
  • Loading branch information
stuartc authored Nov 22, 2024
1 parent 23307f9 commit a5439b2
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
environment:
ERL_FLAGS: +S 4:4
ASSERT_RECEIVE_TIMEOUT: 1000
MIX_ENV: test
working_directory: /home/lightning/project

steps:
Expand All @@ -74,12 +75,15 @@ jobs:
name: "Install libsodium and sudo"
command: |
apt-get update && apt-get install -y libsodium-dev sudo
- run: |
echo 'Defaults env_keep += "ERL_FLAGS ASSERT_RECEIVE_TIMEOUT MIX_ENV"' | \
sudo EDITOR='tee -a' visudo
- run: chown -R lightning /home/lightning
- run: sudo -u lightning mix local.hex --force && mix local.rebar --force
- run: cd assets; sudo -u lightning npm install
- run: sudo -u lightning env MIX_ENV=test mix do deps.get --only test, deps.compile, compile
- run: sudo -u lightning env MIX_ENV=test mix lightning.install_runtime
- run: sudo -u lightning mix do deps.get --only test, deps.compile, compile
- run: sudo -u lightning mix lightning.install_runtime

- save_cache:
key: v3-deps-{{ arch }}-{{ checksum ".elixir_otp_version" }}-{{ checksum "mix.lock" }}
Expand Down Expand Up @@ -108,25 +112,25 @@ workflows:
- build:
name: "Check code formatting"
execute:
- run: sudo -u lightning env MIX_ENV=test mix format --check-formatted
- run: sudo -u lightning mix format --check-formatted
- build:
name: "Check code style"
execute:
- run: sudo -u lightning env MIX_ENV=test mix credo --strict --all
- run: sudo -u lightning mix credo --strict --all
- build:
name: "Type check"
execute:
- run: sudo -u lightning env MIX_ENV=test mix dialyzer
- run: sudo -u lightning mix dialyzer
- build:
name: "Check for security vulnerabilities"
execute:
- run: sudo -u lightning env MIX_ENV=test mix sobelow
- run: sudo -u lightning mix sobelow
- build:
name: "Check Elixir tests (codecov)"
execute:
- run: sudo -u lightning env MIX_ENV=test mix do ecto.create, ecto.migrate
- run: sudo -u lightning mix do ecto.create, ecto.migrate
- run:
command: sudo -u lightning env MIX_ENV=test mix coveralls.json -o ./test/reports
command: sudo -u lightning mix coveralls.json -o ./test/reports
- codecov/upload:
file: test/reports/excoveralls.json
- store_test_results:
Expand Down

0 comments on commit a5439b2

Please sign in to comment.