Skip to content

Commit

Permalink
fix: try to switch CI/CD to ubuntu github-hosted runner
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-semenov committed May 12, 2024
1 parent f14460a commit 3eebdfb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 27 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,25 @@ on:

jobs:
Compile-All:
runs-on: macos-12
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache Vagrant boxes
uses: actions/[email protected]
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
path: ~/.vagrant.d/boxes
key: $${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable

- name: Show Vagrant version
run: vagrant --version

- name: Run vagrant up & provision
- name: Compile TextMate Grammar
run: |
vagrant plugin install vagrant-disksize
vagrant up --provision
env:
VER: 23.05
chmod +x ./scripts/compile-grammar.sh
./scripts/compile-grammar.sh
- name: Get Coverage Badge SVG
run: make -B $(pwd)/images/coverage-badge.svg
- name: Compile Coverage Badge SVG
run: |
sudo apt-get install -y xsltproc
make -B $(pwd)/images/coverage-badge.svg
- name: Import GPG key
id: import-gpg
Expand Down
12 changes: 4 additions & 8 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Vagrant.configure("2") do |config|
config.vm.box = "nixbox/nixos"
config.vm.box_version = ver.to_s

config.disksize.size = '8GB'
config.disksize.size = '10GB'

config.vm.provider "virtualbox" do |vb|
vb.gui = false
Expand All @@ -17,12 +17,8 @@ Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant"

config.vm.provision "shell", privileged: false, inline: <<-'SHELL'
cd /vagrant/
nix --version
df -h
echo "statix check && \
nix flake check --impure && \
cp \$(nix build --impure --no-link --print-out-paths)/parigp* ./syntaxes/" | \
nix-shell --run bash
SCRIPTNAME=scripts/compile-grammar.sh
chmod +x /vagrant/$SCRIPTNAME
/vagrant/$SCRIPTNAME
SHELL
end
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
packages.${current_system}.default =

with import nixpkgs { system = current_system; };
with import ./nixpkgs.nix { system = current_system; };
let vscode_tmgrammar_test =
buildNpmPackage rec {
pname = "vscode-tmgrammar-test";
Expand Down
7 changes: 7 additions & 0 deletions nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let
lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
in
import (fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
sha256 = lock.narHash;
})
17 changes: 17 additions & 0 deletions scripts/compile-grammar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env nix-shell
#!nix-shell ../shell.nix -i bash
# compile-grammar.sh - Builds TextMate grammar with help of Nix.

# shellcheck shell=sh
set -e


scriptPath="$(readlink -f $0)"
rootDir=$(dirname "${scriptPath%/*}")

statix check
nix flake check --impure "$rootDir"

cp $(nix build --impure \
--no-link \
--print-out-paths "$rootDir")/parigp* "$rootDir/syntaxes/"
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs ? (import <nixpkgs>) {} }:
{ pkgs ? (import ./nixpkgs.nix) {} }:
pkgs.mkShell {
NIX_CONFIG = "experimental-features = nix-command flakes";
nativeBuildInputs = with pkgs; [
Expand Down

0 comments on commit 3eebdfb

Please sign in to comment.