From 3e6bf5fe8b9cd506f98502981b2560bcd1b7be1a Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Wed, 4 Nov 2020 10:22:12 +0100 Subject: [PATCH] Build on Github * ensure to fetch tag information (see issue [#290]) [#290]: https://github.com/actions/checkout/issues/290 --- .github/workflows/test.yml | 5 ++++- nix/default.nix | 7 +++++-- scripts/travis-install | 7 ++++++- shell.nix | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8f509d7..b1c0c38e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.3.4 + with: + submodules: true - uses: cachix/install-nix-action@v12 with: skip_adding_nixpkgs_channel: true @@ -16,5 +18,6 @@ jobs: signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' # Only needed for private caches #authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - run: git fetch --tags --force --recurse-submodules - run: nix-build - # TODO - run: nix-shell --run "sbt test" + - run: nix-shell --run "scripts/travis-install && sbt -batch -Dfile.encoding=UTF8 scalalsNative/run" diff --git a/nix/default.nix b/nix/default.nix index 3343f761..e81f0bb1 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -36,8 +36,11 @@ in nixpkgs-fmt.enable = true; nix-linter.enable = true; }; - # generated files - excludes = [ "^nix/sources\.nix$" ]; + # generated files / submodules + excludes = [ + "^nix/sources\.nix$" + "^modules/" + ]; }; }; } diff --git a/scripts/travis-install b/scripts/travis-install index 623fde2c..8244be43 100755 --- a/scripts/travis-install +++ b/scripts/travis-install @@ -9,8 +9,13 @@ if [ -e "$SCALA_NATIVE_BUILD" ]; then else rm -rf "$HOME/.ivy2/local" + printf '\n*** Compiling scala-native ***\n\n' (cd modules/scala-native && sbt -batch -Dfile.encoding=UTF8 -sbt-version "$SBT_VERSION" publishLocal) - (cd modules/scopt && sbt -batch -Dfile.encoding=UTF8 -sbt-version "$SBT_VERSION" "++$TRAVIS_SCALA_VERSION" scoptNative/publishLocal) + + printf '\n*** Compiling scopt ***\n\n' + (cd modules/scopt && sbt -batch -Dfile.encoding=UTF8 -sbt-version "$SBT_VERSION" ${TRAVIS_SCALA_VERSION:+"++$TRAVIS_SCALA_VERSION"} scoptNative/publishLocal) + + printf '\n*** Compiling scala-library-compat ***\n\n' (cd modules/scala-library-compat && SCALANATIVE_VERSION=0.4.0-SNAPSHOT sbt -batch -sbt-version "$SBT_VERSION" compat211Native/publishLocal) touch "$SCALA_NATIVE_BUILD" diff --git a/shell.nix b/shell.nix index 80a04355..ba83d010 100644 --- a/shell.nix +++ b/shell.nix @@ -8,5 +8,9 @@ project.pkgs.mkShell { buildInputs = builtins.attrValues project.devTools; shellHook = '' ${project.ci.pre-commit-check.shellHook} + + export SN_BUILD=$( sed -n -e 's/.* SN_BUILD=\([0-9]*\).*/\1/p' -e T -e q .travis.yml ) + export SBT_VERSION=$( sed -n -e 's/.* SBT_VERSION=\([0-9.]*\).*/\1/p' -e T -e q .travis.yml ) + export TRAVIS_SCALA_VERSION=$( sed -n -e '/^scala:/{ n ; s/^[- ]*//p ; q }' .travis.yml ) ''; }