Skip to content

Commit 4e0e9a3

Browse files
committed
first commit
0 parents  commit 4e0e9a3

File tree

4 files changed

+207
-0
lines changed

4 files changed

+207
-0
lines changed

.github/workflows/release.yml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: release
2+
3+
env:
4+
PROJECT_NAME: qdl
5+
REPO_NAME: linux-msm/qdl
6+
REPO_REF: 672abb1e81cc630640f2a88e42b6dfd2a429ad14
7+
DIST_DIR: dist
8+
ARTIFACT_NAME: dist
9+
10+
on:
11+
push:
12+
tags:
13+
- '*.*.*'
14+
15+
jobs:
16+
build:
17+
name: build (${{ matrix.config.os }}, ${{ matrix.config.arch }})
18+
runs-on:
19+
ubuntu-latest
20+
permissions:
21+
contents: read
22+
strategy:
23+
matrix:
24+
config:
25+
- os: Linux
26+
arch: 64bit
27+
cross_compile: x86_64-ubuntu16.04-linux-gnu
28+
- os: Linux
29+
arch: 32bit
30+
cross_compile: i686-ubuntu16.04-linux-gnu
31+
- os: Linux
32+
arch: ARMv6
33+
cross_compile: arm-linux-gnueabihf
34+
- os: Linux
35+
arch: ARM64
36+
cross_compile: aarch64-linux-gnu
37+
- os: macOS
38+
arch: 64bit
39+
cross_compile: x86_64-apple-darwin13
40+
- os: Windows
41+
arch: 32bit
42+
cross_compile: i686-w64-mingw32
43+
extension: .exe
44+
45+
container:
46+
image: ghcr.io/arduino/crossbuild:0.3.0-pre.1
47+
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
with:
52+
path: packing
53+
54+
- name: Checkout linux-msm/qdl repository
55+
uses: actions/checkout@v4
56+
with:
57+
repository: ${{ env.REPO_NAME }}
58+
ref: ${{ env.REPO_REF }}
59+
path: ${{ env.PROJECT_NAME }}
60+
61+
- name: Apply patches
62+
working-directory: ${{ env.PROJECT_NAME }}
63+
run: git apply -v ../packing/patches/*.patch
64+
65+
- name: Build
66+
working-directory: ${{ env.PROJECT_NAME }}
67+
run: /configure_toolchain.sh make -j$(nproc)
68+
env:
69+
CROSS_COMPILE: ${{ matrix.config.cross_compile }}
70+
71+
- name: Package
72+
working-directory: ${{ env.PROJECT_NAME }}
73+
run: |
74+
tar -czvf ../${{ env.PROJECT_NAME }}_${{ github.ref_name }}_${{ matrix.config.os }}_${{ matrix.config.arch }}.tar.gz \
75+
qdl${{ matrix.config.extension }}
76+
77+
- name: Upload artifacts
78+
uses: actions/upload-artifact@v4
79+
with:
80+
if-no-files-found: error
81+
name: ${{ env.ARTIFACT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}
82+
path: ${{ env.PROJECT_NAME }}_${{ github.ref_name }}_${{ matrix.config.os }}_${{ matrix.config.arch }}.tar.gz
83+
84+
sign-and-notarize-macos:
85+
name: sign and notarize (macOS, 64bit)
86+
runs-on: macos-latest
87+
needs: build
88+
permissions:
89+
contents: read
90+
91+
steps:
92+
- name: Checkout repository
93+
uses: actions/checkout@v4
94+
95+
- name: Set up temporary directory for notarization
96+
run: mkdir -p ${{ env.DIST_DIR }}/notarize_temp
97+
98+
- name: Download macOS artifact
99+
uses: actions/download-artifact@v4
100+
with:
101+
name: ${{ env.ARTIFACT_NAME }}_macOS_64bit
102+
path: ${{ env.DIST_DIR }}/notarize_temp
103+
104+
- name: Extract macOS binary
105+
working-directory: ${{ env.DIST_DIR }}/notarize_temp
106+
run: tar -xzvf ${{ env.PROJECT_NAME }}_${{ github.ref_name }}_macOS_64bit.tar.gz
107+
108+
- name: Import Code-Signing Certificates
109+
env:
110+
KEYCHAIN: "build.keychain"
111+
INSTALLER_CERT_MAC_PATH: "/tmp/signing_cert.p12"
112+
KEYCHAIN_PASSWORD: "keychainpassword" # Arbitrary, as it's temporary
113+
run: |
114+
echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}"
115+
security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
116+
security default-keychain -s "${{ env.KEYCHAIN }}"
117+
security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}"
118+
security import \
119+
"${{ env.INSTALLER_CERT_MAC_PATH }}" \
120+
-k "${{ env.KEYCHAIN }}" \
121+
-f pkcs12 \
122+
-A \
123+
-T "/usr/bin/codesign" \
124+
-P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}"
125+
security set-key-partition-list \
126+
-S apple-tool:,apple: \
127+
-s \
128+
-k "${{ env.KEYCHAIN_PASSWORD }}" \
129+
"${{ env.KEYCHAIN }}"
130+
131+
- name: Install gon for code signing and app notarization
132+
run: |
133+
wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip
134+
unzip -q gon_macos.zip -d /usr/local/bin
135+
136+
- name: Sign and notarize binary
137+
env:
138+
AC_USERNAME: ${{ secrets.AC_USERNAME }}
139+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
140+
AC_PROVIDER: ${{ secrets.AC_PROVIDER }} # May not be needed
141+
working-directory: ${{ env.DIST_DIR }}/notarize_temp
142+
run: |
143+
cp ../../gon.config.hcl .
144+
gon gon.config.hcl
145+
146+
- name: Re-package notarized binary
147+
working-directory: ${{ env.DIST_DIR }}/notarize_temp
148+
run: |
149+
chmod +x qdl
150+
tar -czvf ${{ env.PROJECT_NAME }}_${{ github.ref_name }}_macOS_64bit.tar.gz qdl
151+
mv ${{ env.PROJECT_NAME }}_${{ github.ref_name }}_macOS_64bit.tar.gz ../
152+
153+
- name: Upload notarized macOS artifact
154+
uses: actions/upload-artifact@v4
155+
with:
156+
if-no-files-found: error
157+
name: ${{ env.ARTIFACT_NAME }}_macOS_64bit
158+
path: ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_${{ github.ref_name }}_macOS_64bit.tar.gz
159+
overwrite: true # Important: replace the original macOS artifact
160+
161+
create-release:
162+
needs: [build, sign-and-notarize-macos]
163+
runs-on: ubuntu-latest
164+
permissions:
165+
contents: write
166+
steps:
167+
- name: Download artifact
168+
uses: actions/download-artifact@v4
169+
with:
170+
pattern: ${{ env.ARTIFACT_NAME }}*
171+
path: ${{ env.DIST_DIR }}
172+
merge-multiple: true
173+
174+
- name: Create Github Release and upload artifacts
175+
uses: ncipollo/release-action@v1
176+
with:
177+
token: ${{ secrets.GITHUB_TOKEN }}
178+
draft: false
179+
artifacts: "${{ env.DIST_DIR }}/*"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# qdl-packing

gon.config.hcl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/general/gon.config.hcl
2+
# See: https://github.com/Bearer/gon#configuration-file
3+
source = ["qdl"]
4+
bundle_id = "cc.arduino.qdl"
5+
6+
sign {
7+
application_identity = "Developer ID Application: ARDUINO SA (7KT7ZWMCJT)"
8+
}
9+
10+
# Ask Gon for zip output to force notarization process to take place.
11+
# The CI will ignore the zip output, using the signed binary only.
12+
zip {
13+
output_path = "unused.zip"
14+
}

patches/build_static.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/Makefile b/Makefile
2+
index 203cb04..4482eb8 100644
3+
--- a/Makefile
4+
+++ b/Makefile
5+
@@ -3,7 +3,7 @@ RAMDUMP := qdl-ramdump
6+
VERSION := $(or $(VERSION), $(shell git describe --dirty --always --tags 2>/dev/null), "unknown-version")
7+
8+
CFLAGS += -O2 -Wall -g `pkg-config --cflags libxml-2.0 libusb-1.0`
9+
-LDFLAGS += `pkg-config --libs libxml-2.0 libusb-1.0`
10+
+LDFLAGS += `pkg-config --libs libxml-2.0 libusb-1.0 --static`
11+
prefix := /usr/local
12+
13+
QDL_SRCS := firehose.c io.c qdl.c sahara.c util.c patch.c program.c read.c sim.c ufs.c usb.c ux.c oscompat.c

0 commit comments

Comments
 (0)