@@ -5,52 +5,168 @@ on:
55 branches: [master]
66 pull_request:
77 branches: [master]
8+ release:
9+ types: [prereleased]
810
911jobs:
10− build-github-action-image:
12+ Linux:
1113 runs-on: ubuntu-latest
12−
1314 steps:
1415 - uses: actions/checkout@v2
1516 with:
1617 submodules: recursive
17− - name: Increase swap
18+
19+ - name: Common setup
20+ uses: ./.github/actions/common_setup
21+ with:
22+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
23+
24+ - name: Test
25+ shell: bash
1826 run: |
19− free -h
27+ $(nix-build -A test -j auto --no-out-link)/bin/compaREST-tests
2028
21− sudo swapoff /mnt/swapfile
22− sudo fallocate -l 12G /mnt/swapfile
23− sudo mkswap /mnt/swapfile
24− sudo swapon /mnt/swapfile
29+ - name: Build Linux static binary
30+ shell: bash
31+ run: |
32+ cp $(nix-build -A compaRESTStaticBin -j auto --no-out-link)/bin/compaREST compaREST
2533
26− free -h
34+ - name: Upload compaREST Linux Binary
35+ uses: actions/upload-artifact@v2
36+ with:
37+ name: compaREST-Linux
38+ path: compaREST
2739
28− - name: Install Nix
29− uses: cachix/install-nix-action@v12
40+ - name: Build Docker Images
41+ shell: bash
42+ run: |
43+ cp $(nix-build -A compaRESTGithubAction -j auto --no-out-link) compaREST-Github-Action-image.tar.gz
44+ cp $(nix-build -A compaRESTImage -j auto --no-out-link) compaREST-image.tar.gz
45+
46+ - name: Upload compaREST Docker Github Action Image
47+ uses: actions/upload-artifact@v2
3048 with:
31− extra_nix_config: |
32− trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
33− substituters = https://hydra.iohk.io https://cache.nixos.org/
49+ name: compaREST Github Action Docker Image
50+ path: compaREST-Github-Action-image.tar.gz
3451
35− - name: Login to Cachix
36− uses: cachix/cachix-action@v8
52+ - name: Upload compaREST Docker Image
53+ uses: actions/upload-artifact@v2
3754 with:
38− name: octopod
39− signingKey: ${{ secrets.CACHIX_SIGNING_KEY }}
55+ name: compaREST Docker Image
56+ path: compaREST-image.tar.gz
4057
41− - name: Build Github Action Docker Image
58+ - name: Install skopeo
59+ if: github.event_name == 'release'
60+ shell: bash
4261 run: |
43− nix-build -A compaRESTGithubAction -j auto -o image
62+ sudo apt-get -y update
63+ sudo apt-get -y install skopeo
4464
45− - name: Log into Docker Hub
46− if: github.ref == 'refs/heads/master'
47− uses: docker/login-action@v1
65+ - name: Login to DockerHub
66+ uses: docker/login-action@v1.10.0
4867 with:
4968 username: ${{ secrets.DOCKER_HUB_USERNAME }}
5069 password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
5170
52− - name: Upload Image to Docker Hub
53− if: github.ref == 'refs/heads/master'
71+ - name: Push Nightly Docker Images to DockerHub
72+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
73+ shell: bash
5474 run: |
55− docker load -i image
56− docker push typeable/comparest-github-action:latest
75+ skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto --no-out-link) docker://typeable/comparest-github-action:nightly
76+ skopeo copy docker-archive:$(nix-build -A compaRESTImage -j auto --no-out-link) docker://typeable/comparest:nightly
77+
78+ - name: Push Release Docker Images to DockerHub
79+ if: github.event_name == 'release'
80+ shell: bash
81+ run: |
82+ skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto --no-out-link) docker://typeable/comparest-github-action:${{ github.event.release.tag_name }}
83+ skopeo copy docker-archive:$(nix-build -A compaRESTImage -j auto --no-out-link) docker://typeable/comparest:${{ github.event.release.tag_name }}
84+
85+ - name: Upload compaREST Github Action Docker Image to release
86+ if: github.event_name == 'release'
87+ uses: svenstaro/upload-release-action@2.2.1
88+ with:
89+ repo_token: ${{ secrets.GITHUB_TOKEN }}
90+ file: compaREST-Github-Action-image.tar.gz
91+ asset_name: compaREST Github Action Docker Image
92+ tag: ${{ github.ref }}
93+
94+ - name: Upload compaREST Docker Image to release
95+ if: github.event_name == 'release'
96+ uses: svenstaro/upload-release-action@2.2.1
97+ with:
98+ repo_token: ${{ secrets.GITHUB_TOKEN }}
99+ file: compaREST-image.tar.gz
100+ asset_name: compaREST Docker Image
101+ tag: ${{ github.ref }}
102+
103+ - name: Upload compaREST binary – Linux – x86 to release
104+ if: github.event_name == 'release'
105+ uses: svenstaro/upload-release-action@2.2.1
106+ with:
107+ repo_token: ${{ secrets.GITHUB_TOKEN }}
108+ file: compaREST
109+ asset_name: compaREST binary – Linux – x86
110+ tag: ${{ github.ref }}
111+
112+ macOS:
113+ runs-on: macos-latest
114+ steps:
115+ - uses: actions/checkout@v2
116+ with:
117+ submodules: recursive
118+
119+ - name: Common setup
120+ uses: ./.github/actions/common_setup
121+ with:
122+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
123+
124+ - name: Build macOS binary bundle
125+ run: |
126+ cp -LR $(nix-build -A macOSCompaRESTBundle -j auto --no-out-link) compaREST
127+
128+ - name: Upload macOS compaREST bundle
129+ uses: actions/upload-artifact@v2
130+ with:
131+ name: compaREST binary – macOS – x86
132+ path: compaREST
133+
134+ - name: Upload compaREST binary – macOS – x86 to release
135+ if: github.event_name == 'release'
136+ uses: svenstaro/upload-release-action@2.2.1
137+ with:
138+ repo_token: ${{ secrets.GITHUB_TOKEN }}
139+ file: compaREST
140+ asset_name: compaREST binary – macOS – x86
141+ tag: ${{ github.ref }}
142+
143+ Linux-Windows:
144+ runs-on: ubuntu-latest
145+ steps:
146+ - uses: actions/checkout@v2
147+ with:
148+ submodules: recursive
149+
150+ - name: Common setup
151+ uses: ./.github/actions/common_setup
152+ with:
153+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
154+
155+ - name: Build Windows binary
156+ run: |
157+ cp -LR $(nix-build -A WindowsCompaRESTBin -j auto --no-out-link)/bin compaREST
158+
159+ - name: Upload Windows compaREST bundle
160+ uses: actions/upload-artifact@v2
161+ with:
162+ name: compaREST binary – Windows
163+ path: compaREST
164+
165+ - name: Upload compaREST binary – Windows to release
166+ if: github.event_name == 'release'
167+ uses: svenstaro/upload-release-action@2.2.1
168+ with:
169+ repo_token: ${{ secrets.GITHUB_TOKEN }}
170+ file: compaREST
171+ asset_name: compaREST binary – Windows
172+ tag: ${{ github.ref }}