From 58b2950a5f464f5ba414a898ba10d35f69074ae0 Mon Sep 17 00:00:00 2001 From: Ivo Branco Date: Tue, 17 Oct 2023 16:15:02 +0100 Subject: [PATCH] build: add continuous integration github action With lint and test --- .github/workflows/ci.yml | 109 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 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..74ff708 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,109 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + - main + +jobs: + prepare: + name: Run tests and linting + runs-on: ubuntu-latest + + steps: + - name: Checkout PayGate + uses: actions/checkout@v4 + with: + # Relative path to place the repository + path: ecommerce-plugin-paygate + + - name: Checkout ecommerce + uses: actions/checkout@v4 + with: + # Repository name with owner + repository: fccn/ecommerce + # Change the branch to checkout + ref: nau/nutmeg.master + # Relative path to place the repository + path: ecommerce + + - name: Use Python + uses: actions/setup-python@v4 + with: + python-version: '3.8' + cache: 'pip' # caching pip dependencies + + - name: Install ecommerce pip requirements + run: pip install -r ecommerce/requirements/dev.txt + + lint: + name: Lint code + runs-on: ubuntu-latest + needs: + - prepare + + steps: + - name: Checkout PayGate + uses: actions/checkout@v4 + with: + # Relative path to place the repository + path: ecommerce-plugin-paygate + + - name: Checkout ecommerce + uses: actions/checkout@v4 + with: + # Repository name with owner + repository: fccn/ecommerce + # Change the branch to checkout + ref: nau/nutmeg.master + # Relative path to place the repository + path: ecommerce + + - name: Use Python + uses: actions/setup-python@v4 + with: + python-version: '3.8' + cache: 'pip' # caching pip dependencies + + - name: Install ecommerce pip requirements + run: pip install -r ecommerce/requirements/dev.txt + + - name: Run lint + run: make -C ecommerce-plugin-paygate lint + + test: + name: Unit tests + runs-on: ubuntu-latest + needs: + - prepare + + steps: + - name: Checkout PayGate + uses: actions/checkout@v4 + with: + # Relative path to place the repository + path: ecommerce-plugin-paygate + + - name: Checkout ecommerce + uses: actions/checkout@v4 + with: + # Repository name with owner + repository: fccn/ecommerce + # Change the branch to checkout + ref: nau/nutmeg.master + # Relative path to place the repository + path: ecommerce + + - name: Use Python + uses: actions/setup-python@v4 + with: + python-version: '3.8' + cache: 'pip' # caching pip dependencies + + - name: Install ecommerce pip requirements + run: pip install -r ecommerce/requirements/dev.txt + + - name: Run unit tests + run: make -C ecommerce-plugin-paygate test