-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (127 loc) · 4.57 KB
/
dev.yml
File metadata and controls
147 lines (127 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: test-release
# Simplified test workflow: builds per-arch Docker images (GHCR + Docker Hub org),
# packages Linux and macOS artifacts, and creates multi-arch manifests – only for tag 'test'.
on:
push:
tags:
- test
permissions: {}
env:
CARGO_TERM_COLOR: always
RELEASE_BIN: mira-oxide
REGISTRY: ghcr.io
DOCKERHUB_ORG: cdcgov
jobs:
build-release-image-and-linux-artifacts:
name: Build Linux Artifacts and Images
strategy:
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
- arch: aarch64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}
docker.io/${{ env.DOCKERHUB_ORG }}/mira-oxide
tags: |
type=raw,value=test-${{ matrix.arch }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: Dockerfile
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
- name: Prepare Linux Binary
shell: bash
run: |
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | grep -- '-${{ matrix.arch }}$' | head -n 1)
docker create --name temp-container $IMAGE_TAG \
&& docker cp temp-container:/app/${RELEASE_BIN} ./${RELEASE_BIN} \
&& docker rm temp-container
tar -czf ${RELEASE_BIN}-linux-${{ matrix.arch }}-test.tar.gz ${RELEASE_BIN}
- name: Upload Linux Test Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_BIN }}-linux-${{ matrix.arch }}-test
path: ${{ env.RELEASE_BIN }}-linux-${{ matrix.arch }}-test.tar.gz
create-image-manifest:
name: Create Image Manifest
needs: build-release-image-and-linux-artifacts
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create and push test manifests
shell: bash
run: |
REPO=$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr '[A-Z]' '[a-z]')
TEST=${REPO}:test
docker manifest create $TEST --amend ${TEST}-x86_64 --amend ${TEST}-aarch64
docker manifest push $TEST
DH_REPO="docker.io/${{ env.DOCKERHUB_ORG }}/mira-oxide"
DH_TEST=${DH_REPO}:test
docker manifest create $DH_TEST --amend ${DH_TEST}-x86_64 --amend ${DH_TEST}-aarch64
docker manifest push $DH_TEST
build-mac-artifacts:
name: Build Mac Artifacts
runs-on: macos-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Install latest nightly Rust
run: |
# Nightly toolchain installation; replace with stable if not using nightly-only features.
rustup update nightly
rustup default nightly
rustup target add aarch64-apple-darwin x86_64-apple-darwin
- name: Build (both archs)
run: |
cargo build --release --target aarch64-apple-darwin --target x86_64-apple-darwin
- name: Create universal binary
shell: bash
run: |
lipo -create -output ${RELEASE_BIN} \
target/aarch64-apple-darwin/release/${RELEASE_BIN} \
target/x86_64-apple-darwin/release/${RELEASE_BIN}
tar -czf ${RELEASE_BIN}-apple-universal-test.tar.gz ${RELEASE_BIN}
- name: Upload Mac Test Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_BIN }}-apple-universal-test
path: ${{ env.RELEASE_BIN }}-apple-universal-test.tar.gz