@@ -5,52 +5,168 @@ on:
5 branches: [master]
5 branches: [master]
6 pull_request:
6 pull_request:
7 branches: [master]
7 branches: [master]
10− build-github-action-image:
12+ Linux:
11 runs-on: ubuntu-latest
13 runs-on: ubuntu-latest
14 - uses: actions/checkout@v2
15 - uses: actions/checkout@v2
16 submodules: recursive
17 submodules: recursive
17− - name: Increase swap
18+
20+ uses: ./.github/actions/common_setup
22+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
19− free -h
27+ $(nix-build -A test -j auto --no-out-link)/bin/compaREST-tests
21− sudo swapoff /mnt/swapfile
29+ - name: Build Linux static binary
22− sudo fallocate -l 12G /mnt/swapfile
30+ shell: bash
23− sudo mkswap /mnt/swapfile
31+ run: |
24− sudo swapon /mnt/swapfile
32+ cp $(nix-build -A compaRESTStaticBin -j auto --no-out-link)/bin/compaREST compaREST
26− free -h
34+ - name: Upload compaREST Linux Binary
35+ uses: actions/upload-artifact@v2
37+ name: compaREST-Linux
28− - name: Install Nix
40+ - name: Build Docker Images
29− uses: cachix/install-nix-action@v12
41+ shell: bash
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
46+ - name: Upload compaREST Docker Github Action Image
47+ uses: actions/upload-artifact@v2
31− extra_nix_config: |
49+ name: compaREST Github Action Docker Image
32− trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
50+ path: compaREST-Github-Action-image.tar.gz
33− substituters = https://hydra.iohk.io https://cache.nixos.org/
35− - name: Login to Cachix
52+ - name: Upload compaREST Docker Image
36− uses: cachix/cachix-action@v8
53+ uses: actions/upload-artifact@v2
38− name: octopod
55+ name: compaREST Docker Image
39− signingKey: ${{ secrets.CACHIX_SIGNING_KEY }}
56+ path: compaREST-image.tar.gz
41− - name: Build Github Action Docker Image
58+ - name: Install skopeo
59+ if: github.event_name == 'release'
43− nix-build -A compaRESTGithubAction -j auto -o image
62+ sudo apt-get -y update
63+ sudo apt-get -y install skopeo
45− - name: Log into Docker Hub
65+ - name: Login to DockerHub
46− if: github.ref == 'refs/heads/master'
47− uses: docker/login-action@v1
66+ uses: docker/login-action@v1.10.0
49 username: ${{ secrets.DOCKER_HUB_USERNAME }}
68 username: ${{ secrets.DOCKER_HUB_USERNAME }}
50 password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
69 password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
52− - name: Upload Image to Docker Hub
71+ - name: Push Nightly Docker Images to DockerHub
53− if: github.ref == 'refs/heads/master'
72+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
55− docker load -i image
75+ skopeo copy docker-archive:$(nix-build -A compaRESTGithubAction -j auto --no-out-link) docker://typeable/comparest-github-action:nightly
56− docker push typeable/comparest-github-action:latest
76+ skopeo copy docker-archive:$(nix-build -A compaRESTImage -j auto --no-out-link) docker://typeable/comparest:nightly
78+ - name: Push Release Docker Images to DockerHub
79+ if: github.event_name == 'release'
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 }}
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
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 }}
94+ - name: Upload compaREST Docker Image to release
95+ if: github.event_name == 'release'
96+ uses: svenstaro/upload-release-action@2.2.1
98+ repo_token: ${{ secrets.GITHUB_TOKEN }}
99+ file: compaREST-image.tar.gz
100+ asset_name: compaREST Docker Image
101+ tag: ${{ github.ref }}
103+ - name: Upload compaREST binary – Linux – x86 to release
104+ if: github.event_name == 'release'
105+ uses: svenstaro/upload-release-action@2.2.1
107+ repo_token: ${{ secrets.GITHUB_TOKEN }}
109+ asset_name: compaREST binary – Linux – x86
110+ tag: ${{ github.ref }}
113+ runs-on: macos-latest
115+ - uses: actions/checkout@v2
117+ submodules: recursive
119+ - name: Common setup
120+ uses: ./.github/actions/common_setup
122+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
124+ - name: Build macOS binary bundle
126+ cp -LR $(nix-build -A macOSCompaRESTBundle -j auto --no-out-link) compaREST
128+ - name: Upload macOS compaREST bundle
129+ uses: actions/upload-artifact@v2
131+ name: compaREST binary – macOS – x86
134+ - name: Upload compaREST binary – macOS – x86 to release
135+ if: github.event_name == 'release'
136+ uses: svenstaro/upload-release-action@2.2.1
138+ repo_token: ${{ secrets.GITHUB_TOKEN }}
140+ asset_name: compaREST binary – macOS – x86
141+ tag: ${{ github.ref }}
144+ runs-on: ubuntu-latest
146+ - uses: actions/checkout@v2
148+ submodules: recursive
150+ - name: Common setup
151+ uses: ./.github/actions/common_setup
153+ authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
155+ - name: Build Windows binary
157+ cp -LR $(nix-build -A WindowsCompaRESTBin -j auto --no-out-link)/bin compaREST
159+ - name: Upload Windows compaREST bundle
160+ uses: actions/upload-artifact@v2
162+ name: compaREST binary – Windows
165+ - name: Upload compaREST binary – Windows to release
166+ if: github.event_name == 'release'
167+ uses: svenstaro/upload-release-action@2.2.1
169+ repo_token: ${{ secrets.GITHUB_TOKEN }}
171+ asset_name: compaREST binary – Windows
172+ tag: ${{ github.ref }}