name: Harness on: push: branches: [master] pull_request: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: run-make-all: # The type of runner that the job will run on runs-on: self-hosted env: IMAGE_TAG: ${{ github.head_ref || github.ref_name }} # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - name: Prepare container with all dependencies run: git archive HEAD | docker build - --target dev-build-context - name: Escape slashes in IMAGE_TAG (to avoid Docker issues) run: echo "IMAGE_TAG=${IMAGE_TAG////--}" >> $GITHUB_ENV - name: Run builds, checks and tests run: git archive HEAD | docker build - --force-rm -t "catalalang/catala-build:${IMAGE_TAG}" - name: Cleanup Docker image if: ${{ github.ref != 'refs/heads/master' }} run: docker image rm catalalang/catala-build:${IMAGE_TAG} - name: Build architecture-independent artifacts if: ${{ github.ref == 'refs/heads/master' }} run: | RELEASE_TAG=$(git describe --tags) docker run --rm catalalang/catala-build:${IMAGE_TAG} sh -uexc ' opam --cli=2.1 remove z3 >&2 opam --cli=2.1 exec -- dune build --profile=release french_law compiler/catala.bc.js >&2 opam --cli=2.1 exec -- dune build --profile=release @doc >&2 opam --cli=2.1 exec -- make -C doc/syntax >&2 opam --cli=2.1 exec -- make literate_tutorial_en literate_tutoriel_fr >&2 opam --cli=2.1 exec -- dune build --profile=release grammar.html catala.html clerk.html catala_legifrance.html >&2 mkdir -p artifacts >&2 mv _build/default/compiler/catala.bc.js artifacts/catala_'"${RELEASE_TAG}"'_node.js >&2 mv _build/default/_doc/_html artifacts/api-doc >&2 mv doc/syntax/syntax.pdf artifacts/ >&2 mv examples/tuto*/*.html _build/default/*.html artifacts/ >&2 tar czf artifacts/french_law_'"${RELEASE_TAG}"'_ocaml.tar.gz french_law/ocaml >&2 tar czf artifacts/french_law_'"${RELEASE_TAG}"'_js.tar.gz french_law/js --exclude french_law/js/node_modules >&2 tar czf artifacts/french_law_'"${RELEASE_TAG}"'_python.tar.gz french_law/python >&2 ln -s french_law_'"${RELEASE_TAG}"'_ocaml.tar.gz artifacts/french_law_ocaml.tar.gz >&2 ln -s french_law_'"${RELEASE_TAG}"'_js.tar.gz artifacts/french_law_js.tar.gz >&2 ln -s french_law_'"${RELEASE_TAG}"'_python.tar.gz artifacts/french_law_python.tar.gz >&2 tar c artifacts/* ' | tar vx - name: Build static binaries if: ${{ github.ref == 'refs/heads/master' }} run: ./build_release.sh -C artifacts - name: Publish artifacts if: ${{ github.ref == 'refs/heads/master' }} uses: actions/upload-artifact@v3 with: name: Catala artifacts path: artifacts/*