Skip to content

Commit

Permalink
Extract test conditions to env for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
thbar committed Oct 14, 2021
1 parent a43432f commit 1e6efb8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
TEST_TAG: ${{ github.repository }}:test
TEST_EXPECTED_NODE_OUTPUT: "v14.16.1"
TEST_EXPECTED_ELIXIR_OUTPUT: "Elixir 1.12.2 (compiled with Erlang/OTP 24)"
TEST_EXPECTED_ERLANG_OUTPUT: "Erlang/OTP 24"
jobs:
build-and-push-image:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,13 +60,13 @@ jobs:

# NOTE: the following tests rely on grep exit code (0 if match found)
- name: Test that Node can start and has expected version
run: docker run --rm ${{ env.TEST_TAG }} /bin/bash -c 'node --version' | grep 'v14.16.1'
run: docker run --rm ${{ env.TEST_TAG }} /bin/bash -c 'node --version' | grep '${{ env.TEST_EXPECTED_NODE_OUTPUT }}'

- name: Test that Elixir can start and has expected version
run: docker run --rm ${{ env.TEST_TAG }} /bin/bash -c 'elixir --version' | grep 'Elixir 1.12.2 (compiled with Erlang/OTP 24)'
run: docker run --rm ${{ env.TEST_TAG }} /bin/bash -c 'elixir --version' | grep '$${ env.TEST_EXPECTED_ELIXIR_OUTPUT }}'

- name: Test that Erlang can start and has (major) expected version
run: docker run --rm ${{ env.TEST_TAG }} /bin/bash -c "erl -noshell -eval 'erlang:display(erlang:system_info(system_version))' -eval 'init:stop()'" | grep 'Erlang/OTP 24'
run: docker run --rm ${{ env.TEST_TAG }} /bin/bash -c "erl -noshell -eval 'erlang:display(erlang:system_info(system_version))' -eval 'init:stop()'" | grep '$${ env.TEST_EXPECTED_ERLANG_OUTPUT }}'

# TODO: handle testing then publication using:
# - https://github.com/etalab/transport-ops/issues/30
Expand Down

0 comments on commit 1e6efb8

Please sign in to comment.