ci: split nur update from pr testing
This commit is contained in:
parent
19b5bfb47c
commit
64d5a2a9ab
7 changed files with 34 additions and 77 deletions
14
.travis.yml
14
.travis.yml
|
|
@ -11,12 +11,14 @@ notifications:
|
|||
|
||||
jobs:
|
||||
include:
|
||||
- name: deploy to nur-combined
|
||||
script: bash ci/deploy.sh
|
||||
if: branch = master
|
||||
- name: test pull request
|
||||
script: bash ci/test.sh
|
||||
if: type = pull_request
|
||||
|
||||
- name: update nur / nur-combined
|
||||
script: bash ci/update-nur.sh
|
||||
if: branch = master AND type != pull_request
|
||||
|
||||
- name: update nur-search/data/packages.json
|
||||
script: ci/update-nur-search.sh
|
||||
if: branch = master
|
||||
|
||||
|
||||
if: branch = master AND type != pull_request
|
||||
|
|
|
|||
|
|
@ -22,4 +22,3 @@ git config --global user.name "Nur a bot"
|
|||
git config --global user.email "joerg.nur-bot@thalheim.io"
|
||||
git config --global user.signingkey "B4E40EEC9053254E"
|
||||
git config --global commit.gpgsign true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
# only source this file
|
||||
# to load functions that help with travis.ci
|
||||
# ==========================================
|
||||
|
||||
|
||||
is-automatic-update() {
|
||||
[[ "$TRAVIS_EVENT_TYPE" == "cron" ]] || [[ "$TRAVIS_EVENT_TYPE" == "api" ]]
|
||||
}
|
||||
|
||||
is-pull-request(){
|
||||
[[ "$TRAVIS_PULL_REQUEST" != "false" ]]
|
||||
}
|
||||
|
||||
is-not-pull-request(){
|
||||
[[ "$TRAVIS_PULL_REQUEST" = "false" ]]
|
||||
}
|
||||
|
||||
dont-continue-on-pull-requests() {
|
||||
if is-pull-request
|
||||
then
|
||||
echo "stopping because this is a pull request"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
only-continue-on-pull-requests() {
|
||||
if is-not-pull-request
|
||||
then
|
||||
echo "stopping because this is not a pull request"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
18
ci/lint.sh
18
ci/lint.sh
|
|
@ -1,18 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eu -o pipefail # Exit with nonzero exit code if anything fails
|
||||
|
||||
$(nix-build --no-out-link release.nix)/bin/nur format-manifest
|
||||
if [ -n "$(git diff --exit-code repos.json)" ]; then
|
||||
echo "repos.json was not formatted before committing repos.json:" >&2
|
||||
git diff --exit-code repos.json
|
||||
echo "Please run ./bin/nur/format-manifest.py and updates repos.json accordingly!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Type checker
|
||||
nix run nixpkgs.python3Packages.mypy -c mypy nur
|
||||
# Format checker
|
||||
nix run nixpkgs.python3Packages.black -c black --check .
|
||||
# Linter
|
||||
nix run nixpkgs.python3Packages.flake8 -c flake8 .
|
||||
21
ci/test.sh
Executable file
21
ci/test.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eux -o pipefail # Exit with nonzero exit code if anything fails
|
||||
|
||||
nix run '(import ./release.nix {})' -c nur format-manifest
|
||||
if [ -n "$(git diff --exit-code repos.json)" ]; then
|
||||
echo "repos.json was not formatted before committing repos.json:" >&2
|
||||
git diff --exit-code repos.json
|
||||
echo "Please run ./bin/nur/format-manifest.py and updates repos.json accordingly!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Type checker
|
||||
nix run nixpkgs.python3Packages.mypy -c mypy nur
|
||||
# Format checker
|
||||
nix run nixpkgs.python3Packages.black -c black --check .
|
||||
# Linter
|
||||
nix run nixpkgs.python3Packages.flake8 -c flake8 .
|
||||
|
||||
nix run '(import ./release.nix {})' -c nur update
|
||||
nix-build
|
||||
|
|
@ -4,11 +4,8 @@ set -eu -o pipefail # Exit with nonzero exit code if anything fails
|
|||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
source ${DIR}/lib/travis-functions.sh
|
||||
|
||||
dont-continue-on-pull-requests
|
||||
|
||||
source ${DIR}/lib/setup-git.sh
|
||||
set -x
|
||||
|
||||
|
||||
# build package.json for nur-search
|
||||
|
|
@ -18,7 +15,7 @@ nix-build --quiet release.nix
|
|||
|
||||
git clone git@github.com:nix-community/nur-search
|
||||
|
||||
result/bin/nur index . > nur-search/data/packages.json
|
||||
nix run '(import ./release.nix {})' -c nur index . > nur-search/data/packages.json
|
||||
|
||||
# rebuild and publish nur-search repository
|
||||
# -----------------------------------------
|
||||
|
|
|
|||
|
|
@ -4,27 +4,15 @@ set -eu -o pipefail # Exit with nonzero exit code if anything fails
|
|||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
source ${DIR}/lib/travis-functions.sh
|
||||
|
||||
nix-build --quiet release.nix
|
||||
|
||||
if ! is-automatic-update; then
|
||||
source $DIR/lint.sh
|
||||
fi
|
||||
|
||||
source ${DIR}/lib/setup-git.sh
|
||||
set -x
|
||||
|
||||
result/bin/nur update
|
||||
nix run '(import ./release.nix {})' -c nur update
|
||||
nix-build
|
||||
|
||||
# Move everything below to a different job
|
||||
dont-continue-on-pull-requests
|
||||
|
||||
source ${DIR}/lib/setup-git.sh
|
||||
|
||||
git clone git@github.com:nix-community/nur-combined
|
||||
|
||||
result/bin/nur combine \
|
||||
nix run '(import ./release.nix {})' -c nur combine \
|
||||
--irc-notify nur-bot@chat.freenode.net:6697/nixos-nur \
|
||||
nur-combined
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue