Skip to content

Commit

Permalink
Merge pull request #74 from exercism/jie-analyze-all-exercises
Browse files Browse the repository at this point in the history
Run analyzer on the elm repo in the CI
  • Loading branch information
jiegillet authored Nov 17, 2023
2 parents a683f05 + 6e28f46 commit 648f38b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
50 changes: 49 additions & 1 deletion .github/workflows/elm_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Elm Test

on: [push, pull_request]
on:
pull_request:
push:
branches: [main]

jobs:
build:
Expand Down Expand Up @@ -125,5 +128,50 @@ jobs:
- name: Checkout code
uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
with:
install: true

- name: Build Docker image and store in cache
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
context: .
push: false
load: true
tags: elm-analyzer
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Run Smoke Tests in Docker
run: bin/run-tests-in-docker.sh

analyze-elm-repo-solutions:
runs-on: ubuntu-22.04
steps:
- name: Checkout elm-analyzer
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c

- name: Checkout elm repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with:
repository: exercism/elm
path: elm_repo

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
with:
install: true

- name: Build Docker image and store in cache
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
context: .
push: false
load: true
tags: elm-analyzer
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Run analyzer on all exercises
run: bin/analyze-all-exercises-in-docker.sh elm_repo
24 changes: 24 additions & 0 deletions bin/analyze-all-exercises-in-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -e # Make script exit when a command fail.
set -u # Exit on usage of undeclared variable.
# set -x # Trace what gets executed.
set -o pipefail # Catch failures in pipes.

# Command line argument
elm_repo_dir=$(realpath $1)

# build docker image
docker build --rm -t elm-analyzer .

# run image passing the arguments
docker run \
--rm \
--read-only \
--network none \
--mount type=bind,src="$elm_repo_dir",dst=/opt/analyzer/elm_repo \
--mount type=tmpfs,dst=/tmp \
--volume "${elm_repo_dir}/bin/analyze_all_exercises.sh:/opt/analyzer/bin/analyze_all_exercises.sh" \
--entrypoint /opt/analyzer/bin/analyze_all_exercises.sh \
elm-analyzer \
/opt/analyzer/elm_repo

0 comments on commit 648f38b

Please sign in to comment.