Skip to content

Commit 248d74b

Browse files
Merge pull request #1 from Anton-Latukha/2020-07-05-CI-env
Work on the CI setup and env
2 parents 074fb3a + 0953c3b commit 248d74b

File tree

4 files changed

+161
-24
lines changed

4 files changed

+161
-24
lines changed

.github/workflows/main.yml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: "CI"
2+
on:
3+
# On Git changes in PR
4+
pull_request:
5+
# On Git changes of the master
6+
push:
7+
branches:
8+
- master
9+
schedule:
10+
# Every day at 03:45
11+
- cron: "45 03 * * *"
12+
13+
env:
14+
###
15+
### NOTE: This configuration uses `build.sh` interface, which uses `default.nix` interface, which exposes the Nixpkgs Haskell Lib interface.
16+
###
17+
### Documentation of this settings is mosly in `default.nix`, since most settings it Nixpkgs related
18+
### and the other part of keys explained in `build.sh`, since those address external procedures aound the builds.
19+
### Additional documentation is in Nixpkgs Haskell.lib: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix
20+
###
21+
useRev: "true"
22+
rev: "nixos-unstable"
23+
cachixAccount: "replaceWithProjectNameInCachix"
24+
allowInconsistentDependencies: "false"
25+
doJailbreak: "false"
26+
doCheck: "true"
27+
sdistTarball: "false"
28+
buildFromSdist: "false"
29+
buildStrictly: "false"
30+
failOnAllWarnings: "false"
31+
enableDeadCodeElimination: "false"
32+
disableOptimization: "true"
33+
linkWithGold: "false"
34+
enableLibraryProfiling: "false"
35+
enableExecutableProfiling: "false"
36+
doTracing: "false"
37+
enableDWARFDebugging: "false"
38+
doStrip: "false"
39+
enableSharedLibraries: "true"
40+
enableStaticLibraries: "false"
41+
enableSharedExecutables: "false"
42+
justStaticExecutables: "false"
43+
enableSeparateBinOutput: "false"
44+
checkUnusedPackages: "false"
45+
doHaddock: "false"
46+
doHyperlinkSource: "false"
47+
doCoverage: "false"
48+
doBenchmark: "false"
49+
generateOptparseApplicativeCompletions: "false"
50+
executableNamesToShellComplete: '[ "replaceWithExecutableName" ]'
51+
#
52+
withHoogle: "false"
53+
#
54+
ghcjsTmpLogFile: "/tmp/ghcjsTmpLogFile.log"
55+
ghcjsLogTailLength: "10000"
56+
57+
jobs:
58+
Nixpkgs_default_Linux:
59+
name: Nixpkgs, NixOS unstable channel, default (GHC 8.8), Linux
60+
runs-on: ubuntu-latest
61+
continue-on-error: true
62+
steps:
63+
- name: Git checkout
64+
uses: actions/checkout@v2
65+
- name: Install Nix
66+
uses: cachix/install-nix-action@v10
67+
with:
68+
nix_path: nixpkgs=channel:nixpkgs-unstable
69+
- name: Determined nix-build
70+
run: ./build.sh
71+
Nixpkgs_stable_Linux:
72+
name: Nixpkgs, NixOS stable channel, default (GHC 8.8), Linux
73+
runs-on: ubuntu-latest
74+
continue-on-error: true
75+
env:
76+
rev: "nixos-20.03"
77+
steps:
78+
- name: Git checkout
79+
uses: actions/checkout@v2
80+
- name: Install Nix
81+
uses: cachix/install-nix-action@v10
82+
with:
83+
nix_path: nixpkgs=channel:nixpkgs-unstable
84+
- name: Determined nix-build
85+
run: ./build.sh
86+
Nixpkgs_SDist_Optimize_Benchmark_Haddock_GHC-8-10_Linux:
87+
name: Nixpkgs, SDist, Optimize, Benchmark, Haddock, GHC 8.10.1, Linux
88+
runs-on: ubuntu-latest
89+
continue-on-error: true
90+
env:
91+
compiler: "ghc8101"
92+
buildFromSdist: "true"
93+
linkWithGold: "true"
94+
doHaddock: "true"
95+
doHyperlinkSource: "true"
96+
doBenchmark: "true"
97+
disableOptimization: "false"
98+
enableDeadCodeElimination: "true"
99+
generateOptparseApplicativeCompletions: "false"
100+
steps:
101+
- name: Git checkout
102+
uses: actions/checkout@v2
103+
- name: Install Nix
104+
uses: cachix/install-nix-action@v10
105+
with:
106+
nix_path: nixpkgs=channel:nixpkgs-unstable
107+
- name: Determined nix-build
108+
run: ./build.sh
109+
Nixpkgs_GHCJS_Linux:
110+
name: Nixpkgs, GHCJS, Linux
111+
runs-on: ubuntu-latest
112+
continue-on-error: true
113+
env:
114+
compiler: "ghcjs"
115+
steps:
116+
- name: Git checkout
117+
uses: actions/checkout@v2
118+
- name: Install Nix
119+
uses: cachix/install-nix-action@v10
120+
with:
121+
nix_path: nixpkgs=channel:nixpkgs-unstable
122+
- name: Determined nix-build
123+
run: ./build.sh
124+
Nixpkgs_unstable_macOS:
125+
name: Nixpkgs, unstable, default (GHC 8.8), macOS
126+
runs-on: macos-latest
127+
continue-on-error: true
128+
env:
129+
rev: "nixpkgs-unstable"
130+
steps:
131+
- name: Git checkout
132+
uses: actions/checkout@v2
133+
- name: Install Nix
134+
uses: cachix/install-nix-action@v10
135+
with:
136+
nix_path: nixpkgs=channel:nixpkgs-unstable
137+
- name: Determined nix-build
138+
run: ./build.sh
139+
Hackage_Cabal_GHC-8-10_Linux:
140+
name: Hackage, Cabal, GHC 8.10, Linux
141+
runs-on: ubuntu-latest
142+
continue-on-error: true
143+
steps:
144+
- uses: actions/checkout@v2
145+
- uses: actions/[email protected]
146+
with:
147+
ghc-version: "8.10"
148+
# cabal-version: "3.0.0.0"
149+
- run: cabal v2-configure
150+
- run: cabal v2-build
151+
- run: cabal v2-test

