2020-05-22 22:13:55 +00:00
|
|
|
name: "Hourly import channel to Elasticsearch"
|
2020-06-19 18:16:11 +00:00
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
on:
|
2020-06-19 18:16:11 +00:00
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
schedule:
|
|
|
|
- cron: '0 * * * *'
|
2020-06-19 18:16:11 +00:00
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
jobs:
|
2020-06-19 18:16:11 +00:00
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
hourly-import-channel:
|
2020-06-19 18:16:11 +00:00
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-06-19 18:16:11 +00:00
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
strategy:
|
2020-06-19 18:16:11 +00:00
|
|
|
fail-fast: true
|
2020-05-22 22:13:55 +00:00
|
|
|
matrix:
|
|
|
|
channel:
|
2020-06-15 08:26:19 +00:00
|
|
|
- unstable
|
2020-09-24 20:29:47 +00:00
|
|
|
- 20.09
|
2020-06-15 08:26:19 +00:00
|
|
|
- 20.03
|
|
|
|
- 19.09
|
2020-06-19 18:16:11 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
S3_URL: s3://nix-releases/nixpkgs
|
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
steps:
|
2020-06-19 18:16:11 +00:00
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
- name: Checking out the repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-06-18 22:41:01 +00:00
|
|
|
|
2020-07-24 12:41:34 +00:00
|
|
|
- name: Installing Nix
|
|
|
|
uses: cachix/install-nix-action@v8
|
|
|
|
|
2020-08-28 20:57:06 +00:00
|
|
|
- uses: cachix/cachix-action@v6
|
|
|
|
with:
|
|
|
|
name: nixos-search
|
|
|
|
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
|
|
|
|
2020-07-24 12:41:34 +00:00
|
|
|
- name: Installing awscli
|
|
|
|
run: |
|
|
|
|
nix-env -iA nixpkgs.awscli
|
|
|
|
|
2020-06-19 18:16:11 +00:00
|
|
|
- name: Check for latest evaluation in ${{ matrix.channel }} channel
|
|
|
|
run: |
|
|
|
|
if [ "${{ matrix.channel }}" = "unstable" ]; then
|
|
|
|
RELEASE=$(aws s3 ls --no-sign-request "$S3_URL/" | grep "/$" | cut -d" " -f29 | sort | tail -1 | sed 's|/||')
|
|
|
|
else
|
|
|
|
RELEASE=$(aws s3 ls --no-sign-request "$S3_URL/" | grep "nixpkgs-${{ matrix.channel }}pre" | grep "/$" | cut -d" " -f29 | sort | tail -1 | sed 's|/||')
|
|
|
|
fi
|
|
|
|
aws s3 cp --no-sign-request "$S3_URL/$RELEASE/src-url" ./
|
|
|
|
echo "::set-env name=EVAL_ID::$(cat src-url | cut -c30-)"
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2020-07-24 12:41:34 +00:00
|
|
|
- name: Cache ${{ matrix.channel }} channel builds
|
|
|
|
id: eval-cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ./eval-cache
|
|
|
|
key: eval-cache-${{ env.EVAL_ID }}
|
2020-06-18 22:41:01 +00:00
|
|
|
|
|
|
|
- name: Installing NixFlakes
|
|
|
|
run: |
|
|
|
|
nix-env -iA nixpkgs.nixFlakes
|
|
|
|
echo "::add-path::$HOME/.nix-profile/bin"
|
|
|
|
echo 'experimental-features = nix-command flakes' | sudo tee -a /etc/nix/nix.conf
|
|
|
|
nix --version
|
|
|
|
cat /etc/nix/nix.conf
|
|
|
|
|
|
|
|
- name: Building import_scripts
|
|
|
|
run: |
|
|
|
|
nix build ./#packages.x86_64-linux.import_scripts
|
|
|
|
|
2020-05-22 22:13:55 +00:00
|
|
|
- name: Import ${{ matrix.channel }} channel
|
|
|
|
run: |
|
2020-06-19 18:16:11 +00:00
|
|
|
cp ./eval-cache/builds.json ./eval-${{ env.EVAL_ID }}.json
|
2020-06-18 22:41:01 +00:00
|
|
|
./result/bin/import-channel --es-url ${{ secrets.ELASTICSEARCH_URL }} --channel ${{ matrix.channel }} -vvv
|
2020-05-22 22:13:55 +00:00
|
|
|
if: github.repository == 'NixOS/nixos-search'
|