Workflow improvements (#458)

- Separate building flake-info into a new workflow that's triggered on push
  and on relevant pull requests
- Move frontend-related files into a `frontend` subdirectory
This commit is contained in:
Naïm Favier 2022-03-30 20:45:35 +02:00 committed by GitHub
parent 5798bb000e
commit b316bc13cc
Failed to generate hash of commit
37 changed files with 43 additions and 48 deletions

29
.github/workflows/build-flake-info.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: "Build flake-info"
on:
pull_request:
paths:
- "flake.nix"
- "flake.lock"
- "flake-info/**"
push:
branches:
- main
jobs:
build-flake-info:
runs-on: ubuntu-latest
steps:
- name: Checking out the repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/common-setup
with:
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: Building flake-info
run: |
nix -vL build .#flake-info

View file

@ -26,10 +26,6 @@ jobs:
with: with:
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }} CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: Building import_scripts
run: |
nix build .#flake-info
- name: Try importing all custom flakes - name: Try importing all custom flakes
run: | run: |
shopt -s globstar shopt -s globstar
@ -39,8 +35,8 @@ jobs:
for flake_group in flakes/**/*.toml for flake_group in flakes/**/*.toml
do do
echo "::group::Group \"$(basename $flake_group .toml)\"" echo "::group::Group \"$(basename $flake_group .toml)\""
./result/bin/flake-info group "$flake_group" "$(basename "$flake_group" .toml)" --report nix run .#flake-info -- group "$flake_group" "$(basename "$flake_group" .toml)" --report
if [[ -f "./report.txt" ]] if [[ -f "./report.txt" ]]
then then
@ -52,7 +48,7 @@ jobs:
report="${report//'%'/'%25'}" report="${report//'%'/'%25'}"
report="${report//$'\n'/'%0A'}" report="${report//$'\n'/'%0A'}"
report="${report//$'\r'/'%0D'}" report="${report//$'\r'/'%0D'}"
echo "::error file=$flake_group::$report" echo "::error file=$flake_group::$report"
fi fi

View file

@ -2,13 +2,10 @@ name: "Frontend: Build & Deploy to Netlify"
on: on:
pull_request: pull_request:
paths: paths:
- "src/**" - "flake.nix"
- "elm-srcs.nix" - "flake.lock"
- "elm.json" - "frontend/**"
- "netflify.toml"
- "VERSION" - "VERSION"
- "webpack.config.js"
- "yarn.lock"
push: push:
branches: branches:
@ -49,4 +46,4 @@ jobs:
enable-commit-comment: true enable-commit-comment: true
enable-commit-status: true enable-commit-status: true
overwrites-pull-request-comment: false overwrites-pull-request-comment: false
if: github.repository == 'NixOS/nixos-search' if: github.repository_owner == 'NixOS'

View file

@ -7,29 +7,7 @@ on:
jobs: jobs:
build-flake-info:
runs-on: ubuntu-latest
steps:
- name: Checking out the repository
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/common-setup
with:
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: Building flake-info
run: |
nix -vL build .#flake-info
import-nixpkgs: import-nixpkgs:
needs: build-flake-info
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -75,8 +53,6 @@ jobs:
import-flakes: import-flakes:
needs: build-flake-info
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:

2
.gitignore vendored
View file

@ -11,8 +11,6 @@ dist
elm-stuff/ elm-stuff/
eval-* eval-*
ignore ignore
import-scripts/import_scripts/__pycache__/
import-scripts/tests/__pycache__/
logs logs
node_modules node_modules
npm-debug.log* npm-debug.log*

View file

@ -30,7 +30,7 @@
packages.default = packages.flake-info; packages.default = packages.flake-info;
packages.flake-info = import ./flake-info { inherit pkgs; }; packages.flake-info = import ./flake-info { inherit pkgs; };
packages.frontend = import ./. { inherit pkgs; }; packages.frontend = import ./frontend { inherit pkgs; };
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues packages; inputsFrom = builtins.attrValues packages;

View file

@ -1,5 +1,5 @@
{ pkgs ? import <nixpkgs> { } { pkgs ? import <nixpkgs> { }
, version ? pkgs.lib.removeSuffix "\n" (builtins.readFile ./VERSION) , version ? pkgs.lib.removeSuffix "\n" (builtins.readFile ../VERSION)
}: }:
let let
package = builtins.fromJSON (builtins.readFile ./package.json); package = builtins.fromJSON (builtins.readFile ./package.json);
@ -76,12 +76,12 @@ pkgs.stdenv.mkDerivation {
cp netlify.toml $out/ cp netlify.toml $out/
''; '';
shellHook = '' shellHook = ''
rm -rf node_modules rm -rf frontend/node_modules
ln -sf ${yarnPkg}/libexec/${package.name}/node_modules . ln -sf ${yarnPkg}/libexec/${package.name}/node_modules frontend/
export PATH=$PWD/node_modules/.bin:$PATH export PATH=$PWD/frontend/node_modules/.bin:$PATH
export ELASTICSEARCH_MAPPING_SCHEMA_VERSION=${version} export ELASTICSEARCH_MAPPING_SCHEMA_VERSION=${version}
echo "============================" echo "============================"
echo "= To develop run: yarn dev =" echo "= To develop the frontend run: cd frontend && yarn dev ="
echo "============================" echo "============================"
''; '';

View file

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -1,8 +1,7 @@
final: prev: final: prev:
{ {
nixos-search = { nixos-search = {
frontend = import ./. { pkgs = prev; }; frontend = import ./frontend { pkgs = prev; };
import_scripts = import ./import-scripts { pkgs = prev; };
flake-info = import ./flake-info { pkgs = prev; }; flake-info = import ./flake-info { pkgs = prev; };
}; };
} }