From e28c7d910cc08556cdfc791ed6dc1fc4fb2d8410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20W=C3=BCthrich?= Date: Wed, 21 Aug 2024 15:27:22 +0200 Subject: [PATCH] chore: add github workflow --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ab5e772 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI/CD + +on: + push: + + pull_request: + branches: + - main + +env: + MIX_ENV: test + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + version-file: .tool-versions + version-type: strict + + # - name: Set up Node.js + # uses: actions/setup-node@v4 + # with: + # node-version-file: .tool-versions + # cache: npm + # cache-dependency-path: assets/package-lock.json + + - name: Restore cache + id: cache + uses: actions/cache/restore@v4 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashFiles('.tool-versions') }}-${{ hashFiles('mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix-${{ hashFiles('.tool-versions') }}- + ${{ runner.os }}-mix- + + - run: mix setup + + - name: Save cache + uses: actions/cache/save@v4 + if: steps.cache.outputs.cache-hit != 'true' + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashFiles('.tool-versions') }}-${{ hashFiles('mix.lock') }} + + - run: mix lint + - run: mix test