|
8 | 8 | test: |
9 | 9 | name: Test |
10 | 10 | runs-on: ubuntu-20.04 |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + target: |
| 14 | + - x86_64-unknown-linux-musl |
| 15 | + - aarch64-unknown-linux-musl |
11 | 16 | steps: |
12 | 17 | - uses: actions/checkout@v2 |
13 | 18 | - run: sudo apt-get install -y musl-tools busybox-static |
| 19 | + - run: sudo apt-get install -y gcc-aarch64-linux-gnu |
| 20 | + if: matrix.target == 'aarch64-unknown-linux-musl' |
| 21 | + - run: rustup target add ${{ matrix.target }} |
14 | 22 | - uses: actions/cache@v2 |
15 | 23 | with: |
16 | 24 | path: | |
17 | 25 | target/ |
18 | 26 | ~/.cargo/git/db/ |
19 | 27 | ~/.cargo/registry/cache/ |
20 | 28 | ~/.cargo/registry/index/ |
21 | | - key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}" |
| 29 | + key: "${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}" |
22 | 30 | - uses: actions-rs/cargo@v1 |
23 | 31 | with: |
24 | 32 | command: build |
25 | | - args: --release --all-features --target=x86_64-unknown-linux-musl |
| 33 | + args: --release --all-features --target=${{ matrix.target }} |
| 34 | + - uses: actions/upload-artifact@v2 |
| 35 | + with: |
| 36 | + name: musl-executable-${{ matrix.target }} |
| 37 | + path: ./target/${{ matrix.target }}/release/magicpak |
26 | 38 | - uses: actions-rs/cargo@v1 |
27 | 39 | with: |
28 | 40 | command: test |
29 | | - args: --release --all-features --target=x86_64-unknown-linux-musl |
30 | | - - uses: actions/upload-artifact@v2 |
31 | | - with: |
32 | | - name: musl-executable |
33 | | - path: ./target/x86_64-unknown-linux-musl/release/magicpak |
| 41 | + args: --release --all-features --target=${{ matrix.target }} |
| 42 | + if: matrix.target == 'x86_64-unknown-linux-musl' # TODO: test aarch64 |
34 | 43 | build_docker_images: |
35 | 44 | name: Build and push docker images |
36 | 45 | runs-on: ubuntu-20.04 |
37 | 46 | needs: test |
38 | 47 | steps: |
| 48 | + - name: Free up disk space |
| 49 | + run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android |
39 | 50 | - uses: actions/checkout@v2 |
40 | 51 | - uses: actions/download-artifact@v2 |
41 | 52 | with: |
42 | | - name: musl-executable |
| 53 | + name: musl-executable-x86_64-unknown-linux-musl |
| 54 | + - run: mkdir -p dist/amd64 && mv ./magicpak ./dist/amd64/magicpak |
| 55 | + - uses: actions/download-artifact@v2 |
| 56 | + with: |
| 57 | + name: musl-executable-aarch64-unknown-linux-musl |
| 58 | + - run: mkdir -p dist/arm64 && mv ./magicpak ./dist/arm64/magicpak |
| 59 | + - uses: docker/setup-qemu-action@v2 |
| 60 | + with: |
| 61 | + platforms: arm64 |
43 | 62 | - run: docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }} |
44 | 63 | - uses: docker/setup-buildx-action@v1 |
45 | | - - run: ./dockerfile/build.sh ./magicpak |
| 64 | + - run: docker buildx bake --push --set '*.cache-from=type=gha' --set '*.cache-to=type=gha,mode=max' |
46 | 65 | env: |
47 | | - PUSH_IMAGES: true |
48 | | - DOCKER_BUILD: "docker buildx build --load --cache-from type=gha --cache-to type=gha,mode=max" |
| 66 | + BIN_DIR: "./dist" |
| 67 | + VERSION: "1.3.1" |
49 | 68 | release: |
50 | 69 | name: Release |
51 | 70 | runs-on: ubuntu-20.04 |
52 | 71 | needs: build_docker_images |
| 72 | + strategy: |
| 73 | + matrix: |
| 74 | + target: |
| 75 | + - x86_64-unknown-linux-musl |
| 76 | + - aarch64-unknown-linux-musl |
53 | 77 | steps: |
54 | 78 | - uses: actions/download-artifact@v2 |
55 | 79 | with: |
56 | | - name: musl-executable |
57 | | - - run: mv magicpak magicpak-x86_64-unknown-linux-musl |
| 80 | + name: musl-executable-${{ matrix.target }} |
| 81 | + - run: mv magicpak magicpak-${{ matrix.target }} |
58 | 82 | - uses: softprops/action-gh-release@v1 |
59 | 83 | with: |
60 | 84 | files: magicpak-* |
|
0 commit comments