diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ea1af18f..36a7ff84 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,4 +25,4 @@ jobs: ${{ runner.os }}- - name: Build and run tests - run: "cd haskell; stack build adl-compiler; stack test --fast --no-terminal adl-compiler" + run: "cd haskell; stack build --fast adl-compiler; stack test --fast --no-terminal adl-compiler" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..34e05478 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,87 @@ +name: New release +on: + # Fix to be on special tag + pull_request: + +jobs: + build: + name: Build + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-18.04, macos-latest] + steps: + - name: Setup Stack + uses: mstksg/setup-stack@v1 + + - name: Clone project + uses: actions/checkout@v2 + # Fetch all history so git describe works + - run: | + git fetch --prune --unshallow + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.stack + key: ${{ runner.os }}-${{ hashFiles('haskell/stack.yaml') }} + restore-keys: | + ${{ runner.os }}- + + - name: Build compiler and generate zip + run: "cd haskell; stack build adl-compiler; ./tools/make-dist.hs" + + - name: Upload dist directory artifacts + uses: actions/upload-artifact@v1 + with: + name: dist-${{ runner.os }} + path: dist + + release: + name: Create Github Release + needs: [build] + runs-on: ubuntu-latest + steps: + + - name: Create Release + id: create_release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Fetch macOS build + uses: actions/download-artifact@v1 + with: + name: dist-macOS + path: dist-macOS + + - name: Fetch linux build + uses: actions/download-artifact@v1 + with: + name: dist-linux + path: dist-linux + + - name: Upload macOS build + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist-macOS/adl-bindist.zip + asset_name: adl-bindist-${{ github.ref }}-osx.zip + asset_content_type: application/zip + + - name: Upload linux build + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist-linux/adl-bindist.zip + asset_name: adl-bindist-${{ github.ref }}-linux.zip + asset_content_type: application/zip diff --git a/haskell/tools/make-dist.hs b/haskell/tools/make-dist.hs index 98408850..3e4e57a0 100755 --- a/haskell/tools/make-dist.hs +++ b/haskell/tools/make-dist.hs @@ -38,10 +38,8 @@ specialFile _ = False main = do repoRoot <- takeDirectory <$> stackCmd "path --project-root" localInstallRoot <- stackCmd "path --local-install-root" - version <- trim <$> readCreateProcess (shell ("git describe")) "" - platform <- (map toLower . trim) <$> readCreateProcess (shell ("uname")) "" - let zipFile = repoRoot "dist" "adl-" <> version <> "-" <> platform <> ".zip" + let zipFile = repoRoot "dist" "adl-bindist" <> ".zip" withSystemTempDirectory "distXXXX" $ \zipDir -> do copyFiles (localInstallRoot "bin") (zipDir "bin") (=="adlc")