From 6a78ac09f184ec38a1542a4495e4152684779b0e Mon Sep 17 00:00:00 2001 From: benoit-cty <6603048+benoit-cty@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:41:33 +0200 Subject: [PATCH] Add github workflow --- .github/workflows/workflow.yml | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/workflow.yml diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 00000000..1a0c9bbd --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,63 @@ +name: OpenFisca France Indirect Taxation + +on: + push: + pull_request: + types: [opened, reopened] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: ["ubuntu-20.04"] + python-version: ["3.10.6"] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Cache build + id: restore-build + uses: actions/cache@v3 + with: + path: ${{ env.pythonLocation }} + key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-${{ matrix.os }} + restore-keys: | # in case of a cache miss (systematically unless the same commit is built repeatedly), the keys below will be used to restore dependencies from previous builds, and the cache will be stored at the end of the job, making up-to-date dependencies available for all jobs of the workflow; see more at https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action + build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ matrix.os }} + build-${{ env.pythonLocation }}-${{ matrix.os }} + - name: Build package + run: make build + - name: Cache release + id: restore-release + uses: actions/cache@v3 + with: + path: dist + key: release-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-${{ matrix.os }} + + lint-files: + runs-on: ubuntu-20.04 + needs: [ build ] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch all the tags + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.10.6 + - name: Cache build + id: restore-build + uses: actions/cache@v3 + with: + path: ${{ env.pythonLocation }} + key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-ubuntu-20.04 + - run: make check-syntax-errors + - run: make check-style + - name: Lint Python files + run: "${GITHUB_WORKSPACE}/.github/lint-changed-python-files.sh" + - name: Lint YAML tests + run: "${GITHUB_WORKSPACE}/.github/lint-changed-yaml-tests.sh"