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:
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
- name: Building import_scripts
run: |
nix build .#flake-info
- name: Try importing all custom flakes
run: |
shopt -s globstar
@ -39,8 +35,8 @@ jobs:
for flake_group in flakes/**/*.toml
do
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" ]]
then
@ -52,7 +48,7 @@ jobs:
report="${report//'%'/'%25'}"
report="${report//$'\n'/'%0A'}"
report="${report//$'\r'/'%0D'}"
echo "::error file=$flake_group::$report"
fi

View file

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

View file

@ -7,29 +7,7 @@ on:
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:
needs: build-flake-info
runs-on: ubuntu-latest
strategy:
@ -75,8 +53,6 @@ jobs:
import-flakes:
needs: build-flake-info
runs-on: ubuntu-latest
strategy:

2
.gitignore vendored
View file

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

View file

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

View file

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