aux-search/.github/workflows/cron.yml
Rok Garbas cfb5e540b9
Improving search query (#288)
* Reduce the numbers of bucket results on each ChangeBucket event
* Warmup after reindexing, fixes #250
* Using multiple sort keys, fixes #218
* Index also unfree packages, fixes #226, fixes #237
* Add wilcard query, fixes #279
2021-02-07 19:10:13 +01:00

99 lines
3.1 KiB
YAML

name: "Hourly import channel to Elasticsearch"
on:
schedule:
- cron: '0 * * * *'
jobs:
hourly-import-channel:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
channel:
- unstable
- 20.09
- 20.03
env:
AWS_DEFAULT_REGION: us-east-1
AWS_S3_URL: s3://nix-releases/nixpkgs
steps:
- name: Checking out the repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Installing Nix
uses: cachix/install-nix-action@v12
- uses: cachix/cachix-action@v8
with:
name: nixos-search
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Install unstable channel
run: |
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
- name: Installing awscli
run: |
nix-env -iA nixpkgs.awscli2
- name: Check for latest evaluation in ${{ matrix.channel }} channel
run: |
if [ "${{ matrix.channel }}" = "unstable" ]; then
RELEASE=$(aws s3 ls --no-sign-request "$AWS_S3_URL/" | grep '/$' | cut -d' ' -f29 | sort | tail -1 | sed 's|/||')
else
RELEASE=$(aws s3 ls --no-sign-request "$AWS_S3_URL/" | grep 'nixpkgs-${{ matrix.channel }}pre' | grep '/$' | cut -d' ' -f29 | sort | tail -1 | sed 's|/||')
fi
aws s3 cp --no-sign-request "$AWS_S3_URL/$RELEASE/src-url" ./
EVAL_ID=$(cat src-url | cut -c30-)
echo "EVAL_ID=${EVAL_ID}" >> $GITHUB_ENV
- name: Download latest builds for ${{ matrix.channel }} channel (if needed)
if: steps.eval-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ./eval-cache
cp ./src-url ./eval-cache/
curl -H "Content-Type: application/json" "$(cat ./eval-cache/src-url)/builds" -o ./eval-cache/builds.json
- name: Cache ${{ matrix.channel }} channel builds
id: eval-cache
uses: actions/cache@v2
with:
path: ./eval-cache
key: eval-cache-${{ env.EVAL_ID }}
- name: Installing nixFlakes (and jq)
run: |
nix-env -iA nixpkgs.nixFlakes nixpkgs.jq
echo 'experimental-features = nix-command flakes' | sudo tee -a /etc/nix/nix.conf
nix --version
cat /etc/nix/nix.conf
echo "$HOME/.nix-profile/bin" >> $GITHUB_PATH
- name: Building import_scripts
run: |
nix build ./#packages.x86_64-linux.import_scripts
- name: Import ${{ matrix.channel }} channel
run: |
cp ./eval-cache/builds.json ./eval-${{ env.EVAL_ID }}.json
./result/bin/import-channel --es-url ${{ secrets.ELASTICSEARCH_URL }} --channel ${{ matrix.channel }} -vvv
if: github.repository == 'NixOS/nixos-search'
- name: Warmup ${{ matrix.channel }} channel
run: |
curl ${{ secrets.ELASTICSEARCH_URL }}/latest-$(cat VERSION)-${{ matrix.channel }}/_search | jq '.took'
curl ${{ secrets.ELASTICSEARCH_URL }}/latest-$(cat VERSION)-${{ matrix.channel }}/_search | jq '.took'
curl ${{ secrets.ELASTICSEARCH_URL }}/latest-$(cat VERSION)-${{ matrix.channel }}/_search | jq '.took'
if: github.repository == 'NixOS/nixos-search'