on master help sign in
wip
commit4b2d274af266a8596a73414af2314488b1552a14 authoriko <ilyakooo0@gmail.com> dateMon 20 Dec 2021, 20:21 (5 years ago) parent705d026
7 files changed+158−110
.github/actions/common_setup/action.yaml+5−23 .github/actions/push_docker_images/action.yaml+1−7 .github/workflows/github-actions-image.yaml+87−60 default.nix+42−5 nix/sources.json+15−3 stack.yaml+4−8 stack.yaml.lock+4−4
.github/actions/common_setup/action.yaml+5−23
@@ -7,24 +7,6 @@ inputs:
77runs:
88 using: "composite"
99 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−
2810 - name: Install Nix
2911 uses: cachix/install-nix-action@v16
3012 with:
@@ -33,8 +15,8 @@ runs:
3315 trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
3416 substituters = https://hydra.iohk.io https://cache.nixos.org/
3517
36− - name: Login to Cachix
37− uses: cachix/cachix-action@v10
38− with:
39− name: octopod
40− signingKey: ${{ inputs.cachixSigningKey }}
18+ # - name: Login to Cachix
19+ # uses: cachix/cachix-action@v10
20+ # with:
21+ # name: octopod
22+ # signingKey: ${{ inputs.cachixSigningKey }}
.github/actions/push_docker_images/action.yaml+1−7
@@ -13,14 +13,8 @@ inputs:
1313runs:
1414 using: "composite"
1515 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−
2216 - name: Push Docker Images to DockerHub
2317 shell: bash
2418 run: |
2519 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:
55 branches: [master]
66 pull_request:
77 branches: [master]
8− workflow_dispatch:
9− inputs:
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
8+ release:
9+ types: [prereleased]
1710
1811jobs:
19− build-github-action-image:
12+ Linux:
2013 runs-on: ubuntu-latest
21−
2214 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+
2327 - uses: actions/checkout@v2
2428 with:
2529 submodules: recursive
2630
2731 - name: Common setup
2832 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
2940 with:
30− cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
41+ name: compaREST-Linux
42+ path: compaREST
3143
3244 - name: Build Github Action Docker Image
3345 run: |
3446 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
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
47+ cp $(nix-build -A compaRESTImage-j auto) compaREST-image.tar.gz
4148
4249 - name: Upload compaREST Github Action Image
4350 uses: actions/upload-artifact@v2
@@ -51,60 +58,80 @@ jobs:
5158 name: compaREST-image
5259 path: compaREST-image.tar.gz
5360
54− - name: Upload compaREST Linux Binary
55− uses: actions/upload-artifact@v2
56− with:
57− name: compaREST-linux
58− path: compaREST-binary/compaREST
61+ - name: Install skopeo
62+ shell: bash
63+ run: |
64+ sudo apt-get -y update
65+ sudo apt-get -y install skopeo
5966
60− - name: Push Nightly Docker Images to DockerHub
61− if: github.ref == 'refs/heads/master' && github.event_name == 'push'
62− uses: ./.github/actions/push_docker_images
67+ - name: Login to DockerHub
68+ if: github.event_name == 'release'
69+ uses: docker/login-action@v1.10.0
6370 with:
64− tag: nightly
65− docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
66− docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
71+ username: ${{ secrets.DOCKERHUB_USERNAME }}
72+ password: ${{ secrets.DOCKERHUB_TOKEN }}
6773
68− release:
69− name: Release
70− if: github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true'
71− needs: [build-github-action-image]
72− runs-on: "ubuntu-latest"
74+ - name: Push Docker Images to DockerHub
75+ if: github.event_name == 'release'
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:
82+ runs-on: ubuntu-latest
7383 steps:
7484 - uses: actions/checkout@v2
85+ with:
86+ submodules: recursive
87+
7588 - name: Common setup
7689 uses: ./.github/actions/common_setup
77− with:
78− cachixSigningKey: ${{ secrets.CACHIX_SIGNING_KEY }}
7990
80− - name: Push Docker Release Images to DockerHub
81− uses: ./.github/actions/push_docker_images
91+ - name: Build macOS binary bundle
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
8297 with:
83− tag: ${{ github.event.inputs.version }}
84− docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
85− docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
98+ name: compaREST-macOS
99+ path: compaREST
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
86113
87− - name: Push Docker latest Images to DockerHub
88− uses: ./.github/actions/push_docker_images
114+ free -h
115+
116+ - uses: actions/checkout@v2
89117 with:
90− tag: latest
91− docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
92− docker_password: ${{ secrets.DOCKERHUB_TOKEN }}
118+ submodules: recursive
119+
120+ - name: Common setup
121+ uses: ./.github/actions/common_setup
93122
94− - uses: actions/download-artifact@v2
95− - name: Zip and move
123+ - name: Build Windows binary
96124 run: |
97− chmod +x compaREST-linux/compaREST
98− zip compaREST-linux compaREST-linux/compaREST
125+ cp -LR $(nix-build -A WindowsCompaRESTBin -j auto)/bin compaREST
99126
100− mv compaREST-Github-Action-image/* .
101− mv compaREST-image/* .
102− - uses: "marvinpinto/action-automatic-releases@latest"
127+ - name: Upload compaREST Linux Binary
128+ uses: actions/upload-artifact@v2
129+ with:
130+ name: compaREST-Windows
131+ path: compaREST
132+
133+ - name: Upload Windows compaREST bundle
134+ uses: actions/upload-artifact@v2
103135 with:
104− repo_token: "${{ secrets.GITHUB_TOKEN }}"
105− automatic_release_tag: "latest"
106− prerelease: false
107− title: "${{ github.event.inputs.version }}"
108− files: |
109− *.zip
110− *.tar.gz
136+ name: compaREST-Windows
137+ path: compaREST
default.nix+42−5
@@ -5,6 +5,8 @@
55, nix-filter ? import sources.nix-filter
66}:
77let
8+ masterPkgs = import sources.nixpkgs { inherit system; };
9+
810 hsPkgs = pkgs.haskell-nix.stackProject {
911 src = nix-filter {
1012 root = ./.;
@@ -21,7 +23,12 @@ let
2123 dontStrip = false;
2224 dontPatchELF = false;
2325 enableDeadCodeElimination = true;
24− ghcOptions = [ "-O2" ];
26+ ghcOptions = [
27+ "-O2"
28+ "-fexpose-all-unfoldings"
29+ "-fspecialise-aggressively"
30+ ];
31+ packages.pandoc.ghcOptions = [ "-O1" ];
2532 packages.comparest.src = nix-filter {
2633 root = ./.;
2734 name = "compaREST-src";
@@ -46,16 +53,35 @@ let
4653 ${pkgs.nukeReferences}/bin/nuke-refs $out/bin/*
4754 '';
4855
49− compaRESTBin = hsPkgs.projectCross.musl64.hsPkgs.comparest.components.exes.comparest;
56+ compaRESTBin = 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;
5062
51− compaREST = pkgs.dockerTools.buildImage {
63+ compaRESTImage = pkgs.dockerTools.buildImage {
5264 name = "compaREST";
53− contents = [ (staticify "compaREST-static" compaRESTBin) ];
65+ contents = [ compaRESTStaticBin ];
5466 config = {
5567 Entrypoint = [ "/bin/comparest" ];
5668 };
5769 };
5870
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+
5985 compaRESTGithubAction =
6086 let
6187 action = staticify "compaREST-github-action-static" hsPkgs.projectCross.musl64.hsPkgs.comparest.components.exes.comparest-github-action;
@@ -70,5 +96,16 @@ let
7096 contents = [ wrapped pkgs.cacert ];
7197 };
7298
99+ WindowsCompaRESTBin = hsPkgs.projectCross.mingwW64.hsPkgs.comparest.components.exes.comparest;
73100in
74−{ inherit compaREST compaRESTGithubAction hsPkgs haskellNix compaRESTBin; }
101+{
102+ inherit compaRESTImage
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 @@
55 "homepage": "https://input-output-hk.github.io/haskell.nix",
66 "owner": "input-output-hk",
77 "repo": "haskell.nix",
8− "rev": "7ef531c33ed7e41ff51f75cd57eea74536a61a31",
9− "sha256": "1yi713jh8vq48p8vsrzdk9n1f5pwsm8nridr172fm7b1vssk9w1n",
8+ "rev": "c8a8f57de3c14fcf1c5cda045ed885fb6d06a00e",
9+ "sha256": "0frzmvz8rhb4vgx20qms9xxqbkmg5pwivis4qis63ny5wxclzb34",
1010 "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",
1212 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313 },
1414 "niv": {
@@ -34,5 +34,17 @@
3434 "type": "tarball",
3535 "url": "https://github.com/numtide/nix-filter/archive/3c9e33ed627e009428197b07216613206f06ed80.tar.gz",
3636 "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"
3749 }
3850}
stack.yaml+4−8
@@ -1,4 +1,7 @@
1−resolver: lts-18.18
1+resolver: lts-18.16
2+
3+packages:
4+ - .
25
36extra-deps:
47 - open-union-0.4.0.0
@@ -6,10 +9,3 @@ extra-deps:
69 - github-0.26
710 - base16-bytestring-0.1.1.7
811 - 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:
4141 hackage: http-link-header-1.0.3.1
4242snapshots:
4343- completed:
44− size: 586296
45− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/18.yaml
46− sha256: 63539429076b7ebbab6daa7656cfb079393bf644971156dc349d7c0453694ac2
47− original: lts-18.18
44+ size: 586286
45+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/16.yaml
46+ sha256: cdead65fca0323144b346c94286186f4969bf85594d649c49c7557295675d8a5
47+ original: lts-18.16