From 7b84ada409651ad5ba24ccae14d776388cb84e34 Mon Sep 17 00:00:00 2001 From: Andrei Dziahel Date: Sun, 19 Oct 2025 17:32:43 +0200 Subject: [PATCH] feat: build generator in CI and store it in artifacts storage --- .github/workflows/generator.yml | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/generator.yml diff --git a/.github/workflows/generator.yml b/.github/workflows/generator.yml new file mode 100644 index 00000000..e304dde8 --- /dev/null +++ b/.github/workflows/generator.yml @@ -0,0 +1,47 @@ +name: Dockerfile Generator +on: + push: + paths: + - generator + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v5.0.0 + - name: Cache .stack directory + uses: actions/cache@v4.3.0 + with: + path: ~/.stack + key: ${{ runner.os }}-stack-${{ hashFiles('generator/stack.yaml.lock') }} + + - name: Cache build artifacts + uses: actions/cache@v4.3.0 + with: + path: generator/.stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('generator/stack.yaml.lock', 'generator/generator.cabal') }} + - name: Install Haskell toolchain and stack + uses: haskell-actions/setup@v2.8.2 + with: + enable-stack: true + + - name: Set up Stack project + working-directory: generator + run: stack setup + - name: Build generator + working-directory: generator + run: stack build --no-terminal + - name: Run generator + working-directory: generator + run: stack exec generator -- --help + + - name: Copy generator binary to artifacts + working-directory: generator + run: | + mkdir -p ../artifacts + stack --local-bin-path=../artifacts install + - name: Upload generator artifact + uses: actions/upload-artifact@v4.6.2 + with: + name: dockerfile-generator + path: artifacts/generator