.github/workflows/test.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

build.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ set -Eexuo pipefail
1313

1414

1515
# NOTE: If vars not imported - init the vars with default values
16-
compiler=${compiler:-'ghc8101'}
16+
compiler=${compiler:-'ghc883'}
17+
useRev=${useRev:-'false'}
1718
rev=${rev:-'nixpkgs-unstable'}
18-
# If NIX_PATH not imported - construct it from `rev`
19-
NIX_PATH=${NIX_PATH:-"nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz"}
20-
export NIX_PATH
21-
# Project name, used by cachix
22-
project=${project:-'defaultProjectName'}
19+
# Account in Cachix to use
20+
cachixAccount=${cachixAccount:-'replaceWithProjectNameInCachix'}
2321

2422

2523
allowInconsistentDependencies=${allowInconsistentDependencies:-'false'}
@@ -55,7 +53,7 @@ doCoverage=${doCoverage:-'false'}
5553
doBenchmark=${doBenchmark:-'false'}
5654
generateOptparseApplicativeCompletions=${generateOptparseApplicativeCompletions:-'false'}
5755
# [ "binary1" "binary2" ] - should pass " quotes into Nix interpreter
58-
executableNamesToShellComplete=${executableNamesToShellComplete:-'[ "defaultBinaryName" ]'}
56+
executableNamesToShellComplete=${executableNamesToShellComplete:-'[ "replaceWithExecutableName" ]'}
5957

6058

6159
withHoogle=${withHoogle:-'false'}
@@ -190,22 +188,22 @@ MAIN() {
190188

191189
# Overall it is useful to have in CI test builds the latest stable Nix
192190
# 2020-06-24: HACK: Do not ask why different commands on Linux and macOS. IDK, wished they we the same. These are the only commands that worked on according platforms right after the fresh Nix installer rollout.
193-
(nix-channel --update && nix-env -iA nixpkgs.nix) || (sudo nix upgrade-nix)
191+
(nix-channel --update && nix-env -u) || (sudo nix upgrade-nix)
194192

195193

196194
# Report the Nixpkgs channel revision
197195
nix-instantiate --eval -E 'with import <nixpkgs> {}; lib.version or lib.nixpkgsVersion'
198196

199197

200198
# Secrets are not shared to PRs from forks
201-
# nix-build | cachix push <project> - uploads binaries, runs&works only in the branches of the main repository, so for PRs - else case runs
199+
# nix-build | cachix push <account> - uploads binaries, runs&works only in the branches of the main repository, so for PRs - else case runs
202200

203201
if [ ! "$CACHIX_SIGNING_KEY" = "" ]
204202

205203
then
206204

207205
# Build of the inside repo branch - enable push Cachix cache
208-
BUILD_PROJECT | cachix push "$project"
206+
BUILD_PROJECT | cachix push "$cachixAccount"
209207

210208
else
211209

default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
# Compiler in a form ghc8101 == GHC 8.10.1, just remove spaces and dots
3+
# 2020-07-05: By default using default GHC for Nixpkgs, see https://search.nixos.org/packages?query=ghc&from=0&size=500&channel=unstable for current version (currently ghc883 == GHC 8.8.3)
34
compiler ? "ghc883"
45

56
# This settings expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix
@@ -74,7 +75,7 @@
7475

7576

7677
, useRev ? false
77-
# Nix by default uses nixpkgs-unstable channel
78+
# Nix by default updates and uses locally configured nixpkgs-unstable channel
7879
# Nixpkgs revision options:
7980
# `rev` vals in order of freshness -> cache & stability:
8081
# { master

0 commit comments

Comments
 (0)