on master help sign in
wip
4b2d274iko
.github/actions/common_setup/action.yaml+5−23
@@ -7,24 +7,6 @@ inputs:
7runs:
7runs:
8 using: "composite"
8 using: "composite"
9 steps:
9 steps:
10− - name: Install skopeo
11− shell: bash
12− run: |
13− sudo apt-get -y update
14− sudo apt-get -y install skopeo
15−
16− - name: Increase swap
17− shell: bash
18− run: |
19− free -h
20−
21− sudo swapoff /mnt/swapfile
22− sudo fallocate -l 12G /mnt/swapfile
23− sudo mkswap /mnt/swapfile
24− sudo swapon /mnt/swapfile
25−
26− free -h
27−
28 - name: Install Nix
10 - name: Install Nix
29 uses: cachix/install-nix-action@v16
11 uses: cachix/install-nix-action@v16
30 with:
12 with:
@@ -33,8 +15,8 @@ runs:
33 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
15 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
34 substituters = https://hydra.iohk.io https://cache.nixos.org/
16 substituters = https://hydra.iohk.io https://cache.nixos.org/
35
17
36− - name: Login to Cachix
18+ # - name: Login to Cachix
37− uses: cachix/cachix-action@v10
19+ # uses: cachix/cachix-action@v10
38− with:
20+ # with:
39− name: octopod
21+ # name: octopod
40− signingKey: ${{ inputs.cachixSigningKey }}
22+ # signingKey: ${{ inputs.cachixSigningKey }}
.github/actions/push_docker_images/action.yaml+1−7
@@ -13,14 +13,8 @@ inputs:
13runs:
13runs:
14 using: "composite"
14 using: "composite"
15 steps:
15 steps:
16− - name: Login to DockerHub
17− uses: docker/login-action@v1.10.0
18− with:
19− username: ${{ inputs.docker_username }}
20− password: ${{ inputs.docker_password }}
21−
22 - name: Push Docker Images to DockerHub
16 - name: Push Docker Images to DockerHub
23 shell: bash
17 shell: bash
24 run: |
18 run: |
25 skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto) docker://typeable/comparest-github-action:${{ inputs.tag }}
19 skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto) docker://typeable/comparest-github-action:${{ inputs.tag }}
26− skopeo copy docker-archive:$(nix-build -A compaREST -j auto) docker://typeable/comparest:${{ inputs.tag }}
20+ skopeo copy docker-archive:$(nix-build -A compaRESTImage -j auto) docker://typeable/comparest:${{ inputs.tag }}
.github/workflows/github-actions-image.yaml+87−60
@@ -5,39 +5,46 @@ on:
5 branches: [master]
5 branches: [master]
6 pull_request:
6 pull_request:
7 branches: [master]
7 branches: [master]
8− workflow_dispatch:
8+ release:
9− inputs:
9+ types: [prereleased]
10− release:
11− description: Release the new version?
12− required: false
13− default: "true"
14− version:
15− description: The version to release
16− required: true
17
10
18jobs:
11jobs:
19− build-github-action-image:
12+ Linux:
20 runs-on: ubuntu-latest
13 runs-on: ubuntu-latest
21−
22 steps:
14 steps:
15+ - name: Increase swap
16+ shell: bash
17+ run: |
18+ free -h
19+
20+ sudo swapoff /mnt/swapfile
21+ sudo fallocate -l 12G /mnt/swapfile
22+ sudo mkswap /mnt/swapfile
23+ sudo swapon /mnt/swapfile
24+
25+ free -h
26+
23 - uses: actions/checkout@v2
27 - uses: actions/checkout@v2
24 with:
28 with:
25 submodules: recursive
29 submodules: recursive
26
30
27 - name: Common setup
31 - name: Common setup
28 uses: ./.github/actions/common_setup
32 uses: ./.github/actions/common_setup
33+
34+ - name: Build Linux static binary
35+ run: |
36+ cp $(nix-build -A compaRESTStaticBin -j auto)/bin/compaREST compaREST
37+
38+ - name: Upload compaREST Linux Binary
39+ uses: actions/upload-artifact@v2
29 with:
40 with:
30− cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
41+ name: compaREST-Linux
42+ path: compaREST
31
43
32 - name: Build Github Action Docker Image
44 - name: Build Github Action Docker Image
33 run: |
45 run: |
34 cp $(nix-build -A compaRESTGithubAction -j auto) compaREST-Github-Action-image.tar.gz
46 cp $(nix-build -A compaRESTGithubAction -j auto) compaREST-Github-Action-image.tar.gz
35− cp $(nix-build -A compaREST -j auto) compaREST-image.tar.gz
47+ cp $(nix-build -A compaRESTImage-j auto) compaREST-image.tar.gz
36−
37− - name: Build Linux static binary
38− run: |
39− mkdir compaREST-binary
40− cp $(nix-build -A compaRESTBin -j auto)/bin/compaREST compaREST-binary/compaREST
41
48
42 - name: Upload compaREST Github Action Image
49 - name: Upload compaREST Github Action Image
43 uses: actions/upload-artifact@v2
50 uses: actions/upload-artifact@v2
@@ -51,60 +58,80 @@ jobs:
51 name: compaREST-image
58 name: compaREST-image
52 path: compaREST-image.tar.gz
59 path: compaREST-image.tar.gz
53
60
54− - name: Upload compaREST Linux Binary
61+ - name: Install skopeo
55− uses: actions/upload-artifact@v2
62+ shell: bash
56− with:
63+ run: |
57− name: compaREST-linux
64+ sudo apt-get -y update
58− path: compaREST-binary/compaREST
65+ sudo apt-get -y install skopeo
59
66
60− - name: Push Nightly Docker Images to DockerHub
67+ - name: Login to DockerHub
61− if: github.ref == 'refs/heads/master' && github.event_name == 'push'
68+ if: github.event_name == 'release'
62− uses: ./.github/actions/push_docker_images
69+ uses: docker/login-action@v1.10.0
63 with:
70 with:
64− tag: nightly
65− docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
71+ username: ${{ secrets.DOCKERHUB_USERNAME }}
66− docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
72+ password: ${{ secrets.DOCKERHUB_TOKEN }}
67
73
68− release:
74+ - name: Push Docker Images to DockerHub
69− name: Release
70− if: github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true'
75+ if: github.event_name == 'release'
71− needs: [build-github-action-image]
76+ shell: bash
77+ run: |
78+ skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto) docker://typeable/comparest-github-action:${{ github.event.payload.name }}
79+ skopeo copy docker-archive:$(nix-build -A compaRESTImage -j auto) docker://typeable/comparest:${{ github.event.payload.name }}
80+
81+ macOS:
72− runs-on: "ubuntu-latest"
82+ runs-on: ubuntu-latest
73 steps:
83 steps:
74 - uses: actions/checkout@v2
84 - uses: actions/checkout@v2
85+ with:
86+ submodules: recursive
87+
75 - name: Common setup
88 - name: Common setup
76 uses: ./.github/actions/common_setup
89 uses: ./.github/actions/common_setup
77− with:
78− cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
79
90
80− - name: Push Docker Release Images to DockerHub
91+ - name: Build macOS binary bundle
81− uses: ./.github/actions/push_docker_images
92+ run: |
93+ cp -LR $(nix-build -A macOSCompaRESTBundle -j auto)/bin/compaREST compaREST
94+
95+ - name: Upload macOS compaREST bundle
96+ uses: actions/upload-artifact@v2
82 with:
97 with:
83− tag: ${{ github.event.inputs.version }}
98+ name: compaREST-macOS
84− docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
99+ path: compaREST
85− docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
100+
101+ Linux-Windows:
102+ runs-on: ubuntu-latest
103+ steps:
104+ - name: Increase swap
105+ shell: bash
106+ run: |
107+ free -h
108+
109+ sudo swapoff /mnt/swapfile
110+ sudo fallocate -l 12G /mnt/swapfile
111+ sudo mkswap /mnt/swapfile
112+ sudo swapon /mnt/swapfile
86
113
87− - name: Push Docker latest Images to DockerHub
114+ free -h
88− uses: ./.github/actions/push_docker_images
115+
116+ - uses: actions/checkout@v2
89 with:
117 with:
90− tag: latest
118+ submodules: recursive
91− docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
119+
92− docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
120+ - name: Common setup
121+ uses: ./.github/actions/common_setup
93
122
94− - uses: actions/download-artifact@v2
123+ - name: Build Windows binary
95− - name: Zip and move
96 run: |
124 run: |
97− chmod +x compaREST-linux/compaREST
125+ cp -LR $(nix-build -A WindowsCompaRESTBin -j auto)/bin compaREST
98− zip compaREST-linux compaREST-linux/compaREST
99
126
100− mv compaREST-Github-Action-image/* .
127+ - name: Upload compaREST Linux Binary
128+ uses: actions/upload-artifact@v2
129+ with:
101− mv compaREST-image/* .
130+ name: compaREST-Windows
102− - uses: "marvinpinto/action-automatic-releases@latest"
131+ path: compaREST
132+
133+ - name: Upload Windows compaREST bundle
134+ uses: actions/upload-artifact@v2
103 with:
135 with:
104− repo_token: "${{ secrets.GITHUB_TOKEN }}"
136+ name: compaREST-Windows
105− automatic_release_tag: "latest"
137+ path: compaREST
106− prerelease: false
107− title: "${{ github.event.inputs.version }}"
108− files: |
109− *.zip
110− *.tar.gz
default.nix+42−5
@@ -5,6 +5,8 @@
5, nix-filter ? import sources.nix-filter
5, nix-filter ? import sources.nix-filter
6}:
6}:
7let
7let
8+ masterPkgs = import sources.nixpkgs { inherit system; };
9+
8 hsPkgs = pkgs.haskell-nix.stackProject {
10 hsPkgs = pkgs.haskell-nix.stackProject {
9 src = nix-filter {
11 src = nix-filter {
10 root = ./.;
12 root = ./.;
@@ -21,7 +23,12 @@ let
21 dontStrip = false;
23 dontStrip = false;
22 dontPatchELF = false;
24 dontPatchELF = false;
23 enableDeadCodeElimination = true;
25 enableDeadCodeElimination = true;
24− ghcOptions = [ "-O2" ];
26+ ghcOptions = [
27+ "-O2"
28+ "-fexpose-all-unfoldings"
29+ "-fspecialise-aggressively"
30+ ];
31+ packages.pandoc.ghcOptions = [ "-O1" ];
25 packages.comparest.src = nix-filter {
32 packages.comparest.src = nix-filter {
26 root = ./.;
33 root = ./.;
27 name = "compaREST-src";
34 name = "compaREST-src";
@@ -46,16 +53,35 @@ let
46 ${pkgs.nukeReferences}/bin/nuke-refs $out/bin/*
53 ${pkgs.nukeReferences}/bin/nuke-refs $out/bin/*
47 '';
54 '';
48
55
56+ compaRESTBin = hsPkgs.comparest.components.exes.comparest;
49− compaRESTBin = hsPkgs.projectCross.musl64.hsPkgs.comparest.components.exes.comparest;
57+ compaRESTStaticBin = (staticify "compaREST-static" hsPkgs.projectCross.musl64.hsPkgs.comparest.components.exes.comparest);
58+
59+
60+ # doesn't work
61+ armDarwinCompaREST = hsPkgs.projectCross.aarch64-darwin.hsPkgs.comparest.components.exes.comparest;
50
62
51− compaREST = pkgs.dockerTools.buildImage {
63+ compaRESTImage = pkgs.dockerTools.buildImage {
52 name = "compaREST";
64 name = "compaREST";
53− contents = [ (staticify "compaREST-static" compaRESTBin) ];
65+ contents = [ compaRESTStaticBin ];
54 config = {
66 config = {
55 Entrypoint = [ "/bin/comparest" ];
67 Entrypoint = [ "/bin/comparest" ];
56 };
68 };
57 };
69 };
58
70
71+ macOSCompaRESTBundle = pkgs.runCommand "compaREST-macos-bundled"
72+ {
73+ buildInputs = [ masterPkgs.macdylibbundler ];
74+ } ''
75+ mkdir -p $out/lib
76+ cp ${compaRESTBin}/bin/comparest $out/comparest
77+ chmod 755 $out/comparest
78+ dylibbundler -b \
79+ -x $out/comparest \
80+ -d $out/lib \
81+ -p '@executable_path/lib'
82+ '';
83+
84+
59 compaRESTGithubAction =
85 compaRESTGithubAction =
60 let
86 let
61 action = staticify "compaREST-github-action-static" hsPkgs.projectCross.musl64.hsPkgs.comparest.components.exes.comparest-github-action;
87 action = staticify "compaREST-github-action-static" hsPkgs.projectCross.musl64.hsPkgs.comparest.components.exes.comparest-github-action;
@@ -70,5 +96,16 @@ let
70 contents = [ wrapped pkgs.cacert ];
96 contents = [ wrapped pkgs.cacert ];
71 };
97 };
72
98
99+ WindowsCompaRESTBin = hsPkgs.projectCross.mingwW64.hsPkgs.comparest.components.exes.comparest;
73in
100in
101+{
102+ inherit compaRESTImage
74−{ inherit compaREST compaRESTGithubAction hsPkgs haskellNix compaRESTBin; }
103+ compaRESTGithubAction
104+ compaRESTStaticBin
105+ compaRESTBin
106+ hsPkgs
107+ macOSCompaRESTBundle
108+ WindowsCompaRESTBin
109+ ;
110+ test = hsPkgs.comparest.components.tests.comparest-tests;
111+}
nix/sources.json+15−3
@@ -5,10 +5,10 @@
5 "homepage": "https://input-output-hk.github.io/haskell.nix",
5 "homepage": "https://input-output-hk.github.io/haskell.nix",
6 "owner": "input-output-hk",
6 "owner": "input-output-hk",
7 "repo": "haskell.nix",
7 "repo": "haskell.nix",
8− "rev": "7ef531c33ed7e41ff51f75cd57eea74536a61a31",
8+ "rev": "c8a8f57de3c14fcf1c5cda045ed885fb6d06a00e",
9− "sha256": "1yi713jh8vq48p8vsrzdk9n1f5pwsm8nridr172fm7b1vssk9w1n",
9+ "sha256": "0frzmvz8rhb4vgx20qms9xxqbkmg5pwivis4qis63ny5wxclzb34",
10 "type": "tarball",
10 "type": "tarball",
11− "url": "https://github.com/input-output-hk/haskell.nix/archive/7ef531c33ed7e41ff51f75cd57eea74536a61a31.tar.gz",
11+ "url": "https://github.com/input-output-hk/haskell.nix/archive/c8a8f57de3c14fcf1c5cda045ed885fb6d06a00e.tar.gz",
12 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
12 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13 },
13 },
14 "niv": {
14 "niv": {
@@ -34,5 +34,17 @@
34 "type": "tarball",
34 "type": "tarball",
35 "url": "https://github.com/numtide/nix-filter/archive/3c9e33ed627e009428197b07216613206f06ed80.tar.gz",
35 "url": "https://github.com/numtide/nix-filter/archive/3c9e33ed627e009428197b07216613206f06ed80.tar.gz",
36 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
36 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
37+ },
38+ "nixpkgs": {
39+ "branch": "master",
40+ "description": "Nix Packages collection",
41+ "homepage": "",
42+ "owner": "NixOS",
43+ "repo": "nixpkgs",
44+ "rev": "f0fe5e9ba08e658474476317717aca7acacef4d4",
45+ "sha256": "1n5syynwmg3x8lj2kyb2ilbxw5nmw7f2kw6yxsi8qadx91hrvkwm",
46+ "type": "tarball",
47+ "url": "https://github.com/NixOS/nixpkgs/archive/f0fe5e9ba08e658474476317717aca7acacef4d4.tar.gz",
48+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
37 }
49 }
38}
50}
stack.yaml+4−8
@@ -1,4 +1,7 @@
1−resolver: lts-18.18
1+resolver: lts-18.16
2+
3+packages:
4+ - .
2
5
3extra-deps:
6extra-deps:
4 - open-union-0.4.0.0
7 - open-union-0.4.0.0
@@ -6,10 +9,3 @@ extra-deps:
6 - github-0.26
9 - github-0.26
7 - base16-bytestring-0.1.1.7
10 - base16-bytestring-0.1.1.7
8 - http-link-header-1.0.3.1
11 - http-link-header-1.0.3.1
9−
10−apply-ghc-options: everything
11−rebuild-ghc-options: true
12−
13−ghc-options:
14− "$everything": -O2 -fexpose-all-unfoldings -fspecialise-aggressively
15− "pandoc": -O2 -fno-expose-all-unfoldings -fno-specialise-aggressively
stack.yaml.lock+4−4
@@ -41,7 +41,7 @@ packages:
41 hackage: http-link-header-1.0.3.1
41 hackage: http-link-header-1.0.3.1
42snapshots:
42snapshots:
43- completed:
43- completed:
44− size: 586296
44+ size: 586286
45− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/18.yaml
45+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/16.yaml
46− sha256: 63539429076b7ebbab6daa7656cfb079393bf644971156dc349d7c0453694ac2
46+ sha256: cdead65fca0323144b346c94286186f4969bf85594d649c49c7557295675d8a5
47− original: lts-18.18
47+ original: lts-18.16