From b3a39410e78cf8d78cbec72143abb22a9de5db91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 29 Nov 2020 17:28:00 +0100 Subject: [PATCH] switch to github actions from travis --- .github/dependabot.yml | 6 ++++++ .github/workflows/pr.yml | 12 ++++++++++++ .github/workflows/update.yml | 22 ++++++++++++++++++++++ .travis.yml | 25 ------------------------- ci/lib/setup-git.sh | 19 ------------------- ci/test.sh | 9 +++++---- ci/update-nur-search.sh | 8 ++++++-- ci/update-nur.sh | 7 +++++-- 8 files changed, 56 insertions(+), 52 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/update.yml delete mode 100644 .travis.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..5ace4600a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000..d5dd3fc92 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,12 @@ +name: "Test" +on: + pull_request: +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=channel:nixos-unstable + - run: ./ci/test.sh diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 000000000..9e1f999f6 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,22 @@ +name: "Test" +on: + workflow_dispatch: + schedule: + # chosen by fair dice rolling + - cron: '05 4 * * *' + push: + branches: + - master +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=channel:nixos-unstable + - run: ./ci/test.sh + - name: update nur / nur-combined + run: ./ci/update-nur.sh + - name: update nur-search/data/packages.json + run: ./ci/update-nur-search.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7c39f04f0..000000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: ~> 1.0 -import: nix-community/nix-travis-ci:nix.yml@main - -notifications: - irc: - on_success: change - on_failure: always - channels: - - "irc.freenode.net#nixos-nur" - template: - - "%{result} - %{branch} \"%{commit_subject}\" %{build_url}" - -jobs: - include: - - 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 AND type != pull_request diff --git a/ci/lib/setup-git.sh b/ci/lib/setup-git.sh index 2b1725f34..6be3d00af 100644 --- a/ci/lib/setup-git.sh +++ b/ci/lib/setup-git.sh @@ -1,24 +1,5 @@ # only source this file -# to setup git to push and pull repositories via ssh # ================================================== -# set up git and ssh -# ------------------ -keys_dir=$(mktemp -d) -openssl aes-256-cbc \ - -K $encrypted_080f214a372c_key \ - -iv $encrypted_080f214a372c_iv \ - -in ci/keys.tar.gz.enc -out ci/keys.tar.gz -d -tar -C "$keys_dir" -xzvf ci/keys.tar.gz -eval "$(ssh-agent -s)" -chmod 600 "${keys_dir}/ssh-key" -ssh-add "${keys_dir}/ssh-key" -gpg --import "${keys_dir}/gpg-private-key" -rm -rf "$keys_dir" - -export encrypted_080f214a372c_key= encrypted_080f214a372c_iv= - 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 diff --git a/ci/test.sh b/ci/test.sh index b41105b6f..68e132ef0 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/usr/bin/env nix-shell +#!nix-shell -p bash -i bash -p python3Packages.mypy -p python3Packages.black -p python3Packages.flake8 set -eux -o pipefail # Exit with nonzero exit code if anything fails @@ -11,11 +12,11 @@ if [ -n "$(git diff --exit-code repos.json)" ]; then fi # Type checker -nix run nixpkgs.python3Packages.mypy -c mypy nur +mypy nur # Format checker -nix run nixpkgs.python3Packages.black -c black --check . +black --check . # Linter -nix run nixpkgs.python3Packages.flake8 -c flake8 . +flake8 . nix run '(import ./release.nix {})' -c nur update nix-build diff --git a/ci/update-nur-search.sh b/ci/update-nur-search.sh index 96d87595d..6242147a2 100755 --- a/ci/update-nur-search.sh +++ b/ci/update-nur-search.sh @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/usr/bin/env nix-shell +#!nix-shell -p git -p bash -i bash set -eu -o pipefail # Exit with nonzero exit code if anything fails @@ -13,7 +14,10 @@ set -x nix-build --quiet release.nix -git clone --recurse-submodules git@github.com:nix-community/nur-search +git clone \ + --recurse-submodules \ + --single-branch \ + "https://$API_TOKEN_GITHUB@github.com/nix-community/nur-combined.git" git clone git@github.com:nix-community/nur-combined diff --git a/ci/update-nur.sh b/ci/update-nur.sh index f0ea907b2..f1766bae5 100755 --- a/ci/update-nur.sh +++ b/ci/update-nur.sh @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/usr/bin/env nix-shell +#!nix-shell -p git -p bash -i bash set -eu -o pipefail # Exit with nonzero exit code if anything fails @@ -10,7 +11,9 @@ set -x nix run '(import ./release.nix {})' -c nur update nix-build -git clone git@github.com:nix-community/nur-combined +git clone \ + --single-branch \ + "https://$API_TOKEN_GITHUB@github.com/nix-community/nur-combined.git" nix run '(import ./release.nix {})' -c nur combine \ --irc-notify nur-bot@chat.freenode.net:6697/nixos-nur \